local config = {
rate = 2,
time = 480, -- Minutes Of Double Exp
storage = 21002
}
local function endExpRate(cid)
if isPlayer(cid) == TRUE then
doPlayerSetRate(cid, SKILL__LEVEL, 1)
setPlayerStorageValue(cid, config.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "The effect of the Double EXP Potion ended!")
end
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(getPlayerStorageValue(cid, config.storage) < 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "His experience was doubled during ".. config.time .." minutes.")
doSendMagicEffect(getPlayerPosition(cid), 53)
doCreatureSay(cid,'Double Experience Actived!', TALKTYPE_ORANGE_1)
doPlayerSetRate(cid, SKILL__LEVEL, config.rate)
setPlayerStorageValue(cid, config.storage, os.time() + config.time * 60)
addEvent(endExpRate, config.time * 60 * 1000, cid)
doRemoveItem(item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your still under the effect of Double Exp Potion, Wait till the time to stop to use it again.")
end
return TRUE
end