Ola,
desenvolvi um "comando" pela lib das actions muito fácil de adicionar, não precisa mexer nas sources nem compilar.
o comando é:
getPlayerExhaust(player,number,time)
Como usar:
player = cid ---em quem vai ser verificado tipo item2.uidnumber = 1457 ----um storage value a tua escolhatime = 10 ----tempo de exhaust em segundosif getPlayerExhaust(player,number,time) == -1 then(...)elsedoPlayerSendCancel(cid,"You are exhausted")end
-1 é não exhausted
1 é exhausted
Agora para o comando funcionar quandu voce quiser voce vai ter que ir na pasta data/actions/lib e abrir o documento actions.lua e adicionar la dentro o seguinte code:
function getPlayerExhaust(player,number,time)now = os.time()before = getPlayerStorageValue(player,number)exhaust = os.difftime(now,before)if before == -1 thensetPlayerStorageValue(player,number,now)return -1elseif exhaust >= time thensetPlayerStorageValue(player,number,now)return -1elsereturn 1endendend
agora voce pode usar o comando nas actions que voce quiser
um exemplo de um item que quando voce da use aumenta tua mana com 5 segundos de exhaust:
function onUse(cid, item, frompos, item2, topos)if getPlayerExhaust(cid,1237,5) == -1 then doPlayerAddMana(cid,100) doRemoveItem(item.uid,1) doSendMagicEffect(topos,12) doPlayerSay(cid,"Aaaaah...",1)else doPlayerSendCancel(cid,"You are exhausted.") end
lembrando que quandu usa o comando getPlayerExhaust e o player não estiver exhausted, o player vai passar a estar exhausted.