Jump to content

Problema pra salvar a cidade do jogador


Recommended Posts

Posted
playerzone = {}
function table.toString(tbl, beautify, recLvl)
    if beautify == nil then beautify = true end
    recLvl = recLvl or 0
    local str = '{'..(beautify and '\n' or '')
    local kStr
    local vStr
    for k,v in pairs(tbl) do
        for i=0,recLvl do
            str = str..(beautify and '\t' or '')
        end
        kStr = (type(k) == 'string' and '"%s"' or '%s')
        kStr = ('['..kStr..']'):format(k)
        vStr = (type(v) == 'table' and table.toString(v, beautify, recLvl+1) or v)
        str = str..kStr..' = '..vStr
		str = str..(next(tbl,k) and ',' or '')
        str = str..(beautify and '\n' or '')
    end
    if beautify then
        for i=1,recLvl do
            str = str..'\t'
        end
    end
    return str..'}'
end
-------------------------------------------MARKRS PARA ENTRAR NA AGENCIA
local function criarmarks()
            for a,b in ipairs(markerentrarinterioragencia["markers"]) do
                local markerTpInt = createMarker(b[1],b[2],b[3],markerentrarinterioragencia["Tipo-Markes"][1],markerentrarinterioragencia["Tamanho-Markes"][1],markerentrarinterioragencia["Cores-Markes"][1],markerentrarinterioragencia["Cores-Markes"][2],markerentrarinterioragencia["Cores-Markes"][3],markerentrarinterioragencia["Cores-Markes"][4])
                local blipTpInt = createBlipAttachedTo(markerTpInt,42,2,255,255,255,255,-1,9999999999)
                addEventHandler("onMarkerHit",markerTpInt,entrarIntAgencia)
                
            end
       end
       addEventHandler("onResourceStart",getRootElement(getThisResource()),criarmarks)
---------------------------------------------------------------------------------------

function entrarIntAgencia(player)
    if getElementType(player) == "player" and isPedInVehicle(player)  then  
        for a,b in ipairs(markerentrarinterioragencia["textos"]) do 
            outputChatBox(markerentrarinterioragencia["textos"][1][1],player,255,255,255,true)
            break
        end
    else
        x, y, z = getElementPosition(player)
        city = getZoneName(x, y, z, true)-------------------------- AO ENTRAR NA AGENCIA PEGA A CIDADE DO JOGADOR
        table.insert(playerzone,{city})  -----------INSERE A CIDADE DA TABELA
        print(tostring(city))-------------PRINTA A INFORMAÇAO PARA VERIFICAR
        setTimer(function(player) 
            if getElementType(player) == "player" then 
                setElementInterior(player,10,241.71826, 111.70108, 1003.21875)
            end
        end,1000,1,player)          
    end
end
           
local markertpMundo = createMarker(246.27213, 107.30126, 1003.21875+0.5,"arrow",1,255,0,0,255)
setElementInterior(markertpMundo,10,246.27213, 107.30126, 1003.21875)

function sairage(player)
    if getElementType(player) == "player" and  isPedInVehicle(player) then
        for a,b in ipairs(markerentrarinterioragencia["textos"]) do 
            outputChatBox(markerentrarinterioragencia["textos"][1][1],player,255,255,255,true)
            break
        end
    else
        
       if playerzone == "Los Santos" then----------------------AQUI ERA PRA MIM PEGAR A INFO DA TABELA E VERIFICAR SE É A MESMA E DAR TP NO LOCAL
            setElementInterior(player,0,1144.04639, -1754.88684, 13.62022)
       end
       
    end
end
addEventHandler("onMarkerHit",markertpMundo,sairage)

Olá, meu primeiro post aqui, venho aprendendo lua, só que estou com um conflito de não saber para onde prosseguir, estou tentando pegar a cidade de onde o jogador esta quando hita no marker e salvo ela dentro de uma tabela, só que não estou sabendo retirar a informação da tabela e verificar se é a mesma para dar teleporte para o local determinado quando sai da agencia alguem consegue me ajudar? para eu aprender fico muito grato

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...