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

Lua ChestQuest Different loot for vocation

molik

New Member
Joined
Jul 30, 2009
Messages
40
Reaction score
0
I found a script for a chest quest but i wanted different vocations do gain different loot. i tried things like
if PlayerVocation == 1
but i didnt manage to make it work.
And i cant find anywhere to learn how to do it.

So if someone would tell me how to do it i'd be glad
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
SorcererItem = 2000,
DruidItem = 3000,
PaladinItem = 4000,
KnightPaladin = 5000
}

if getPlayerStorageValue(cid,9004) == 1 then
    doPlayerSendCancel(cid,"Sorry, you have already done this quest.")
  elseif isSorcerer(cid) == true then
                doPlayerAddItem(cid,config.SorcererItem,1)
                doCreatureSay(cid, "Heres an item for a Sorcerer", TALKTYPE_ORANGE_1)
                setPlayerStorageValue(cid,9004,1)
        elseif isDruid(cid) == true then
                    doPlayerAddItem(cid,config.DruidItem,1)
                doCreatureSay(cid, "Heres an item for a Druid", TALKTYPE_ORANGE_1)
                setPlayerStorageValue(cid,9004,1)
        elseif isPaladin(cid) == true then
                    doPlayerAddItem(cid,config.PaladinItem,1)
                doCreatureSay(cid, "Heres an item for a Paladin", TALKTYPE_ORANGE_1)
                setPlayerStorageValue(cid,9004,1)
        elseif isKnight(cid) == true then
                    doPlayerAddItem(cid,config.KnightItem,1)
                doCreatureSay(cid, "Heres an item for a Knight", TALKTYPE_ORANGE_1)
                setPlayerStorageValue(cid,9004,1)
end 
    return TRUE
         end
 
Thx, I'll try it out.
EDIT
Well, it did work on one of my chests... but on the other one it only created a Marble floor since i changed the uid on the chest to 1003 which is a marble floor. the one that worked is also a marble floor but i dont know why only that one worked. Even though its exactly the same code
EDIT again...
Sovled. it didnt works since i didnt put it in Actions.xml
 
Last edited:
Back
Top