params [["_player", objNull, [objNull]]]; if (!isServer) exitWith { [ "respawn_reinsertion", "ATTEMPTED RUN ON CLIENT", [ ["player", _player] ] ] call milsim_fnc_log; }; if (isNull _player) exitWith { [ "respawn_reinsertion", "NULL PARAMETERS", [ ["player", _player] ] ] call milsim_fnc_log; }; // get entries for this player from queue private _unitArrs = milsim_reinsert_reinsertionQueue select {_x#0 isEqualTo _player}; // if player not in queue, skip if (count _unitArrs isEqualTo 0) exitWith {}; private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400]; // remove player from queue milsim_reinsert_reinsertionQueue = milsim_reinsert_reinsertionQueue - _unitArrs; // broadcast new list to all machines publicVariable "milsim_reinsert_reinsertionQueue"; // sort _unitArrs by time in queue, descending, to get longest wait (if for some reason there's a duplicate) [_unitArrs, [], { _x#2 }, "DESCEND"] call BIS_fnc_sortBy; // get first entry (longest wait) (_unitArrs#0) params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, base, timeInQueue] // get the closest base to the player private _nearestBase = [_player] call milsim_fnc_getNearestBase; // log to rpt private _logParams = [ ["filedAtBase", [_base] call milsim_fnc_getNameOfBase], ["filedAtBaseDistance", _player distance _base], ["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase], ["closestBaseDistance", _player distance _nearestBase], ["maxDistanceSetting", _maxRangeToReady], ["inQueueDuration", diag_tickTime - _timeFiled] ]; _logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray; [ "respawn_reinsertion", "PLAYER RESCINDED REQUEST", _logParams ] call milsim_fnc_log;