Jump to content

[Help] Auto Destroy Vehicle


raynner

Recommended Posts

hello friends again come to enlist the help of you good I created a simple script to auto destroir servants vehicles trough a panel however came across the lack of a emportante party and to cancel this event when the player returns to the vehicle porediriam you help me or correct ?

function destroyVehicle(vehicle) 
    local check=false 
    for i,player in ipairs(getElementsByType("player")) do 
        if getPlayerOccupiedVehicle(player)==vehicle then 
            check=true 
        end 
    end 
    if check==false then 
        destroyElement(vehicle[source]) 
    end 
end 
  
function exitVehicle(vehicle) 
    if isElement(vehicle[source]) then 
       setTimer(destroyElement(vehicle[source]),30000,1,vehicle) 
    end 
end 
addEventHandler("onPlayerVehicleExit",getRootElement(),exitVehicle) 

Link to comment
hello friends again come to enlist the help of you good I created a simple script to auto destroir servants vehicles trough a panel however came across the lack of a emportante party and to cancel this event when the player returns to the vehicle porediriam you help me or correct ?
function destroyVehicle(vehicle) 
    local check=false 
    for i,player in ipairs(getElementsByType("player")) do 
        if getPlayerOccupiedVehicle(player)==vehicle then 
            check=true 
        end 
    end 
    if check==false then 
        destroyElement(vehicle[source]) 
    end 
end 
  
function exitVehicle(vehicle) 
    if isElement(vehicle[source]) then 
       setTimer(destroyElement(vehicle[source]),30000,1,vehicle) 
    end 
end 
addEventHandler("onPlayerVehicleExit",getRootElement(),exitVehicle) 

I am sorry to say, most of your script doesn't make sense, watch what other people do and you will know how to script

Link to comment
  • 2 weeks later...
hello friends again come to enlist the help of you good I created a simple script to auto destroir servants vehicles trough a panel however came across the lack of a emportante party and to cancel this event when the player returns to the vehicle porediriam you help me or correct ?
function destroyVehicle(vehicle) 
    local check=false 
    for i,player in ipairs(getElementsByType("player")) do 
        if getPlayerOccupiedVehicle(player)==vehicle then 
            check=true 
        end 
    end 
    if check==false then 
        destroyElement(vehicle[source]) 
    end 
end 
  
function exitVehicle(vehicle) 
    if isElement(vehicle[source]) then 
       setTimer(destroyElement(vehicle[source]),30000,1,vehicle) 
    end 
end 
addEventHandler("onPlayerVehicleExit",getRootElement(),exitVehicle) 

I am sorry to say, most of your script doesn't make sense, watch what other people do and you will know how to script

Oks, thank you

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