structured logging

This commit is contained in:
2024-01-29 13:26:44 -08:00
parent 8d42fa4593
commit 2951e9cda9
4 changed files with 32 additions and 3 deletions

View File

@@ -69,6 +69,11 @@ class milsim
class mapMarkerToString {}; //needs refactor
class stringToMapMarker {}; //needs refactor
};
class util
{
class getPlayerLogString {};
};
};
class milsim_respawn {

View File

@@ -3,9 +3,12 @@ if ( !hasInterface ) exitWith {};
player addEventHandler["Respawn",
{
params ["_unit", "_corpse"];
_killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
if (_killer == "respawn_button") then {
format["[MILSIM] (client) %1 was unconscious then clicked the respawn button", name _unit] remoteExec["diag_log", 0];
format[
"[MILSIM] (client) RESPAWNED WHILE UNCONSCIOUS %1",
[_unit] call milsim_fnc_getPlayerLogString
] remoteExec["diag_log", 0];
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
};
}

View File

@@ -3,7 +3,11 @@
{
_clientID = _thisArgs select 0;
player setDamage 1;
format["[MILSIM] (init) %1 claims they were glitched and respawned - %2", name player, netID player] remoteExec["diag_log", 2];
format[
"[MILSIM] (init) CHAT COMMAND RESPAWN playerNetID=%1 %2",
player call BIS_fnc_netId,
[player] call milsim_fnc_getPlayerLogString
] remoteExec["diag_log", 2];
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];
},
"all",

View File

@@ -0,0 +1,17 @@
/*
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 <OBJECT> - The player object to get the string for.
*/
params [["_playerObj", objNull]];
if (isNull _playerObj) exitWith {
"playerName=""ERROR"" playerUID=""ERROR"" playerGroup=""ERROR"""
};
format["playerName=""%1"" playerUID=""%2"" playerGroup=""%3""", name _playerObj, getPlayerUID _playerObj, groupId (group _playerObj)];