Jump to content
Lorenz94

GetIn EH not firing

Recommended Posts

Hello,

I have a spawn script that execs the below code to check if a player is of a certain class or not, to decide if to eject him from the vehicle.

 

While the exact same code works with planes (even with a UID check), with helicopters I get the hinSilent at the end of the code, so the EH "fires", but the player is not ejected from the helicopter.

 

Can you please help me understand why?

Spoiler

params ["_heli"];

_heli addEventHandler ["GetIn", {
        params ["_vehicle", "_position", "_unit"];


        if (_unit == driver _vehicle) then {
            if (typeOf _unit != "B_Helipilot_F") then {
                _unit action ["eject", _vehicle];
                hintSilent "You are not a pilot.";
            };
        };
    }
];

 

Thank you.

Share this post


Link to post
Share on other sites

Is this in multiplayer, on a server?

I suspect locality might be the problem here. The helicopter is local to the server when it's empty and your script runs on the server too, so all is good.

But when a player gets into the aircraft, it becomes local to the player. Your script and your helicopter are no longer on the same computer.

You need to removeexec action and the hint.

Share this post


Link to post
Share on other sites

Some helicopter pilot and co-pilot slots don't have eject capabilities.

 

Instead of using:

_unit action ["eject",_vehicle];

Use something that checks whether you're being booted from a heli:

if (_vehicle isKindOf "helicopter") then {moveOut _unit;} else {_unit action ["eject",_vehicle];};

It's also possible to check whether the pilot is able to eject using the config (beware, jets DLC ejection seats count as not able to eject here):

getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "driverCanEject") == 0;

 

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, Sgt. Dennenboom said:

Some helicopter pilot and co-pilot slots don't have eject capabilities.

 

Instead of using:


_unit action ["eject",_vehicle];

Use something that checks whether you're being booted from a heli:


if (_vehicle isKindOf "helicopter") then {moveOut _unit;} else {_unit action ["eject",_vehicle];};

It's also possible to check whether the pilot is able to eject using the config (beware, jets DLC ejection seats count as not able to eject here):


getNumber (configFile >> "CfgVehicles" >> typeOf _vehicle >> "driverCanEject") == 0;

 

Thank you, using moveOut instead of eject solved my problem.

 

I switched to the same system even in the plane spawn script just to be sure in future.

 

Thank you!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×