From dc3382975189c6272a0a989118f955c161b1b863 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Tue, 30 Jan 2024 18:22:45 -0800 Subject: [PATCH] changes logging, and eval inv on server only --- functions/client/fn_bindEventHandlers.sqf | 6 +-- functions/server/fn_logPlayerInventory.sqf | 54 +++++++++++----------- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/functions/client/fn_bindEventHandlers.sqf b/functions/client/fn_bindEventHandlers.sqf index 075a86d..1a0132b 100644 --- a/functions/client/fn_bindEventHandlers.sqf +++ b/functions/client/fn_bindEventHandlers.sqf @@ -42,13 +42,11 @@ addMissionEventHandler ["HandleChatMessage", ["ace_arsenal_displayClosed", { - private _lines = [player] call milsim_fnc_logPlayerInventory; - ["milsim_logText", [_lines]] call CBA_fnc_globalEvent; + [player] remoteExec ["milsim_fnc_logPlayerInventory", 2]; }] call CBA_fnc_addEventHandler; [missionNamespace, "arsenalClosed", { - private _lines = [player] call milsim_fnc_logPlayerInventory; - ["milsim_logText", [_lines]] call CBA_fnc_globalEvent; + [player] remoteExec ["milsim_fnc_logPlayerInventory", 2]; }] call BIS_fnc_addScriptedEventHandler; diag_log text "[MILSIM] (client) event handlers bound"; diff --git a/functions/server/fn_logPlayerInventory.sqf b/functions/server/fn_logPlayerInventory.sqf index b85f0f5..2534f58 100644 --- a/functions/server/fn_logPlayerInventory.sqf +++ b/functions/server/fn_logPlayerInventory.sqf @@ -18,7 +18,11 @@ params [ ]; if (!isPlayer _player) exitWith { - ["[MILSIM] (logPlayerInventory): ERROR :: _player is not a player"] + [ + "logPlayerInventory", + "PARAM PLAYER IS NOT A PLAYER", + [["player", _player]] + ] call milsim_fnc_log; }; // DEFINITIONS @@ -236,22 +240,19 @@ private _nonCompliantItemsCount = 0; // PRIVATE FUNCTIONS private _logItem = { params ["_playerObj", "_categoryText", "_itemClassName"]; - private _cfg = _itemClassName call CBA_fnc_getItemConfig; - _returnLines pushBack (format[ - "[MILSIM] (logPlayerInventory): %1 :: className=""%2"" displayName=""%3"" %4", - _categoryText, - _itemClassName, - [_cfg] call BIS_fnc_displayName, - [_playerObj] call _playerInfoString - ]); + private _itemConfig = _itemClassName call CBA_fnc_getItemConfig; + // Log to RPT + [ + "logPlayerInventory", + "NON-COMPLIANT ITEM", + [_playerObj, [ + ["category", _categoryText], + ["className", _itemClassName], + ["displayName", [_itemConfig] call BIS_fnc_displayName] + ]] call milsim_fnc_addPlayerInfoToArray + ] call milsim_fnc_log; }; -private _playerInfoString = { - params ["_playerObj"]; - format["playerName=""%1"" playerUID=""%2"" playerGroup=""%3""", name _playerObj, getPlayerUID _playerObj, groupId (group _playerObj)]; -}; - - // GATHER INVENTORY // _items = []; // _items pushback headgear _player; @@ -282,10 +283,11 @@ _items pushBack (headgear _player); _items pushBack (uniform _player); // CHECK INVENTORY -_returnLines pushBack (format[ - "[MILSIM] (logPlayerInventory): CHECKING :: %1", - [_player] call _playerInfoString -]); +[ + "logPlayerInventory", + "CHECKING PLAYER INVENTORY", + [_player] call milsim_fnc_addPlayerInfoToArray +] call milsim_fnc_log; { _item = _x; @@ -356,11 +358,9 @@ _returnLines pushBack (format[ } forEach _unlisted; if (_nonCompliantItemsCount isEqualTo 0) then { - _returnLines pushBack (format[ - "[MILSIM] (logPlayerInventory): COMPLIANT :: %1", - [_player] call _playerInfoString - ]); -}; - -// returns array of strings -_returnLines; \ No newline at end of file + [ + "logPlayerInventory", + "PLAYER INVENTORY IS COMPLIANT", + [_player] call milsim_fnc_addPlayerInfoToArray + ] call milsim_fnc_log; +}; \ No newline at end of file