• 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!

Give more than one item,

ugurdrahs

New Member
Joined
May 6, 2010
Messages
555
Reaction score
2
Location
Netherland
PHP:
function onAdvance(cid, skill, oldlevel, newlevel)
       
        if(getPlayerStorageValue(cid, 99963) ~= 1 and skill == SKILL__LEVEL and newlevel >= 45) then
                doPlayerAddItem(cid, 2160, 5)
                setPlayerStorageValue(cid, 99963, 1)
                doPlayerSendTextMessage(cid, 22, "You have received 5 crystal coins because you reached level 45")
                end
        return TRUE
end

How to give like,

20 mana potions
and 20 health potions?
 
Last edited:
Mmmm.....
You see the:
LUA:
doPlayerAddItem(cid, 2160, 5)
????
Well, i explain that...:
doPayerAddItem: add an item to the player
cid: identificates the player
2160: item id
5: amount to add

So if u want 20 mana potions and 20 health potions, u need to duplicate the doPlayerAddItem function, and change the item id and amount....

Hope i helped u....

EDIT: But this script, only give 1 time the items to the player, if the player dies and losed a level, so he will be 44, and then he advance to level 45, he dont get the items again.....
 
.

Mmmm.....
You see the:
LUA:
doPlayerAddItem(cid, 2160, 5)
????
Well, i explain that...:
doPayerAddItem: add an item to the player
cid: identificates the player
2160: item id
5: amount to add

So if u want 20 mana potions and 20 health potions, u need to duplicate the doPlayerAddItem function, and change the item id and amount....

Hope i helped u....

EDIT: But this script, only give 1 time the items to the player, if the player dies and losed a level, so he will be 44, and then he advance to level 45, he dont get the items again.....

ye I understand wha u mean but thats not the answer on my question :(
 
You change this "doPlayerAddItem(cid, 2160, 5)"

to:

Code:
doPlayerAddItem(cid, 7618, 20)--Health potion
doPlayerAddItem(cid, 7620, 20)--Mana potion

so the whole code would be this:

Code:
function onAdvance(cid, skill, oldlevel, newlevel) 
        
        if(getPlayerStorageValue(cid, 99963) ~= 1 and skill == SKILL__LEVEL and newlevel >= 45) then 
                doPlayerAddItem(cid, 7618, 20)--Health potion
                doPlayerAddItem(cid, 7620, 20)--Mana potion
                setPlayerStorageValue(cid, 99963, 1) 
                doPlayerSendTextMessage(cid, 22, "You have received 20 health potions and 20 mana potions because you reached level 45") 
                end 
        return TRUE 
end

Hope this helps :ninja:
 
You change this "doPlayerAddItem(cid, 2160, 5)"

to:

Code:
doPlayerAddItem(cid, 7618, 20)--Health potion
doPlayerAddItem(cid, 7620, 20)--Mana potion

so the whole code would be this:

Code:
function onAdvance(cid, skill, oldlevel, newlevel) 
        
        if(getPlayerStorageValue(cid, 99963) ~= 1 and skill == SKILL__LEVEL and newlevel >= 45) then 
                doPlayerAddItem(cid, 7618, 20)--Health potion
                doPlayerAddItem(cid, 7620, 20)--Mana potion
                setPlayerStorageValue(cid, 99963, 1) 
                doPlayerSendTextMessage(cid, 22, "You have received 20 health potions and 20 mana potions because you reached level 45") 
                end 
        return TRUE 
end

Hope this helps :ninja:


repp+ for u,
thx m8
 
repp+ for u,
thx m8

np ^^ but the level check line looks weird to me, it works still tho but i would have used this:

Code:
if(skill == SKILL__LEVEL and oldlevel < 45 and newlevel >= 45) then

u wont need a storage, but with the storage u can prevent downgrade > level up to get the items more then once tho..
:P
 
Back
Top