local config = {
removeOnUse = true,
time = 1, -- minutes
storage = 26
}
config.boostItem = {
[itemID] = {
[SKILL__LEVEL] = 5,
[SKILL_AXE] = 10,
[SKILL_SWORD] = 50
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local val = config.boostItem[item.itemid]
if not val then return true end
if getCreatureStorage(cid, config.storage) - os.time() >= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You must wait for using this item.")
return true
end
if config.removeOnUse then
doRemoveItem(item.uid, 1)
end
for key, value in pairs(val) do
doPlayerSetRate(cid, key, value)
end
addEvent(function()
if isPlayer(cid) then
for key, value in pairs(val) do
doPlayerSetRate(cid, key, 1) -- set rates x1
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your boost time has over.")
doSendMagicEffect(getThingPosition(cid), CONST_ME_POFF)
end
end, config.time * 60 * 1000)
doCreatureSetStorage(cid, config.storage, os.time() + (config.time * 60))
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You\'ve been boosted.")
doCreatureSay(cid, "BOOST!", TALKTYPE_ORANGE_1)
doSendMagicEffect(getThingPosition(cid), CONST_ME_STUN)
return true
end