summaryrefslogtreecommitdiffstats
path: root/Common/Functions/Common_GetTeamVehicles.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
commite670b4ed55c459a21090bd0178ceaaaf12d87989 (patch)
treeb6833d5e842475f0ee27f5f617096445fdd4e4a1 /Common/Functions/Common_GetTeamVehicles.sqf
downloada2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.gz
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.bz2
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.zip
init
Diffstat (limited to 'Common/Functions/Common_GetTeamVehicles.sqf')
-rw-r--r--Common/Functions/Common_GetTeamVehicles.sqf30
1 files changed, 30 insertions, 0 deletions
diff --git a/Common/Functions/Common_GetTeamVehicles.sqf b/Common/Functions/Common_GetTeamVehicles.sqf
new file mode 100644
index 0000000..713fe89
--- /dev/null
+++ b/Common/Functions/Common_GetTeamVehicles.sqf
@@ -0,0 +1,30 @@
+private ["_canMove","_crew","_ignoreOwnerConflict","_member","_ownerConflict","_range","_team","_teamVehicles","_units","_vehicle"];
+
+_team = _this select 0;
+_canMove = _this select 1;
+
+_member = objNull;
+_range = 150;
+if (count _this > 2) then {_member = _this select 2};
+if (count _this > 3) then {_range = _this select 3};
+
+_ignoreOwnerConflict = false;
+if (count _this > 4) then {_ignoreOwnerConflict = _this select 4};
+
+_teamVehicles = [];
+_units = units _team;
+
+ {
+ _vehicle = vehicle _x;
+
+ if (_x != _vehicle && !(_vehicle in _teamVehicles)) then {_teamVehicles = _teamVehicles + [_vehicle]};
+ if (_canMove && !canMove _vehicle) then {_teamVehicles = _teamVehicles - [_vehicle]};
+ if (!IsNull _member && _member distance _vehicle > _range) then {_teamVehicles = _teamVehicles - [_vehicle]};
+
+ _ownerConflict = false;
+ _crew = crew _vehicle;
+ {if (_x != leader _team && isPlayer _x) then {_ownerConflict = true}} forEach _crew;
+ if (!_ignoreOwnerConflict && _ownerConflict) then {_teamVehicles = _teamVehicles - [_vehicle]};
+ } forEach _units;
+
+_teamVehicles \ No newline at end of file