Blitzer134 1 Posted July 17, 2013 what is the best way to loop this script chopper1 addEventHandler ["GetIn", { _vehicle = _this select 0; _seat = _this select 1; _unit = _this select 2; _pilotSeats = [ "driver", "gunner" ]; if( ( _seat in _pilotSeats ) ) then { if( !( _unit getVariable [ "PilotCanFly", false ] ) ) then { _unit action [ "eject", _vehicle ]; }; }; } ]; chopper2 addEventHandler ["GetIn", { _vehicle = _this select 0; _seat = _this select 1; _unit = _this select 2; _pilotSeats = [ "driver", "gunner" ]; if( ( _seat in _pilotSeats ) ) then { if( !( _unit getVariable [ "PilotCanFly", false ] ) ) then { _unit action [ "eject", _vehicle ]; }; }; } ]; Share this post Link to post Share on other sites
kylania 567 Posted July 17, 2013 Searching would be the best way. There's been dozens of posts about this very issue already, some pretty recent. Share this post Link to post Share on other sites
Blitzer134 1 Posted July 17, 2013 do you have a link by any chance having trouble finding some thanks Share this post Link to post Share on other sites
kahna 13 Posted July 17, 2013 For more than just pilots, SaMatra did awesome work! Set the forbidden seats, vehicles and operators/crew to your liking. Remove the other restrictions if undesired. crewCheck.sqf //Script by Sa-Matra true spawn { //List of pilot classes, crewman classes, affected aircraft classes and affected vehicle classes [b] _pilots = ["B_Helipilot_F"]; _crewmen = ["B_crew_F"]; _diver = ["B_diver_F"]; _aircraft = ["B_Heli_Transport_01_F","B_Heli_Attack_01_F","I_Heli_Transport_02_F","O_Heli_Attack_02_black_F"]; _armor = ["B_APC_Wheeled_01_cannon_F"]; _sub = ["B_SDV_01_F"];[/b] //Wait until player is fully loaded waitUntil {player == player}; //Check if player is pilot or crewman, you can add more classes into arrays iampilot = (typeOf player) in _pilots; iamcrewman = (typeOf player) in _crewmen; iamdiver = (typeOf player) in _diver; //Never ending cycle while{true} do { //Wait until player's vehicle changed _oldvehicle = vehicle player; waitUntil {vehicle player != _oldvehicle}; //If player is inside vehicle and not on foot if(vehicle player != player) then { _veh = vehicle player; //Check if vehicle is aircraft and player is not pilot if((typeOf _veh) in _aircraft && !iampilot) then { //Forbidden seats: copilot, gunner, pilot [b]_forbidden = [_veh turretUnit [0]] + [gunner _veh] + [driver _veh];[/b] if(player in _forbidden) then { systemChat "You are not authorized to operate this aircraft!"; player action ["eject", _veh]; }; }; //Check if vehicle is armor and player is not crewman if((typeOf _veh) in _armor && !iamcrewman) then { //Forbidden seats: gunner, driver [b] _forbidden = [driver _veh] + [gunner _veh];[/b] if(player in _forbidden) then { systemChat "You are not authorized to operate this vehicle!"; player action ["eject", _veh]; }; }; //Check if vehicle is armor and player is not crewman if((typeOf _veh) in _sub && !iamdiver) then { //Forbidden seats: gunner, driver [b] _forbidden = [_veh turretUnit [0]] + [gunner _veh] + [driver _veh];[/b] if(player in _forbidden) then { systemChat "You are not authorized to operate this submersible!"; player action ["eject", _veh]; }; }; }; }; }; ////////// Share this post Link to post Share on other sites
Blitzer134 1 Posted July 17, 2013 thanks a lot Kahna will check this out Share this post Link to post Share on other sites
bl2ck dog 80 Posted August 7, 2013 (edited) Posted few simple scripts that might help with the pilot checks. http://forums.bistudio.com/showthread.php?160981-B2-Scripts-%28Interactive-Whiteboard-Check-Pilot-Gunner-Keep-Gunner%29 Edited August 7, 2013 by Bl2ck Dog Share this post Link to post Share on other sites