function onUse(cid, item, fromPosition, itemEx, toPosition)
doPlayerAddExperience(cid, getPlayerExperience(cid) * 0.30) --- Write 30 if you want it to be 30%
doCreatureSay(cid, "You have recieved ".. getPlayerExperience(cid) * 0.30.." Experience points!", 19)
return true
end
Ive never created a script like this, but ill give you a little hint on how it Should look like
Code:function onUse(cid, item, fromPosition, itemEx, toPosition) doPlayerAddExperience(cid, getPlayerExperience / 30) --- Write 30 if you want it to be 30% return true end
doPlayerAddExperience(cid, getPlayerExperience(cid)*0.23)
My bad, its * yeah. I was kinda confused about the / or *. Thanks for correcting meCode:doPlayerAddExperience(cid, getPlayerExperience(cid)*0.23)
if string.lower(msg) == "xp" then
doPlayerAddExperience(cid, getPlayerExperience(cid)*0.3)
selfSay("Here you go noob", cid)
end
You can also do it with /, for 23% it's most easy to do * 0.23, else you have to do /4.347826086956522.My bad, its * yeah. I was kinda confused about the / or *. Thanks for correcting me
It does do that, I assumed that is what you ment, if it should give a % of a different amount of exp, you can do that * 0.3This script:
PHP:if string.lower(msg) == "xp" then doPlayerAddExperience(cid, getPlayerExperience(cid)*0.3) selfSay("Here you go noob", cid) end
Is giving WAY more than 30%, it gives about 2 levels.
Could it be that "getPlayerExperience(cid)*0.3" gives 30% of your TOTAL experience?
You can also do it with /, for 23% it's most easy to do * 0.23, else you have to do /4.347826086956522.
It does do that, I assumed that is what you ment, if it should give a % of a different amount of exp, you can do that * 0.3
Oh, then the script is gonna be like this.It's supposte too give % of the XP needed from lvl a to b.
For example, you need 1.000 XP from level 1-2. You get 30% of that = 300XP
doPlayerAddExperience(cid, getPlayerLevel(cid) * 0.3)
It gives you lvl * 0.3 So i get 6,3 XP if im lvl 21Oh, then the script is gonna be like this.
Test it out and post back hereCode:doPlayerAddExperience(cid, getPlayerLevel(cid) * 0.3)
function onUse(cid, item, fromPosition, itemEx, toPosition)
doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid) + 1) * .23)
doCreatureSay(cid, "You have recieved ".. (getExperienceForLevel(getPlayerLevel(cid) + 1) * .23) .." Experience points!", 19)
return true
end
doPlayerAddExperience(cid, (getExperienceForLevel(getPlayerLevel(cid)+1) - getExperienceForLevel(getPlayerLevel(cid))) * 0.3)
Code:doPlayerAddExperience(cid, (getExperienceForLevel(getPlayerLevel(cid)+1) - getExperienceForLevel(getPlayerLevel(cid))) * 0.3)
Oh, then the script is gonna be like this.
Test it out and post back hereCode:doPlayerAddExperience(cid, getPlayerLevel(cid) * 0.3)