• 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!

Time to use Talkaction???

Olimar

New Member
Joined
Apr 10, 2013
Messages
5
Reaction score
0
Hello guys, I would like to add some time to use the command !aol. For example: You can only use command every 10 minutes.

Code:
function onSay(cid, words, param)

if doPlayerRemoveMoney(cid, 0) == true then
local bp = doPlayerAddItem(cid, 2173, 1)
doSendMagicEffect(getCreaturePosition(cid),13)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You won an Amulet of Loss.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough money.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end

I thank you ...
 
Something like this?
Lua:
local config = {
	storage = 1111,
	exhaust = 10*60
}

function onSay(cid, words, param)
	if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "You can only use this action every " .. (config.exhaust / 60) .. " minutes.")
		return true
	end


	if doPlayerRemoveMoney(cid, 0) == true then
		local bp = doPlayerAddItem(cid, 2173, 1)
		doSendMagicEffect(getCreaturePosition(cid),13)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You won an Amulet of Loss.")
		doPlayerSetStorageValue(cid, config.storage, os.time() + config.exhaust)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough money.")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
	return true
end
 
Something like this?
Lua:
local config = {
	storage = 1111,
	exhaust = 10*60
}

function onSay(cid, words, param)
	if getCreatureStorage(cid, config.storage) > os.time() then
		doPlayerSendCancel(cid, "You can only use this action every " .. (config.exhaust / 60) .. " minutes.")
		return true
	end


	if doPlayerRemoveMoney(cid, 0) == true then
		local bp = doPlayerAddItem(cid, 2173, 1)
		doSendMagicEffect(getCreaturePosition(cid),13)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You won an Amulet of Loss.")
		doPlayerSetStorageValue(cid, config.storage, os.time() + config.exhaust)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough money.")
		doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	end
	return true
end

It did not work, the server returned the following message.

It did not work, the server returned the following message.

Lua Script Error: [TalkActions Interface]
data/talkactions/scripts/aol.lua: onSay
data/talkactions/scripts/aol.lua:7: attempt to call global 'getCreatureStorage' <a nil value>
stack traceback
[C]: in function 'getCreatureStorage'
data/talkactions/scripts/aol.lua:7: in function <data/talkactions/scripts/aol.lua:6>

I use the TFS Mystic Spirit v2.0.15

Thanks...
 
Last edited:
It did not work :(. I've tried with "getCreatureStorage", "getPlayerStorage" and "getPlayerStorageValue".

Anyone else? TFS Version 2.0.15
 
Last edited:
Back
Top