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

Action Stamina refiller on statue after x time

Stellow

C++/C#/PHP/LUA
Joined
Oct 23, 2008
Messages
1,106
Reaction score
214
Location
Germany
GitHub
eubrunomiguel
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
 
Yea I got that request from someone too
Hey I saw that you are really good with scripts (I´m not) I was wondering if you could help me out I would like a script when I click on a statue i receive 1 hour Stamina , but the statue itself has timer going on him lets say 30 minutes , and after 30 minutes any player can click it and receive 1 hour stamina and after someone used there is again 30 min cooldown on it. It would be awesome if you could help me out!
That's what the request boards are for...
 
Back
Top