- Joined
- Jan 15, 2014
- Messages
- 1,317
- Solutions
- 35
- Reaction score
- 435
Hello,
I am wondering if is possible to set clock that will stop when the player is offline and start again when he is back online.
Right now when the player uses this item it will start counting down 2 hours whether he is online or offline. Is there a way to make it so that when the player is offline the clock will pause?
I am wondering if is possible to set clock that will stop when the player is offline and start again when he is back online.
Right now when the player uses this item it will start counting down 2 hours whether he is online or offline. Is there a way to make it so that when the player is offline the clock will pause?
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local doubleexp = 7200
local delaytime = 86400
if getPlayerStorageValue(cid, 63667) > 0 then
doPlayerPopupFYI(cid, "You may only use this once a day!.\nYou have to wait: " .. math.floor((getPlayerBonusDelay(cid))/3600) .. " hours and " .. ( os.date("%M",getPlayerBonusDelay(cid))) .. " minutes and " .. ( os.date("%S",getPlayerBonusDelay(cid))) .." seconds before you can use it again.")
else
doSendMagicEffect(getCreaturePosition(cid),29)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have just activated 2 hours of 25% bonus exp!!!")
setPlayerStorageValue(cid, 63666, os.time()+doubleexp+getPlayerBonusTime(cid))
setPlayerStorageValue(cid, 63667, os.time()+delaytime)
doRemoveItem(item.uid)
end
return true
end