Jump to content

[SOLVED] onPlayerQuit help


Recommended Posts

Hey guys I am making a function that will shut a vehicles engine off when the player leaves the server. This i not working at the moment. Any help would be appreciated.

  
function engineOffLeave() 
    if (getPedOccupiedVehicle(source) == true) then 
        local vehicle = getPedOccupiedVehicle(source) 
        if (getVehicleEngineState(source) == true) then 
            setVehicleEngineState(source, false) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, engineOffLeave) 
  

Thanks guys.

Edited by Guest
Link to comment
function engineOffLeave() 
    local vehicle = getPedOccupiedVehicle(source) 
    if ( vehicle ) then 
        if ( getVehicleEngineState(vehicle) ) then 
            setVehicleEngineState(vehicle, false) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, engineOffLeave) 

Link to comment
function engineOffLeave() 
    local vehicle = getPedOccupiedVehicle(source) 
    if ( vehicle ) then 
        if ( getVehicleEngineState(vehicle) ) then 
            setVehicleEngineState(vehicle, false) 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, engineOffLeave) 

Thanks for the quick reply but I tried it and it doesn't seem to work. The vehicle stay on when I disconnect and reconnect.

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