Jump to content

Verificar ID do veiculo que o jogador esta dentro


Recommended Posts

Estou tentando verificar se o veiculo que o jogador esta no momento que pisar no marker, é o Andromada ou o AT-400, mas não esta dando certo, esta ai meu código:

 

  Reveal hidden contents

 

Link to comment
  • Other Languages Moderators

Olá.

Não se usa source como parâmetro de função. Além do mais, o source do evento é o marker. Use player naquele primeiro parâmetro e substitua todos esses source por player.

  • Thanks 1
Link to comment

Ficou assim:

  Reveal hidden contents

e agora não acontece nada quando piso no marker

Link to comment
  • Other Languages Moderators

Ainda há alguns source. Inclusive, a função setTimer precisa ter os parâmetros definidos, senão o funcionamento será afetado. Deixe assim:

  Reveal hidden contents

 

  • Thanks 1
Link to comment
  On 16/03/2021 at 22:56, andr0xy said:

Ainda há alguns source. Inclusive, a função setTimer precisa ter os parâmetros definidos, senão o funcionamento será afetado. Deixe assim:

  Reveal hidden contents

 

Expand  

 

Link to comment
  • Other Languages Moderators
veh[player]

-- O índice é o player.

Então, digamos que você tenha uma função ou evento desta forma:

addCommandHandler("nada", function(CarlosAlbertoDeNobrega)
    if veh[CarlosAlbertoDeNobrega] then

    end
end)

addCommandHandler("tudo", function(user)
    if veh[user] then

    end
end)

addEventHandler("onMarkerHit", marker, function(AnaMariaBraga)
    if veh[AnaMariaBraga] then

    end
end)

Em todos daria certo, pois cada parâmetro daquele recebe o jogador, e você indexou o jogador desde o começo. O nome não importa, e sim o elemento passado.

  • Thanks 1
Link to comment
  On 16/03/2021 at 23:17, andr0xy said:
veh[player]

-- O índice é o player.

Então, digamos que você tenha uma função ou evento desta forma:

addCommandHandler("nada", function(CarlosAlbertoDeNobrega)
    if veh[CarlosAlbertoDeNobrega] then

    end
end)

addCommandHandler("tudo", function(user)
    if veh[user] then

    end
end)

addEventHandler("onMarkerHit", marker, function(AnaMariaBraga)
    if veh[AnaMariaBraga] then

    end
end)

Em todos daria certo, pois cada parâmetro daquele recebe o jogador, e você indexou o jogador desde o começo. O nome não importa, e sim o elemento passado.

Expand  

Mudei ele para 'veh[player]' e todos os source para player, o mod voltou a funcionar, mas o problema continua, ainda n verefica se esta com o andromada ou AT-400 e da o msm warning

Link to comment
  On 17/03/2021 at 12:00, andr0xy said:

Mande o código como está. Eu não vejo erros da forma que deixei o código.

Expand  
  Reveal hidden contents

 

Link to comment
function finalizartrab (player, dimension) -- <-- NÃO EXISTE O PARAMETRO THE VEHICLE NO ONMARKERHIT, AQUI SERIA DIMENSÃO
	if getElementData(player,"trabAviaoParte3") then
		if veh[player] and isElement(veh[player]) then
			local vehicle = getPedOccupiedVehicle(player) -- NÃO PRECISA COLOCAR VARIAS VARIAVEIS DE VEICULO PQ 1 JÁ BASTA
            if vehicle then
				local currentFreezeStatus = isElementFrozen ( vehicle )
				local newFreezeStatus = not currentFreezeStatus
				setElementPosition(vehicle, 1477.443, 1712.498, 11.2 + 1.5)
				setElementRotation(vehicle, -0, 0, 359.225)
				setElementFrozen ( vehicle, true )
				outputChatBox ( "[#FF0000 Aeronauta #000000]#FFFFFF Os passageiros estao deembarcando, aguarde...", player, 0, 0, 0, true )
				setElementVisibleTo ( entraga3final, player, false )
				setElementVisibleTo ( blipentrega3, player, false )
				setElementData(player, "trabAviaoParte3", false)
				setElementData(player, "emTrabalho", false)
				setTimer (function()
					outputChatBox ( "[#FF0000 Aeronauta #000000]#FFFFFF Todos os passageiros deembarcaram. Voce terminou seu trabalho com sucesso!", sourplayerce, 0, 0, 0, true )
					outputDebugString("[TrabAviao] "..getPlayerName(player):gsub("#%x%x%x%x%x%x","").." Completou o trabalho de aviao!",3,0,255,0)
					local model = getElementModel(vehicle)
					if model == 592 or model == 577 then
						outputChatBox ( "[#FF0000 Aeronauta #000000]#FFFFFF E Recebeu mais #00FF00R$45.000#FFFFFF por entregar com o Andromada ou AT-400, totalizando #00FF00R$75.000", player, 0, 0, 0, true )
						givePlayerMoney (player, 45000)
					else
						outputChatBox ( "[#FF0000 Aeronauta #000000]#FFFFFF E Recebeu mais #00FF00R$30.000#FFFFFF, totalizando #00FF00R$60.000", player, 0, 0, 0, true )
						givePlayerMoney (player, 30000)
					end
                    destroyElement(veh[player])
                    veh[player] = nil
				end, 5000, 1)
			end
		end
	end
end
addEventHandler( "onMarkerHit", entraga3final, finalizartrab )

Você Estava Destruindo o Veiculo Dps Conferindo o Modelo Dele, Sendo que ele Não Existe Mais, Assim Causando o Erro.

Edited by LucasST
Erro Ortográfico
  • Thanks 1
Link to comment

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...