DiEeR Posted September 28, 2018 Posted September 28, 2018 Greetings. I need to prevent player from automatically turning on vehicle engine on enter. I saw another thread with similar issue and tried suggested solution: Цитата It's not a bug since it's expected GTA V behavior. However you can prevent player from starting the engine by using vehicle.setUndriveable clientside. Seems like vehicle.setUndriveable does nothing. I tried setting it on events like playerStartEnterVehicle, playerEnterVehicle and even on playerSpawn for every vehicle but player still turns the engine on. Also I've found out that if player uses command /en (toggles engine state for occupied vehicle on server side) and leaves vehicle with engine off, next time he enters that vehicle he (the player) will play the animation of switching engine but the engine will stay turned off. Any ideas on how to solve this issue? Thanks.
DiEeR Posted September 29, 2018 Author Posted September 29, 2018 Guys on discord helped me to find out the solution. To solve the issue you need to add this code to clientside: mp.events.add({ 'playerEnterVehicle': (vehicle, seat) => { if (mp.players.local.getSeatIsTryingToEnter() !== -1 || vehicle.getIsEngineRunning()) { return; } vehicle.setEngineOn(false, true, true); } }); Hope this helps! 2
hubba Posted September 29, 2018 Posted September 29, 2018 7 hours ago, DiEeR said: Guys on discord helped me to find out the solution. To solve the issue you need to add this code to clientside: mp.events.add({ 'playerEnterVehicle': (vehicle, seat) => { if (mp.players.local.getSeatIsTryingToEnter() !== -1 || vehicle.getIsEngineRunning()) { return; } vehicle.setEngineOn(false, true, true); } }); Hope this helps! awsome men,, enjoy)
John_Miller Posted October 13, 2018 Posted October 13, 2018 В 29.09.2018 в 18:30, DiEeR сказал: Guys on discord helped me to find out the solution. To solve the issue you need to add this code to clientside: mp.events.add({ 'playerEnterVehicle': (vehicle, seat) => { if (mp.players.local.getSeatIsTryingToEnter() !== -1 || vehicle.getIsEngineRunning()) { return; } vehicle.setEngineOn(false, true, true); } }); Hope this helps! how about getting out of the car so that the engine doesn't turn off? maybe there is a general command that turns off engine control
DiEeR Posted October 13, 2018 Author Posted October 13, 2018 1 час назад, John_Miller сказал: how about getting out of the car so that the engine doesn't turn off? maybe there is a general command that turns off engine control mp.events.add({ 'playerStartExitVehicle': (player) => { if (player.vehicle.engine) player.vehicle.engine = true; } }); 2
wherearedocs4 Posted July 8, 2020 Posted July 8, 2020 Methods above do not work at 1.1 version. If came here like me, try this method to write normal engine system: mp.events.add("playerEnterVehicle", (vehicle, seat) => { mp.game.vehicle.defaultEngineBehaviour = false; // stop starts engine when player press 'W' or enter vehicle(because we using it in event) mp.players.local.setConfigFlag(429, true); // stop problems with animations }); 4
Spliddorama Posted December 16, 2022 Posted December 16, 2022 Hey Community, the engines no longer switch off for me - as desired - when a player leaves a vehicle. However, as soon as I move too far away from the vehicle (which is still switched on) and approach it again, it looks as if the engine is switched off. Even if you sit in the vehicle, it cannot be moved. However, to switch it on, I have to switch the motor twice, since it is still switched on - as desired.How can I ensure that the vehicles (after a player has moved away and approached again) are still optically switched on (lamps, engine, etc. on) Thank you dear
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