Only Pilots/Crewman can drive


One way of doing this would be:

Code:
_vehicleType = _this select 0;  // "Helicopter" / "Tank"
_crewType = _this select 1;  // "US_Soldier_Pilot_EP1"

//hint format["%1 - %2",_crewType, _vehicleType];
  if (typeof player != _crewType) then {
    private "_v";
    while {alive player} do {
      waituntil {vehicle player != player};
      _v = vehicle player;
      if (_v iskindof _vehicleType && !(_v iskindof "ParachuteBase")) then {
        if (driver _v == player) then {
          player action ["eject",_v];
          waituntil {vehicle player == player};
          hint "We shall leave the piloting to those with the appropriate training.";
        };
      };
    };
  };

Then call that from init.sqf as:

Code:
["Helicopter", "US_Soldier_Pilot_EP1"] execVM "pilotCheck.sqf";
["Tank", "US_Soldier_Crew_EP1"] execVM "pilotCheck.sqf";
  1. #1 by williejones on October 9, 2010 - 7:47 AM

    if you were to convert this so that a player could also not command/gun, what would the code be instead of “driver”

Comments are closed.