Does anyone have a script where you can do /engine on /engine off or /engine to do both
Thanks
Does anyone have a script where you can do /engine on /engine off or /engine to do both
Thanks
SetVehicleEngineOn(entity, true/fale)
would this work
ServerSide
AddEventHandler( ‘chatMessage’, function( source, n, msg ]
msg = string.lower( msg )
-- Check to see if a client typed in /dv
if ( msg == "/engine" ) then
-- Cancel the chat message event (stop the server from posting the message)
CancelEvent()
-- Trigger the client event
TriggerClientEvent( 'Engine', source )
end
Client
`-- Register a network event
RegisterNetEvent( ‘Engine’ )
AddEventHandler( ‘Engine’, function()
local ped = GetPlayerPed( -1 )
if ( IsPedSittingInAnyVehicle( ped ) ) then
local vehicle = GetVehiclePedIsIn( ped, false )
if ( GetPedInVehicleSeat( vehicle, -1 ) == ped ) then
ShowNotification( "EngineOn/Off." )
SetEntityAsMissionEntity( vehicle, true, true )
SetVehicleEngineOn(entity, true/fale)( vehicle )
else
ShowNotification( "You must be in the driver's seat!" )
end
else
ShowNotification( "You must be in a vehicle to turn the engine off/on" )
end
end
end
end )’
I was giving you an example, you obviously have to change the arrays, but in your case it would look like this
SetVehicleEngineOn(vehicle, false)
Has anyone gotten this script to work?
It works! Thank you Flatracer!
anyway to set it up to where the engine will stay on when you get out of the car?
Do any of you know how to make this script work with the new fivem update? Is that before I was great, but since the update of the new server does not work well, I explain I enter the game write / engine the car goes off and automatically the character starts.
Before it was off, you know if something needs to be changed? Thank you
did you find the solution?