Jump to content
RAGE Multiplayer Community

Prevent player from toggling engine state on enter


DiEeR
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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!

  • Like 2
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • 2 weeks later...
В 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

Link to comment
Share on other sites

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;
  }
});

 

  • Like 2
Link to comment
Share on other sites

  • 1 year later...

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
});

 

  • Like 4
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...