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

Action item teleport when have storage and vocation..

adamox223

New Member
Joined
Oct 21, 2017
Messages
99
Reaction score
4
Hello i need help, i tested my script but only one way working, i need work all script..
So when we ppm on item, if we have storage 2000, 127 and vocation 1,101,102,103 etc then teleport here:
player:teleport({x = 576, y = 35, z = 7})
and when we have storage 2000, 127 and vocation 2, 200, 201, 202 then teleport here:
player:teleport({x = 536, y = 55, z = 7})

i try this script but only work with storage, vocation dont work can you help me?


Code:
local cfg = {
storaged = 2000, -- change storage to whatever you want it.

}

local vocs = {
One = {1, 101, 102, 103, 104, 105, 106, 107},
Two = {2, 6},
Three = {3, 7},
Four = {4, 8}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
player.add(cid)
    if player:storage('check', STORAGE_PLAYER_MISSION_NUMBER, 127) and getPlayerVocation(cid) == vocs.one then
         player:teleport({x = 576, y = 35, z = 7})
            
        elseif player:storage('check', STORAGE_PLAYER_MISSION_NUMBER, 127) and getPlayerVocation(cid) == vocs.two then
             player:teleport({x = 576, y = 35, z = 7})
        
        
    else
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already fight with this.")
    end
return TRUE
end
 
Lua:
local config = {
    {2000, 127, {1, 2, 3, 4}, {x = 1000, y = 1000, z = 7}}, --{storage, value, {vocation required}, {position}}
    {2000, 127, {4, 5, 6, 7}, {x = 1001, y = 1001, z = 7}},
    {2000, 127, {8, 9, 10, 11}, {x = 1002, y = 1002, z = 7}},
    {2000, 127, {12, 13, 14, 15}, {x = 1003, y = 1003, z = 7}}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    for i = 1, #config do
        if isInArray(config[i][3], getPlayerVocation(cid)) then
            local storage = getPlayerStorageValue(cid, config[i][1])
            if storage == config[i][2] then
                doTeleportThing(cid, config[i][4])
            elseif storage < config[i][2] then
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You haven't started this quest yet.")
            else
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You've already completed this quest.")
            end
            return true
        end
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Error. Contact Admin. Error code: 45007") -- Vocation not found in config.
    return true
end
 
Back
Top