diff --git a/functions/CfgFunctions.hpp b/functions/CfgFunctions.hpp index cd622c8..7e8f088 100644 --- a/functions/CfgFunctions.hpp +++ b/functions/CfgFunctions.hpp @@ -72,7 +72,7 @@ class milsim class util { - class getPlayerLogString {}; + class logMissionInfo { postInit = 1; }; class addPlayerInfoToArray {}; class log {}; }; diff --git a/functions/client/fn_bindEventHandlers.sqf b/functions/client/fn_bindEventHandlers.sqf index 1a0132b..b4bcf8f 100644 --- a/functions/client/fn_bindEventHandlers.sqf +++ b/functions/client/fn_bindEventHandlers.sqf @@ -5,10 +5,11 @@ player addEventHandler["Respawn", params ["_unit", "_corpse"]; private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"]; if (_killer == "respawn_button") then { - format[ - "[MILSIM] (client) RESPAWNED WHILE UNCONSCIOUS %1", - [_unit] call milsim_fnc_getPlayerLogString - ] remoteExec["diag_log", 0]; + [ + "client", + "RESPAWNED WHILE UNCONSCIOUS", + [_unit] call milsim_fnc_addPlayerInfoToArray + ] remoteExec ["milsim_fnc_log", 2]; // format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0]; }; } diff --git a/functions/settings/fn_addRespawnChatHandler.sqf b/functions/settings/fn_addRespawnChatHandler.sqf index e0bfaa1..fed6acb 100644 --- a/functions/settings/fn_addRespawnChatHandler.sqf +++ b/functions/settings/fn_addRespawnChatHandler.sqf @@ -3,11 +3,15 @@ { _clientID = _thisArgs select 0; player setDamage 1; - format[ - "[MILSIM] (init) CHAT COMMAND RESPAWN playerNetID=%1 %2", - player call BIS_fnc_netId, - [player] call milsim_fnc_getPlayerLogString - ] remoteExec["diag_log", 2]; + + // log to server RPT + [ + "init", + "CHAT COMMAND RESPAWN", + [player] call milsim_fnc_addPlayerInfoToArray + ] remoteExec ["milsim_fnc_log", 2]; + + // systemChat to all remote machines format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID]; }, "all", diff --git a/functions/util/fn_addPlayerInfoToArray.sqf b/functions/util/fn_addPlayerInfoToArray.sqf index b5e45c5..4a473df 100644 --- a/functions/util/fn_addPlayerInfoToArray.sqf +++ b/functions/util/fn_addPlayerInfoToArray.sqf @@ -1,11 +1,14 @@ params [["_playerObj", objNull], ["_arrayToModify", [], [[]]]]; +if (isNull _playerObj) exitWith {_arrayToModify}; + { _arrayToModify = [_arrayToModify, _x#0, _x#1] call BIS_fnc_setToPairs; } forEach [ ["playerName", name _playerObj], ["playerUID", getPlayerUID _playerObj], - ["playerGroup", groupId (group _playerObj)] + ["playerGroup", groupId (group _playerObj)], + ["playerNetID", [_playerObj] call BIS_fnc_netId] ]; _arrayToModify; \ No newline at end of file diff --git a/functions/util/fn_getPlayerLogString.sqf b/functions/util/fn_getPlayerLogString.sqf deleted file mode 100644 index 3b194eb..0000000 --- a/functions/util/fn_getPlayerLogString.sqf +++ /dev/null @@ -1,42 +0,0 @@ -/* - Function: milsim_fnc_getPlayerLogString - - Author: IndigoFox - - Description: - Returns a string containing the player's name, UID and group name in 'key="value"' format. - - Parameters: - 0: _playerObj - The player object to get the string for. - 1: _returnArray - If true, returns a key/value array of the player's name, UID and group name. -*/ - -params [["_playerObj", objNull], ["_returnArray", false, [false, true]]]; - -switch (_returnArray) do { - case false: { - if (isNull _playerObj) exitWith { - "playerName=""ERROR"" playerUID=""ERROR"" playerGroup=""ERROR""" - }; - if (true) exitWith { - format["playerName=""%1"" playerUID=""%2"" playerGroup=""%3""", name _playerObj, getPlayerUID _playerObj, groupId (group _playerObj)]; - }; - }; - case true: { - if (isNull _playerObj) exitWith { - [ - ["playerName", "ERROR"], - ["playerUID", "ERROR"], - ["playerGroup", "ERROR"] - ] - }; - if (true) exitWith { - [ - ["playerName", name _playerObj], - ["playerUID", getPlayerUID _playerObj], - ["playerGroup", groupId (group _playerObj)] - ] - }; - }; -}; - diff --git a/functions/util/fn_logMissionInfo.sqf b/functions/util/fn_logMissionInfo.sqf new file mode 100644 index 0000000..6286476 --- /dev/null +++ b/functions/util/fn_logMissionInfo.sqf @@ -0,0 +1,23 @@ +[ + "init", + "MISSION INFO", + [ + ["serverName", serverName], + ["worldName", worldName], + ["missionSeries", getMissionConfigValue ["missionSeries", ""]], + ["missionName", missionName], + ["briefingName", briefingName], + ["overviewText", getMissionConfigValue ["overviewText", ""]], + ["onLoadName", getMissionConfigValue ["onLoadName", ""]], + ["onLoadMission", getMissionConfigValue ["onLoadMission", ""]], + ["missionAuthor", getMissionConfigValue ["author", ""]], + ["unitSlots", createHashMapFromArray [ + ["EAST", playableSlotsNumber EAST], // 0 is EAST side + ["WEST", playableSlotsNumber WEST], // 1 is WEST side + ["RESISTANCE", playableSlotsNumber RESISTANCE], // 2 is RESISTANCE side + ["CIVILIAN", playableSlotsNumber CIVILIAN], // 3 is CIVILIAN side + ["SIDEUNKNOWN", 0], // 4 is SIDEUNKNOWN side + ["LOGIC", playableSlotsNumber sideLogic] // 5 is LOGIC side + ]] + ] +] call milsim_fnc_log; \ No newline at end of file