• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

EXP eggs

Maten

New Member
Joined
Mar 16, 2009
Messages
219
Reaction score
2
Hi!

Im looking for a script that when you use lets say item: 2328 you will gain 200000 exp if your lvl is 8-150 and from 150-300 you will gain 100000 and from 300+ just 1 exp..

thanks in advance :) rep will be given
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if item.itemid == 2328 and getPlayerLevel(cid) >= 300 then 
        doPlayerAddExperience(cid, 1)
        doRemoveItem(item.uid, 1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) <= 150 then 
        doPlayerAddExperience(cid, 200000)
        doRemoveItem(item.uid, 1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) >=150 and not getPlayerLevel (cid) >= 300  then
        doPlayerAddExperience(cid, 100000)
        doRemoveItem(item.uid, 1) 	
    end 
    return true
end

I'd assume it's something like this.
 
Just one more thing, what do i do if i want to add some animated text like "you gained 100000 experience"?
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if item.itemid == 2328 and getPlayerLevel(cid) >= 300 then 
        doPlayerAddExperience(cid, 1)
        doRemoveItem(item.uid, 1)
		doCreatureSay(cid, "1EXP", TALKTYPE_BLUE_1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) <= 150 then 
        doPlayerAddExperience(cid, 200000)
        doRemoveItem(item.uid, 1) 
		doCreatureSay(cid, "200000EXP", TALKTYPE_BLUE_1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) >=150 and not getPlayerLevel (cid) >= 300  then 
        doPlayerAddExperience(cid, 100000)
        doRemoveItem(item.uid, 1) 	
		doCreatureSay(cid, "100000EXP", TALKTYPE_BLUE_1) 
    end 
    return true
end
 
yea i have that but i mean animated text like you know the ones thats are on tp's :p

- - - Updated - - -

never mind i found this "doSendAnimatedText(getPlayerPosition(cid), "100000exp", TEXTCOLOR_BLUE)" :)
 
doSendAnimatedText is a deprecated function in newer protocols but it's working below 9.X though.
 
yes but i use 8.60, anyway i get this error when a player over 150 try's to use the eggs :

Code:
[19/02/2013 14:20:14] [Error - Action Interface] 
[19/02/2013 14:20:14] data/actions/scripts/expegg.lua:onUse
[19/02/2013 14:20:14] Description: 
[19/02/2013 14:20:14] data/actions/scripts/expegg.lua:12: attempt to compare number with boolean
[19/02/2013 14:20:14] stack traceback:
[19/02/2013 14:20:14] 	data/actions/scripts/expegg.lua:12: in function <data/actions/scripts/expegg.lua:1>


expegg.lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if item.itemid == 2328 and getPlayerLevel(cid) >= 300 then 
        doPlayerAddExperience(cid, 1)
		doCreatureSay(cid, "You gaind 1 experience", TALKTYPE_ORANGE_1)
		doSendAnimatedText(getPlayerPosition(cid), "1", TEXTCOLOR_WHITE)
        doRemoveItem(item.uid, 1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) <= 150 then 
        doPlayerAddExperience(cid, 100000)
		doSendMagicEffect(getPlayerPosition(cid),28)
		doCreatureSay(cid, "You gaind 100000 experience", TALKTYPE_ORANGE_1)
		doSendAnimatedText(getPlayerPosition(cid), "100000", TEXTCOLOR_WHITE)
        doRemoveItem(item.uid, 1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) >=150 and not getPlayerLevel (cid) >= 300 then
        doPlayerAddExperience(cid, 50000)
		doSendMagicEffect(getPlayerPosition(cid),28)
		doCreatureSay(cid, "You gaind 50000 experience", TALKTYPE_ORANGE_1)
		doSendAnimatedText(getPlayerPosition(cid), "50000", TEXTCOLOR_WHITE)
        doRemoveItem(item.uid, 1) 	
    end 
    return true
end
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition) 
    if item.itemid == 2328 and getPlayerLevel(cid) >= 300 then 
        doPlayerAddExperience(cid, 1)
		doCreatureSay(cid, "You gaind 1 experience", TALKTYPE_ORANGE_1)
		doSendAnimatedText(getPlayerPosition(cid), "1", TEXTCOLOR_WHITE)
        doRemoveItem(item.uid, 1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) <= 150 then 
        doPlayerAddExperience(cid, 100000)
		doSendMagicEffect(getPlayerPosition(cid),28)
		doCreatureSay(cid, "You gaind 100000 experience", TALKTYPE_ORANGE_1)
		doSendAnimatedText(getPlayerPosition(cid), "100000", TEXTCOLOR_WHITE)
        doRemoveItem(item.uid, 1) 
    elseif item.itemid == 2328 and getPlayerLevel (cid) >=151 and getPlayerLevel (cid) < 300 then
        doPlayerAddExperience(cid, 50000)
		doSendMagicEffect(getPlayerPosition(cid),28)
		doCreatureSay(cid, "You gaind 50000 experience", TALKTYPE_ORANGE_1)
		doSendAnimatedText(getPlayerPosition(cid), "50000", TEXTCOLOR_WHITE)
        doRemoveItem(item.uid, 1) 	
    end 
    return true
end

this might work better
 
Back
Top