Mera Mero
Guess Who?
- Joined
- Dec 27, 2014
- Messages
- 417
- Reaction score
- 86
hi ,otlanders i've got script of double exp for Period of time but time isn't working with offline players i mean if that player goes to log the time stop till he is get on :S may you help me ?!
i need this script to work while online and offline
Code:
local config = {
rate = 1.5, -- 4x More Experience
time = 1, -- Hours of Exp Time
storage = 20012
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1) -- config.lua rate
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Your extra experience time has ended.")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) < 0) 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)
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