diff --git a/cScripts/cScripts_postInit.sqf b/cScripts/cScripts_postInit.sqf index 030bc830a..df04459e4 100644 --- a/cScripts/cScripts_postInit.sqf +++ b/cScripts/cScripts_postInit.sqf @@ -28,8 +28,4 @@ if (EGVAR(Settings,showDiaryRecords)) then { call EFUNC(civ,init); -onPlayerConnected { - [QEGVAR(log,player), [getPlayerUID player, player]] call CBA_fnc_serverEvent; -}; - INFO("postInit", "Initialization completed."); diff --git a/cScripts/functions/init/fn_init_eventHandlers.sqf b/cScripts/functions/init/fn_init_eventHandlers.sqf index 3622a21e7..ce28c23fa 100644 --- a/cScripts/functions/init/fn_init_eventHandlers.sqf +++ b/cScripts/functions/init/fn_init_eventHandlers.sqf @@ -40,9 +40,10 @@ INFO("InitEventHandlers","Creating Server EventHandlers"); }] call CBA_fnc_addEventHandler; [QEGVAR(log,player), { - params ["_guid","_player"]; + params ["_guid","_name"]; + private _unit = [_guid] call BIS_fnc_getUnitByUID; private _playerLog = GETMVAR(EGVAR(log,players),createHashMap); - INFO_3("PlayerLog","Connected %1 [%2] (GUID: %3)",name _player,typeOf _player,_guid); + INFO_3("PlayerLog","Connected %1 [%2] (GUID: %3)",_name,typeOf _unit,_guid); if (!isNil{_playerLog get _guid}) then { INFO_1("PlayerLog","Updating Log Entry [%1]", isNil{_playerLog get _guid}); @@ -52,18 +53,24 @@ INFO("InitEventHandlers","Creating Server EventHandlers"); _connections pushBack systemTimeUTC; _data set ["connections", _connections]; - _data set ["loadout", typeOf _player]; + private _loadout = GETVAR(EGVAR(Gear,LoadoutClass), typeOf _unit); + _data set ["loadout", GETVAR(EGVAR(Gear,LoadoutClass), typeOf _unit)]; _playerLog set [_guid,_data]; } else { INFO_1("PlayerLog", "Creating Log Entry [%1]", isNil{_playerLog get _guid}); private _entry = createHashMapFromArray [ - ['name', name _player], - ['loadout', typeOf _player], + ['name', _name], + ['loadout', _loadout], ['connectTime', systemTimeUTC], ['connections', [systemTimeUTC]] ]; _playerLog set [_guid,_entry]; }; SETMVAR(EGVAR(log,players),_playerLog); -}] call CBA_fnc_addEventHandler; \ No newline at end of file +}] call CBA_fnc_addEventHandler; + +addMissionEventHandler ["PlayerConnected", { + params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"]; + [QEGVAR(log,player), [_uid, _name]] call CBA_fnc_serverEvent; +}]; \ No newline at end of file