From bf1e252ea857d90f3f2e6d4490c719c0712d8cf7 Mon Sep 17 00:00:00 2001 From: "[VB]AWOL" Date: Wed, 30 Oct 2013 17:19:29 -0500 Subject: [PATCH] reduce array size and reverse functions --- SQF/dayz_server/init/server_functions.sqf | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/SQF/dayz_server/init/server_functions.sqf b/SQF/dayz_server/init/server_functions.sqf index 6feb75f09..b6f3ac090 100644 --- a/SQF/dayz_server/init/server_functions.sqf +++ b/SQF/dayz_server/init/server_functions.sqf @@ -37,7 +37,7 @@ vehicle_handleInteract = { [_object, "all"] call server_updateObject; }; -array_reduceReverse = { +array_reduceSizeReverse = { private["_array","_count","_num","_newarray","_startnum","_index"]; _array = _this select 0; _newarray = []; @@ -54,6 +54,23 @@ array_reduceReverse = { _array }; +array_reduceSize = { + private["_array","_count","_num","_newarray","_startnum","_index"]; + _array = _this select 0; + _newarray = []; + _count = _this select 1; + _num = count _array; + if (_num > _count) then { + _startnum = _num - 1; + _index = _count - 1; + for "_i" from 0 to _index do { + _newarray set [_i,_array select _i]; + }; + _array = _newarray; + }; + _array +}; + vehicle_handleServerKilled = { private["_unit","_killer"]; _unit = _this select 0;