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

custom chest code (help)

Enijota

New Member
Joined
May 29, 2017
Messages
1
Reaction score
0
What's wrong with this custom chest code?

.LUA
Code:
local cfg = {

    kina= {2430}, 
    pala = {2173}, 
    sorc = {2189},
    drui = {8857}, 

}

function onUse(cid, item)

    if getPlayerStorageValue(cid, 38493) ~= 1 then
        if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
            doPlayerAddItem(cid, cfg.kina[1], 1)
            doPlayerAddItem(cid, cfg.kina[2], 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 38493, 1)
        elseif getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 then
            doPlayerAddItem(cid, cfg.sorc, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 38493, 1)
        elseif getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 then
            doPlayerAddItem(cid, cfg.drui, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 38493, 1)
        elseif getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
            doPlayerAddItem(cid, cfg.pala, 1)
            doPlayerSendTextMessage(cid, 25, "Congratulations!!")
            doPlayerSetStorageValue(cid, 38493, 1)
                end
    else
        doPlayerSendCancel(cid, "It's empty.")
    end

    return true
end

.XML

Code:
<action actionid="5511" event="script" value="simple.lua"/>



:(
 
Code:
local cfg = {
    {2430, 1132}, --sorcerer
    {2173, 3321, 4411}, --druid
    {2189}, --paladin
    {8857, 1146} --knight
}

function onUse(cid, item)
    local voc = getPlayerVocation(cid);
    voc = voc > 4 and voc - 4 or voc;
    if getPlayerStorageValue(cid, 38493) ~= 1 then
        for i = 1, #cfg[voc] do
            doPlayerAddItem(cid, cfg[voc][i], 1)
        end
        doPlayerSendTextMessage(cid, 25, "Congratulations!!")
        doPlayerSetStorageValue(cid, 38493, 1)
    else
        doPlayerSendCancel(cid, "It's empty.")
    end
    return true
end
 
Back
Top