Hi guys, I'm trying to make the car engine still be started after I left the car.
But when I leave it the engine starts and turns off after a few sec.
My code for example
hook.Add("PlayerLeaveVehicle", "EngineIsTurnedOn", function(ply, veh)
veh:Fire("TurnOn")
veh:EnableEngine( true )
veh:StartEngine( true )
end)
Maybe it's been overridden by another hook, have you checked?
"After a few sec."
Try this, and if the engine turns on here a hacky fix.
hook.Add( "PlayerLeaveVehicle", "EngineIsTurnedOn", function( ply, veh )
timer.Simple( 5, function()
veh:Fire("TurnOn")
veh:EnableEngine( true )
veh:StartEngine( true )
end )
end )
(Also just like Cee said it might be overridden by another hook calling this function)
So try this (a real fix)
for k, v in pairs( hook.GetTable()[ "PlayerLeaveVehicle" ] ) do
hook.Remove( "PlayerLeaveVehicle", k )
end
hook.Add( "PlayerLeaveVehicle", "EngineIsTurnedOn", function( ply, veh )
veh:Fire("TurnOn")
veh:EnableEngine( true )
veh:StartEngine( true )
end )
P.S. The second fix will most likely should smack any car addon, beware.
Thanks you guys, you really helped me. Big thanks and respect ;)
A thread with 7 coins as a reward.
@
You helped
@
Big thanks and respect ;)
Sorry, you need to Log In to post a reply to this thread.