function onUse(cid, item, fromPosition, itemEx, toPosition)
local currentLevel = getPlayerLevel(cid)
local expGain = currentLevel * 2 * 100
if getPlayerLevel(cid) >= 500 then
doCreatureSay(cid, 'You level is too high.', TALKTYPE_ORANGE_1)
return false
end
doRemoveItem(item.uid)
doPlayerAddExp(cid, currentLevel * 2 * 100)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doCreatureSay(cid, 'You gained '.. expGain ..' exp!', TALKTYPE_ORANGE_1)
return true
end
<action itemid="7722" script="other/levelscroll.lua"/>
<action itemid="[b]7722[/b]" script="other/levelscroll.lua"/>
No way..
doPlayerAddExp(cid, currentLevel * 2 * 100)
Adds experience equal to the level * 200 but he wants 20 level and not 200 and also it would be + not * and anyway you need to use that getExperienceForLevel function or so to get the right number of exp..
function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = getThingPos(cid)
if not(getPlayerLevel(cid) > 500)then
if(getPlayerLevel(cid) > 480)then
doRemoveItem(item.uid)
doPlayerAddLevel(cid,getPlayerLevel(cid)-500)
doSendMagicEffect(v,11)
doPlayerSendTextMessage(cid,27,'You\'ve gained '..(getPlayerLevel(cid)-500)..' levels.')
else
doRemoveItem(item.uid)
doPlayerAddLevel(cid,20)
doSendMagicEffect(v,12)
doPlayerSendTextMessage(cid,27,'You\'ve gained 20 levels.')
end
else
doPlayerSendTextMessage(cid,27,'You can\'t use this scroll above level 500!')
doSendMagicEffect(v,2)
end
return true
end