altmp / altv-issues

Issues and roadmap for alt:V project
93 stars 16 forks source link

Engine does not stay on when leaving the helicopter and plane #991

Open b2soft opened 3 years ago

b2soft commented 3 years ago

Client/server version Build 4.0-rc1, branch rc

Current behavior I set ManualEngineControl = true server-side, then I set ped flags client-side when player enter vehicle:

native.setPedConfigFlag(alt.Player.local, 429, true); // prevent engine enabling on entering veh
native.setPedConfigFlag(alt.Player.local, 184, true); // PED_FLAG_DISABLE_SHUFFLING_TO_DRIVER_SEAT 
native.setPedConfigFlag(alt.Player.local, 241, true); // Prevent engine shut down on leaving veh
native.setPedConfigFlag(alt.Player.local, 32, true); // Force reset seatbelt state (false = NOT fly through window)
native.setPedConfigFlag(alt.Player.local, 35, false); // Disable using helmets

For cars it works as intended: enter a vehicle, engine is shut off. Manually start the engine. leave the vehicle. The engine stays on.

But it's not true for helicopters and planes.

For helicopters, leaving the vehicle shuts off the engine automatically regardless of flags used. For planes with propellers (like dodo etc) behavior is the same as for helicopters - engine shuts off when player leaving the plane. Foir jet-engine planes (hydra, lazer) here is a native which keeps jet engine to work even after leaving jet plane: setVehicleJetEngineOn

I made some tests with setHeliBladesFullSpeed, setHeliBladesSpeed, setting ped flags by timer (100ms) and I had no success.

Seems, that here is some "third" type of engine (first is default like car/bike, second is jet for jets), which is used for prop planes and helicopters. Probably this native has to be reversed. Also, to note, plane engines (both jet and prop) can stall when pressing "S" key (throttle down) in-air. Don't know is it syncronized for server-side (will EngineOn == false when plane engine stalls)

It's known that:

  1. When starting helicopter's engine Battery Amps goes up, XMSN Oil Temperature (XMSN = transmission) goes up, XMSN Oil Pressure PSI goes to center, Dashboard backlit enables (even in daytime with headlights off)
    1. When shutting down helicopter's engine Battery Amps goes down instantly, XMSN Oil Temperature goes down, XMSN Oil Pressure PSI goes up, Dashboard backlit disables.

Enabled state Disabled state

Here is the video: YouTube

You can see engine state (native getter) on the bottom of the screen (most-left green-red engine icon). At 0:33 you can see than engine is shut off when animation of leaving is almost finished, but to note, native.taskLeaveVehicle(alt.Player.local, alt.Player.local.vehicle, 16); teleports player, but engine still shuts off.

Expected behavior Server vehicle EngineOn, ManualEngineControl property + ped flags work for planes, jet-planes, helicopters the same way as for cars: when player leaves a vehicle with engine on, engine has to stay enabled.

Steps to reproduce

  1. Spawn a helicopter/prop plane/jet plane vehicle
  2. Set ManualEngineControl = true
  3. Add ped flags 429 and 241
  4. Enter a vehicle
  5. Set EngineOn = true (or enable engine using a native)
  6. Leave the vehicle
  7. Vehicle engine shuts off.

Context (environment) I want to manually start and shut off vehicle engines. Sure, it's not the case for bikes, but I want to keep helicopter/plane engine on even if player leaves this vehicle.

Possible solution For Jet engines - native setVehicleJetEngineOn For planes/heli - no solution ideas for now

mrgharabaghi commented 3 years ago

This isn't related to alt:V, it's all about the RAGE. Two years ago after many trials and errors I couldn't keep the helicopter's engine on.

b2soft commented 3 years ago

This isn't related to alt:V, it's all about the RAGE. Two years ago after many trials and errors I couldn't keep the helicopter's engine on.

How RAGE is connected to alt:V? Seems it is possible, but we have to reverse more natives.

ZackaryH8 commented 3 years ago

How RAGE is connected to alt:V? Seems it is possible, but we have to reverse more natives.

RAGE is the engine upon which GTA:V is built

FabianTerhorst commented 3 years ago

Rage = Rockstar advanced game engine.

yannbcf commented 2 years ago

This is not a bug but a GTA V mechanism. To prevent it an invisible ped is spawned in the game scripts. It's probably possible to patch this behavior and expose it via a flag

b2soft commented 2 years ago

This is not a bug but a GTA V mechanism. To prevent it an invisible ped is spawned in the game scripts. It's probably possible to patch this behavior and expose it via a flag

So, it's a bug in GTA mechanism. Shitty solution to place an invisible ped looks like fast-and-dirty solution and not like an actual fix.

yannbcf commented 2 years ago

What I meant is that it's not an alt:V bug and if we patch it it's a feature. Also, placing an invisible ped in the heli is literally how r* do it in their game scripts, dirty or not it works, and if we patch it it won't be the chosen solution.

b2soft commented 2 years ago

Ok, understood.

yannbcf commented 2 years ago

You can let the issue open, I marked it as a feature request and if someone else search for it in the future it's better