TheGamingMann Posted August 29, 2014 Share Posted August 29, 2014 (edited) 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 August 29, 2014 by Guest Link to comment
Bssol Posted August 29, 2014 Share Posted August 29, 2014 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
TheGamingMann Posted August 29, 2014 Author Share Posted August 29, 2014 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
Bssol Posted August 29, 2014 Share Posted August 29, 2014 It works fine! Make sure you put it server side, not client! Link to comment
TheGamingMann Posted August 29, 2014 Author Share Posted August 29, 2014 It works fine! Make sure you put it server side, not client! AHHH! I got it thanks. I forgot to change the argument on the event handler to root. My bad. Thanks man. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now