Jump to content

evento quando player rouba um veiculo


Recommended Posts

Posted

existe algum evento pra quando um player entra de piloto em um veiculo, mas ja tem alguem no piloto ou seja um evento pra quando ele rouba o carro de outra pessoa?
se nao tiver, como eu poderia criar um evento assim?

Posted
1 hour ago, SableLightning78 said:

Não, mas possuí o evento OnVehicleEnter que você pode verificar o acento do motorista e retirar o motorista se tiver alguém la!

 

Nesse proprio evento onVehicleEnter, no terceiro parâmetro da função tu consegue verificar se ele esta retirando alguém do assento.

 

addEventHandler ( "onVehicleEnter", getRootElement(),
function ( thePlayer, seat, jacked )
    if seat == 0 and jacked and isElement(jacked) and getElementType(jacked) == "player" then -- verificamos se o assento é 0 (p1), se existe algum player que foi ejetado, se existir verificamos se é um elemento, em seguida se é um player.
        -- use thePlayer para assaltante
		-- jacked para quem foi retirado
      	-- source para veiculo.
    end
end)

 

  • Thanks 1
Posted
On 10/02/2023 at 13:59, Blaack said:

Nesse proprio evento onVehicleEnter, no terceiro parâmetro da função tu consegue verificar se ele esta retirando alguém do assento.

 

addEventHandler ( "onVehicleEnter", getRootElement(),
function ( thePlayer, seat, jacked )
    if seat == 0 and jacked and isElement(jacked) and getElementType(jacked) == "player" then -- verificamos se o assento é 0 (p1), se existe algum player que foi ejetado, se existir verificamos se é um elemento, em seguida se é um player.
        -- use thePlayer para assaltante
		-- jacked para quem foi retirado
      	-- source para veiculo.
    end
end)

 

pra que serve esse "isElement"? alias muito obrigado

Posted
1 hour ago, SciptNovato said:

pra que serve esse "isElement"? alias muito obrigado

Verifica se aquele argumento “jacked” é um elemento.

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