jakeplissken 77 Posted December 15, 2022 I am working on this event handler to block non-pilots from helis, but this will block players from getting in the passenger spot, and it blocks the scroll menu options when using a drone. inGameUISetEventHandler ["Action", " if (((toUpper typeOf player find toUpper 'Pilot') < 2) && (_this # 0 iskindof 'helicopter') || (_this # 0 iskindof 'plane') && (_this select 3) in ['GetInDriver','GetInPilot','GetInGunner','GetInCommander','GetInCargo']) then { true } else {false}; "]; Am I missing something simple? Player can still get in a ground vehicle, but not helis. Share this post Link to post Share on other sites
Larrow 2794 Posted December 15, 2022 12 hours ago, jakeplissken said: Am I missing something simple? Yes, GetInMan and SeatSwitchedMan eventhandlers. Share this post Link to post Share on other sites
jakeplissken 77 Posted December 19, 2022 Here is a good solution though, this will block all non-pilots from Pilot and Copilot seats. player addEventhandler ["GetInMan", { params ["_unit", "", "_vehicle"]; if (_vehicle isKindOf "Air" && { !(_vehicle isKindOf "ParachuteBase") && { !((vehicle _unit getCargoIndex _unit)>=0) && { !((toUpper typeOf _unit find toUpper "Pilot") > -1)} } }) then { _unit moveOut _vehicle; }; }]; player addEventhandler ["SeatSwitchedMan", { params ["_unit", "", "_vehicle"]; if (_vehicle isKindOf "Air" && { !(_vehicle isKindOf "ParachuteBase") && { !((vehicle _unit getCargoIndex _unit)>=0) && { !((toUpper typeOf _unit find toUpper "Pilot") > -1)} } }) then { _unit moveOut _vehicle; }; }]; Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted December 24, 2022 I like to do it in the UI event, is more graceful to prevent access than to allow access then eject. focus on the inGameUISetEventHandler also, since "pilot" is constant, replace //replace toUpper "Pilot" //with "PILOT" 1 Share this post Link to post Share on other sites
_foley 192 Posted December 24, 2022 UI event is neat but you still need a fallback because action menu is not the only way to enter a heli. Heres some more edge cases to consider. Filtering by "Pilot" in the classname excludes Helicopter Crew units, which you may or may not want depending on your mission. Co-pilot seats are tricky too. Depending on the scenario, you might want to allow them until someone attempts to actually take controls. 1 Share this post Link to post Share on other sites
jakeplissken 77 Posted December 26, 2022 (edited) I have found another way, this blocks the pilot seat in Ghosthawk but allows the CoPilot seat, and blocks the "Take Controls" action. But it also stops ground vehicles. How can I restrict it to air vehicles? inGameUISetEventHandler ["Action", " if (!((_this select 0) getVariable ['disableGetIn',false]) && (_this select 3) in ['GetInDriver','GetInPilot','GetInGunner','GetInCommander','TakeVehicleControl','UnlockVehicleControl']) then { true } "]; It does allow the use of the Miniguns in the helicopter though. So nearly there. This is a finished version. I did not realize that _this select 0 was the vehicle. inGameUISetEventHandler ["Action", " if (!((_this select 0) getVariable ['disableGetIn',false]) && ((_this select 0) isKindOf 'Air') && (_this select 3) in ['GetInDriver','GetInPilot','GetInGunner','GetInCommander','TakeVehicleControl','UnlockVehicleControl']) then { true } "]; This works just fine. You can get in ground vehicles and not helis as a non-pilot. Now it is finished. Edited December 28, 2022 by jakeplissken Added finished script. 2 Share this post Link to post Share on other sites
Lucas Andre (Lunga Gamer) 3 Posted January 31, 2023 I need this script, but I don't know where to put it. The script that is placed in the vehicle, works in parts, the pilot is blocked, but the co-pilot can enter. Share this post Link to post Share on other sites
jakeplissken 77 Posted February 6, 2023 Put it in initPlayerLocal.sqf. Then it will work for all players. Share this post Link to post Share on other sites
Lucas Andre (Lunga Gamer) 3 Posted February 6, 2023 9 hours ago, jakeplissken said: Put it in initPlayerLocal.sqf. Then it will work for all players. Thanks for the feedback Share this post Link to post Share on other sites