Stellow
C++/C#/PHP/LUA
Someone requested a script in which the player click on the statue and refill his/her full stamina if the statue is not exhausted.
Code:
local StatueStorage = 88888
local TimeBetweenExecution = 1 * 60 * 60 -- 1 hour
function onUse(cid, item, fromPosition, itemEx, toPosition)
local lastTime = getGlobalStorageValue(StatueStorage)
local nextTime = lastTime + TimeBetweenExecution
local now = os.time()
local timeLeft = nextTime - now
if now >= nextTime then
setGlobalStorageValue(StatueStorage, now)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your stamina has charged")
doPlayerSetStamina(cid, 42 * 60 * 1000)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This statue can be executed in " .. timeLeft/60 .. " minutes.")
end
return false
end