function onUse(cid, item, fromPosition, toPosition)
if isPremium(cid) then
if getPlayerLevel(cid) >= 25 then
local time = 1000*60*10
fireworksEffect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)
doSendMagicEffect(fromPosition, fireworksEffect)
doSendAnimatedText(getPlayerPosition(cid), "Congratulations!", TEXTCOLOR_RED)
setPlayerExtraExpRate(cid, 5)
addEvent(resetExpRate, time)
end
end
end
function resetExpRate(cid, item, fromPosition, toPosition)
setPlayerExtraExpRate(cid,0)
end
mmm...
With empty help
Code:function onUse(cid, item, fromPosition, toPosition) if isPremium(cid) then if getPlayerLevel(cid) >= 25 then local time = 1000*60*10 fireworksEffect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE) doSendMagicEffect(fromPosition, fireworksEffect) doSendAnimatedText(getPlayerPosition(cid), "Congratulations!", TEXTCOLOR_RED) setPlayerExtraExpRate(cid, 5) addEvent(resetExpRate, time) end end end function resetExpRate(cid, item, fromPosition, toPosition) setPlayerExtraExpRate(cid,0) end
It should be works ^.-
function onEquip(cid, item, slot)
z.item = 1000 -- ID of your item .
msg = "2x more experience now."
firework = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)
if item.itemid == z.item then
if isPremium(cid) then
if getPlayerLevel(cid) >= 25 then
doCreatureSay(cid, msg)
setPlayerExtraExpRate(cid, 2)
doSendMagicEffect(fromPosition, firework)
end
return TRUE
end
end
mmm...
With empty help
Code:function onUse(cid, item, fromPosition, toPosition) if isPremium(cid) then if getPlayerLevel(cid) >= 25 then local time = 1000*60*10 fireworksEffect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE) doSendMagicEffect(fromPosition, fireworksEffect) doSendAnimatedText(getPlayerPosition(cid), "Congratulations!", TEXTCOLOR_RED) setPlayerExtraExpRate(cid, 5) addEvent(resetExpRate, time) end end end function resetExpRate(cid, item, fromPosition, toPosition) setPlayerExtraExpRate(cid,0) end
It should be works ^.-
What if the player will logout? -.^
Btw, he didnt want an action (onUse), but an exp booster (onEquip), with movement you dont need to use addEvent.
local config = {
level = 25,
msg = "Double Experience!",
effect = math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE)
}
function onEquip(cid, item, slot)
if isPremium(cid) == TRUE and getPlayerLevel(cid) >= config.level then
doCreatureSay(cid, config.msg, TALKTYPE_ORANGE_1)
setPlayerExtraExpRate(cid, 2)
doSendMagicEffect(getPlayerPosition(cid), config.effect)
end
return TRUE
end
function onDeEquip(cid, item, slot)
if isPremium(cid) == TRUE and getPlayerLevel(cid) >= config.level then
setPlayerExtraExpRate(cid, 1)
end
return TRUE
end
Men
This script use the function "OnEquip" and "OnDeEquip"
PD:
Thx
function onDeEquip(cid, item, slot)
msg = "You removed your item"
z.item = 1000
if item.itemid == z.item then
if isPremium(cid) then
doCreatureSay(cid, msg)
setPlayerExtraExpRate(cid, 0)
end
return TRUE
end