Thorn
Spriting since 2013
hello guys! i have a script of an action that gives you X experience for X ammount of time, the one i will post here is x3 exp for 24 hours, but when the player logs out the exp comes back to normal :/ and if they want to want it again, it says is not possible because there's still some exp time left
plz guys help me to make this script last thopse 24 hours, no matter if the player log out, or the server goes down, etc, so 24 hours of gameplay
plz guys help me to make this script last thopse 24 hours, no matter if the player log out, or the server goes down, etc, so 24 hours of gameplay
Code:
local config = {
rate = 3.0, -- 4x More Experience
time = 24, -- Hours of Exp Time
storage = 20011
}
local function endExpRate(cid)
doPlayerSetRate(cid, SKILL__LEVEL, 6.0) --config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) == -1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your extra experience rate is now: " .. config.rate .. ". It will last for ".. config.time .." hours.")
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time * 3600 * 1000)
addEvent(endExpRate, config.time * 3600 * 1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You still have extra experience time left.")
end
return true
end