mirror of
https://github.com/EpochModTeam/DayZ-Epoch.git
synced 2025-12-15 13:26:39 +03:00
Add function for vehicle addons
This adds a remove and add ammo function for vehicles. Also a keep flares check if the vehicle ammo got removed. Server admins can add/remove different weapons to vehicles by just editing server_spawnVehicle.
This commit is contained in:
43
SQF/dayz_server/compile/server_clearTurrets.sqf
Normal file
43
SQF/dayz_server/compile/server_clearTurrets.sqf
Normal file
@@ -0,0 +1,43 @@
|
||||
//By denvdmj (probably, I found it on the biki)
|
||||
|
||||
local _obj = _this;
|
||||
|
||||
local _weaponArray = [];
|
||||
_weaponArray set [count _weaponArray,[-1]];
|
||||
|
||||
local _findRecurse = {
|
||||
local _root = (_this select 0);
|
||||
local _path = +(_this select 1);
|
||||
local _thisThis = _this select 2;
|
||||
|
||||
for "_i" from 0 to count _root -1 do {
|
||||
local _class = _root select _i;
|
||||
|
||||
if (isClass _class) then {
|
||||
local _currentPath = _path + [_i];
|
||||
{_weaponArray set [count _weaponArray, _currentPath];} count getArray (_class >> "weapons");
|
||||
_class = _class >> "turrets";
|
||||
if (isClass _class) then {[_class, _currentPath, _thisThis] call _findRecurse;};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[configFile >> "CfgVehicles" >> typeOf (_obj) >> "turrets", [], _obj] call _findRecurse;
|
||||
|
||||
{
|
||||
local _turret = _x;
|
||||
local _mags = _obj magazinesTurret _turret;
|
||||
|
||||
{
|
||||
local _mag = _x;
|
||||
if !(["horn",_mag] call fnc_inString) then {
|
||||
if (DZE_clearVehicleFlares) then {
|
||||
_obj removeMagazinesTurret[_mag,_turret];
|
||||
} else {
|
||||
if !(["flare",_mag] call fnc_inString) then {
|
||||
_obj removeMagazinesTurret[_mag,_turret];
|
||||
};
|
||||
};
|
||||
};
|
||||
} count _mags;
|
||||
} forEach _weaponArray;
|
||||
Reference in New Issue
Block a user