Skip to content

Commit

Permalink
Improved the attendance system it now open a dialogue
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasBrostrom committed Jul 17, 2024
1 parent b970466 commit 8c23cbd
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 23 deletions.
2 changes: 1 addition & 1 deletion cScripts/cScripts_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (EGVAR(Settings,showDiaryRecords)) then {
call EFUNC(civ,init);

onPlayerConnected {
[QEGVAR(log,player), [name player]] call CBA_fnc_serverEvent;
[QEGVAR(log,player), [player]] call CBA_fnc_serverEvent;
};

INFO("postInit", "Initialization completed.");
8 changes: 6 additions & 2 deletions cScripts/functions/init/fn_init_eventHandlers.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ INFO("InitEventHandlers","Creating Server EventHandlers");
}] call CBA_fnc_addEventHandler;

[QEGVAR(log,player), {
_this params ["_playerName"];
params ["_player"];
private _playerLog = missionNamespace getVariable [QEGVAR(log,players), []];
_playerLog pushBack _playerName;
_playerLog pushBack [
_player,
name _player,
[_player] call EFUNC(gear,getLoadoutDisplayName)
];
missionNamespace setVariable [QEGVAR(log,players), _playerLog];
}] call CBA_fnc_addEventHandler;
52 changes: 32 additions & 20 deletions cScripts/functions/systems/fn_getAttendance.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,37 @@
*
*/

private _playerLog = missionNamespace getVariable [QEGVAR(log,players), []];
private _loggedPlayer = GETMVAR(EGVAR(log,players),[]);

// Rpt
["=================================================== START", "Attendance"] call FUNC(info);
[format ["Attendance (Entries: %1)", count _playerLog], "Attendance"] call FUNC(info);
private _header = format["=== Attendance (Entries: %1) ===", count _loggedPlayer];

private _dateTime = systemTimeUTC apply { if (_x < 10) then { "0" + str _x } else { str _x } };
private _year = _dateTime#0;
private _month = _dateTime#1;
private _day = _dateTime#2;
private _hour = _dateTime#3;
private _minute = _dateTime#4;
_dateTime = format["Date: %1-%2-%3 %4:%5z", _year, _month, _day, _hour, _minute];

// Export
private _entries = [_header, endl, _dateTime, endl, endl];
{
_x params ["_player","_name","_slot"];
_entries append [_name, " (", _slot, ")", endl];
} forEach _loggedPlayer;

private _export = composeText _entries;

["Mission attendees", str _export] call zen_common_fnc_exportText;


// RPT
SHOW_INFO("Attendance",_header);
SHOW_INFO("Attendance",_dateTime);
{
_x params ["_name"];
[_name, "Attendance", false, false] call FUNC(info);
} forEach _playerLog;

["=================================================== END", "Attendence"] call FUNC(info);

// Hint
[
[],
["All attended players have been"],
["to your RPT log..."],
[""],
[""]
] call CBA_fnc_notify;

_playerLog
_x params ["_player","_name","_slot"];
private _output = format["%1 (%2 [%3])", _name, _slot, typeOf _player];
SHOW_INFO("Attendance",_output);
} forEach _loggedPlayer;

SHOW_INFO("Attendance","================================");

0 comments on commit 8c23cbd

Please sign in to comment.