Jump to content
Sign in to follow this  
Diabolical1001

Define Unit by Clothing

Recommended Posts

What do you mean? As far as performance, eventhandlers are the way to go. If you can use eventhandlers then it's a good idea to use them. Since they are only triggers off of events, you can call a quick function and be done with it. Where as a loop is constantly running. In that quote, i was just saying you don't need to do a 'tank" check for the EH method. Obviously the Eh that fires that specific function, would ONLY be assinged to tank types in the first place.

I forgot, tanks have cargo space too.

Thus, you would actually need to waitUntil the unit is in one of the driver/turret seats. So a unit who's not supposed to operate the vehicle can't get in through the cargo an move to the driver/turret seats.

this addEventHandler ["getIn", {[(_this select 2)] spawn TAG_fnc_armorEject}]; // assigned to tank (armor) types only

TAG_fnc_armorEject = {

   _unit = _this select 0;

   waitUntil {driver vehicle _unit == _unit || {vehicle _unit == _unit} || {_unit in [vehicle _unit turretUnit [0]]} || {_unit in [vehicle _unit turretUnit [0,0]]} || {!alive _unit}}; 
       if (vehicle _unit != _unit && {headGear _unit != "H_HelmetCrew_B" || {uniform _unit != "U_B_CombatUniform_mcam_vest"}}) then { 
           [{hint "You are not certified to operate this vehicle"}, "BIS_fnc_spawn", _unit, false] spawn BIS_fnc_MP;
           _unit action ["eject", vehicle _unit];
    };

};  

---------- Post added at 17:49 ---------- Previous post was at 16:38 ----------

Okay, I've compiled both the helo and tank restrictions functions into one file. Did a few tweaks aswell. Currently, both side turrets on the ghosthawk (or any helo with those types of turrets) are restricted aswell. Wasn't sure if you wanted normal infantry to be able to operate those or not, so i restricted them. You can do away with the turret [1] and turret [2] checks if you want to free them up for universal use. Here's an example mission containing it all. Good luck with your mission, in any case.

Edited by Iceman77

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
Sign in to follow this  

×