Jump to content

no car respawn


zombienation

Recommended Posts

I don't want to sound rude, but the client side could be done with just some lines using a table instead of adding manually each vehicle.

--vehicle spawning 
vehicles = {} 
  
function spawnv ( id ) 
    if getElementDimension (source) == 10 then 
        outputChatBox ( "You can't use vehicle here", source, 255, 0, 0 ) 
    else  
    if vehicles[source] and isElement(vehicles[source]) then 
        destroyElement(vehicles[source]) 
    end 
    local x, y, z = getElementPosition ( source ) 
    local xr, yr, zr = getElementRotation ( source ) 
    vehicles[source] = createVehicle ( id, x, y, z + 0.5, xr, yr, zr ) 
    warpPedIntoVehicle(source, vehicles[source]) 
    addEventHandler("onVehicleExplode",vehicles[source],function () destroyElement(source) end) 
    end 
end 
addEvent ( "spawn", true ) 
addEventHandler ( "spawn", root, spawnv ) 
  
function destroyveh () 
    if vehicles[source] and isElement(vehicles[source]) then 
        destroyElement(vehicles[source]) 
    else  
        outputChatBox( "There is no old car.", source ) 
    end 
end 
addEvent ( "destroy", true ) 
addEventHandler ( "destroy", root, destroyveh ) 

It should destroy the vehicle just after explode.

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