Jump to content
Sign in to follow this  
policemania05

Locking a helicopter script help

Recommended Posts

I got this script, for use in Dommination however it dosent seem to work.


_vehicle = _this select 0;  // i added this line.

_vehicle addEventHandler ["GetIn", 
{
private ["_veh", "_pos", "_unit", "_namesArray"];
_veh = _this select 0;
_pos = _this select 1;
_unit = _this select 2;
_namesArray = ["6658950", "1676801", "1657145", "2540806", "2244097", "5327622", "2569926", "4317190", "713345", "5491846"];

// added check to make sure it does not affect any AI, only players. but AI in any playable unit will be kicked as well.
if (!(getPlayerUID _unit) in _namesArray AND _unit in playableUnits) then
{
_unit action ["Eject", vehicle _unit];
};
}];  



////////////////////////////////////
//

I trigger it with this in a trigger.

Condition true

timeout 10 10 10

repeating

{      if ((_x iskindOf "Helicopter" OR _x isKindOf "Plane") AND _x getVariable ["locked", true]) then {          _x setVariable ["locked", 123];          _null = [_x] execVM "vehiclelock.sqf";      };  } foreach allUnits;  

Share this post


Link to post
Share on other sites

Well this looks pretty messed up :eek:

This should work:

[] spawn {
if (!isDedicated) then {
	_namesArray = ["6658950", "1676801", "1657145", "2540806", "2244097", "5327622", "2569926", "4317190", "713345", "5491846"];
	if (!((getPlayerUID _unit) in _namesArray)) then {
		while {true} do {
			waitUntil {((vehicle player) iskindOf "Helicopter") OR ((vehicle player) isKindOf "Plane")};
			_Vehicle = (vehicle player);
			player action ["Eject", (vehicle player)];
			sleep 1;
			_Vehicle engineOn false;
		};
	};
};
};

Just add that to your init.sqf

The trigger is not needed anymore.

I also added engineOn false ... cause sometimes people hop into a jet, turn the engine on before they get ejected. Then you have a loud jet standing around in your base. :D

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  

×