Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- rate = 1,
- storage = 41210,
- expstorage = 41211,
- register = 41212,
- time = 30,
- }
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- if getPlayerStorageValue(cid, config.storage) <= 0 then
- local rates = getPlayerRates(cid)
- setPlayerStorageValue(cid, config.expstorage, rates[SKILL__LEVEL])
- setPlayerStorageValue(cid, config.register, 1)
- itemEx=itemid == 7443
- doCreatureSay(cid, "Você está usando double exp potion!", TALKTYPE_ORANGE_1, true, cid)
- setPlayerStorageValue(cid, config.storage, os.time()+config.time)
- doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+config.rate)
- doRemoveItem(item.uid,1)
- registerCreatureEvent(cid, "ExpStage")
- else
- doCreatureSay(cid, "Você já está usando double exp potion!", TALKTYPE_ORANGE_1, true, cid)
- end
- return true
- end
- function onThink(cid, interval)
- if getPlayerStorageValue(cid, config.register) == 1 then
- if getPlayerStorageValue(cid, config.storage) <= os.time() then
- doCreatureSay(cid, "A sua double exp potion encerrou!", TALKTYPE_ORANGE_1, true, cid)
- setPlayerStorageValue(cid, config.storage, 0)
- setPlayerStorageValue(cid, config.register, 0)
- local oldexp = getPlayerStorageValue(cid, config.expstorage)
- doPlayerSetExperienceRate(cid, oldexp)
- unregisterCreatureEvent(cid, "ExpStage")
- end
- end
- return true
- end
- function onLogin(cid)
- if getPlayerStorageValue(cid, config.register) == 1 then
- registerCreatureEvent(cid, "ExpStage")
- local rates = getPlayerRates(cid)
- doCreatureSay(cid, "A sua double exp potion ainda continua ativada!", TALKTYPE_ORANGE_1, true, cid)
- if getPlayerStorageValue(cid, config.storage) > os.time() then
- local oldexp = getPlayerStorageValue(cid, config.expstorage)
- doPlayerSetExperienceRate(cid, oldexp+config.rate)
- end
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement