F
Forsakenfate
Guest
Hello I edited the script by NieWiemJakiNick, not sure if it was his.
This token gives the player +2.5x experience for 15 minutes when he right-clicks it.
My only problem is when a character dies or relog during the effect of this token, he can never use a token again.. here is the script:
Exp Token:
local config = {
rate = 2.50, -- 4x More Experience
time = 0.25, -- 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 or died and have to wait to use the next token")
end
return TRUE
end
Can anyone edit this to make it work?
Thanks for your time. Rep++ for help
This token gives the player +2.5x experience for 15 minutes when he right-clicks it.
My only problem is when a character dies or relog during the effect of this token, he can never use a token again.. here is the script:
Exp Token:
local config = {
rate = 2.50, -- 4x More Experience
time = 0.25, -- 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 or died and have to wait to use the next token")
end
return TRUE
end
Can anyone edit this to make it work?
Thanks for your time. Rep++ for help