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

Lua Small Lua Script

Frozen_Cloud

New Member
Joined
Oct 10, 2010
Messages
57
Reaction score
1
Greetings, i have made a simple script so if you click on a tree then you get a "cock" under your feets...

I would like to add exhaust time between this action so for example a player can click on the three only once per 10 minutes, anyone can help me? ;(

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local PlayerPosition = getCreaturePosition(cid)
				doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a cock")
                doCreateItem(8582,1,PlayerPosition)
				
end
 
Try this:
Lua:
local config = {
		storage = 23000, -- free storage
		exhaustionTime = 100, -- time between actions
		item = 8582, -- item which player will give
		count = 1 -- count of item
		}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local PlayerPosition = getCreaturePosition(cid)
	
	if exhaustion.check(cid, config.storage) == false then
		exhaustion.set(cid, config.storage, config.exhaustionTime)
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a cock")
                doCreateItem(config.item, config.count, PlayerPosition)
	else
		doPlayerSendCancel(cid, "Cooldown [" ..exhaustion.get(cid, config.storage).."]")
	end
end
 
Back
Top