Jump to content

Como faço para quando deslogar o carro sumir tbm


Recommended Posts

fiz um painel de gang mas quando vc desloga e deixa o carro spawnado ele nao some 

como faço para quando a pessoa deslogar o carro sumir automaticamente?

veh = {}
function criarxx()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(467, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop",true)
addEventHandler("carrop",root,criarxx)

---------------------------------------------------------------------------------------


function criarxx2()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(502, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop2",true)
addEventHandler("carrop2",root,criarxx2)

No caso seria esse parte do código do painel

Link to comment
13 hours ago, Dadinho said:

fiz um painel de gang mas quando vc desloga e deixa o carro spawnado ele nao some 

como faço para quando a pessoa deslogar o carro sumir automaticamente?

veh = {}
function criarxx()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(467, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop",true)
addEventHandler("carrop",root,criarxx)

---------------------------------------------------------------------------------------


function criarxx2()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(502, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop2",true)
addEventHandler("carrop2",root,criarxx2)

No caso seria esse parte do código do painel

veh = {}
function criarxx()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(467, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop",true)
addEventHandler("carrop",root,criarxx)

---------------------------------------------------------------------------------------


function criarxx2()
    if veh[source] and isElement( veh[source] ) then destroyElement( veh[source] ) 
 veh[source] = nil 
 end
    local x,y,z = getElementPosition(source)
    veh[source] = createVehicle(502, x,y,z + 2)
 warpPedIntoVehicle (source,veh[source])
end
addEvent("carrop2",true)
addEventHandler("carrop2",root,criarxx2)

addEventHandler("onPlayerQuit", getRootElement(), -- evento acionado quando qualquer player do servidor sair.
function ()
    if veh[source] then -- verifica se existe veh[source]
      if isElement(veh[source]) then  -- verificar se veh[source] é um elemento
        destroyElement(veh[source]) -- destroi veh[source]
      end 
    end 
  end

Isso?

Edited by Blaack
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...