Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
colinm9991

ACRE+Pilot Only

Recommended Posts

Credit to each of the original creators for this script.

I have this script setup on my server, it works locally just fine; but that's about it.

It doesn't move other players out of the pilot seat if they don't have ACRE, or are not within that pilot class.

I don't even think it runs or activates.

It's being called via init-custom.sqf as

if (isDedicated) then {
[] execVM "core\scripts\pilotCheck.sqf";
[] execVM "core\scripts\restrictedMods.sqf";
};

Script itself is

_attackVehicles = ["AH64D_EP1","BAF_Apache_AH1_D","AH64_base_EP1","AH64D"];
_isPilot = typeOf player == "BAF_Pilot_MTP","USMC_Soldier_Pilot","CZ_Soldier_Pilot_EP1","CDF_Soldier_Pilot","Pilot","Soldier_Pilot_PMC","Pilot_EP1","US_Pilot_Light_EP1","US_Soldier_Pilot_EP1";
_hasACRE = isClass(configFile>>"CfgPatches">>"acre_main");
_onTS = false;

gdsn_fnc_moveToCargo = {
_v = _this;
_msg = "You must be a pilot and connected to Teamspeak in order to fly/gun in aircraft.";

if (_v emptyPositions "cargo" > 0) then {
	player action ["MoveToCargo", _v, 0];
} else {
	player action ["Eject", _v];
};
sleep 1;
player action ["EngineOff", _v];

hint _msg;
systemChat _msg;
};

while {true} do
{
waitUntil {sleep 1; alive player};
while {alive player} do
{
	waitUntil {sleep 1; vehicle player != player};
	if (_hasACRE) then
	{
		_onTS = acre_sys_core_ts3id != -1;
	};
	_v = vehicle player;

	if ((_v isKindOf "Helicopter" || _v isKindOf "Plane") && !(_v isKindOf "ParachuteBase")) then
	{
		_forbidden = [];
		_forbiddenTrans = [driver _v] + [_v turretUnit [0]]; 					// Forbidden positions in transport vehicle: Pilot, Co-pilot
		_forbiddenAttck = [driver _v] + [_v turretUnit [0]] + [gunner _v]; 		// Forbidden positions in attack vehicle: Pilot, Co-pilot, Gunner

		if (typeOf _v in _attackVehicles) then {_forbidden = _forbiddenAttck;} else {_forbidden = _forbiddenTrans;};
		if (player in _forbidden) then
		{
			if (!_isPilot || !_hasACRE || !_onTS) then
			{
				_v spawn gdsn_fnc_moveToCargo;
			}
			else
			{
				waitUntil
				{
					sleep 1;
					if (isEngineOn _v) exitWith
					{
						playSound "PilotChannel";
						true
					};
					if (_v == player) exitWith
					{
						true
					};
				};
			};
		};
	};
	waitUntil {sleep 1; vehicle player == player};
};
};

Edited by ColinM9991

Share this post


Link to post
Share on other sites

Thanks Harzach, just tested but unfortunately it doesn't work still.

In fact, If I get in the helicopter without ACRE or with a non pilot slot then it kicks me out just as it should, if another player gets in the helicopter then he/she has no issues flying regardless of player slot or ACRE Status (Still only working locally, as the server is hosted within my LAN), and AFTER that happens; if I get back in to the helicopter then it doesn't seem to kick me out or move me from cargo anymore.

Edited by ColinM9991

Share this post


Link to post
Share on other sites

It works multiple times on local hosted and dedi, but on hosted or dedi if a player outside of my LAN tries to test out the script, then it stops working completely for external-range and internal-range players.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×