• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Clear frag, pay item

slaw

Software Developer
Joined
Aug 27, 2007
Messages
3,670
Solutions
125
Reaction score
1,117
Location
Germany
GitHub
slawkens
This command will remove player 1 frag, if he have item needed. :D

talkactions.xml
Code:
<talkaction words="!rf" script="removefrag.lua" />

removefrag.lua
Code:
local config =
{
	item = 333,
	count = 1,
	fragTime = getConfigInfo('timeToDecreaseFrags')
}

function onSay(cid, words, param)
	if getPlayerItemCount(cid, config.item) >= config.count then
		local tmp = getPlayerRedSkullTicks(cid)
		if tmp >= config.fragTime then
			doPlayerRemoveItem(cid, config.item, config.count)
			doPlayerSetRedSkullTicks(cid, tmp - config.fragTime)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your one frag has been cleared.")
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You dont have any frag to clear..")
		end
	else
		doPlayerSendCancel(cid, "You dont have this item.")
	end
	return TRUE
end
 
Last edited:
Wow, Im gonna test it.

It removes one frag, but I use the item id 7632 with the count 2, and it doesnt remove the count :S
Test it with id 2160, and doesnt remove de item when you use the talkaction, may you help me?
 
Last edited by a moderator:
Ah, wrong function used. doPlayerRemoveItem Instead doRemoveItem.

#Script updated ! :)
 
doesn't work for me:
data/talkactions/scripts/removefrag.lua:10: attempt to call global 'getPlayerRedSkullTicks' (a nil value)
[31/12/2008 22:48:14] stack traceback:
[31/12/2008 22:48:14] data/talkactions/scripts/removefrag.lua:10: in function <data/talkactions/scripts/removefrag.lua:8>
 
[01/01/2009 00:51:44] The Forgotten Server - Version 0.2 (Mystic Spirit).
(EldinWorld 8.31 sql) if for this server not work can u give me the server where this work.
 
It's not working :/
When i've killed someone and i'll use command !frags it says:
13:57 You have 1 unjustified frag. The amount of unjustified frags will decrease after: 23h and 59m.
And when i want to use this command it says:
13:57 You dont have any frag to clear..
And its not showing any errors. I use TFS 0.3 beta 3
 
Back
Top