• Vehicle startup
    6 replies, posted
Hi again, I try to find a function in base gamemode. It's about when you get in the car and it's starts automatically also when you leave it it's turns off. I need a native function of it, not a custom.
It is not done in Lua, so you won't find it there.
Is there any other way to handle it?
Handle what exactly? You have hooks for when player enters/exists vehicles and you have functions to turn vehicles on and off.
I mean when I leave vehicle, it turns off, no hook can handle it.
Here's a crappy solution I devised for you: hook.Add( "PlayerLeaveVehicle", "PlayerLeaveVehicleTurnOn", function( ply, veh ) timer.Create( "magic timer" .. veh:EntIndex(), 0, 2, function() -- We need to wait a few frame for the vehicle to stop working if ( timer.RepsLeft( "magic timer" .. veh:EntIndex() ) > 0 ) then return end veh:StartEngine( true ) -- Start the engine back up veh:ReleaseHandbrake() -- Release the handbrake end ) end ) This is the best you can do with Lua, and unfortunately there's nothing I can think of to do with the starting sound.
All right, It helped, thank you very much ;)
Sorry, you need to Log In to post a reply to this thread.