Skip to content

Commit

Permalink
Killtracker - Add ability to sync globally (acemod#8521)
Browse files Browse the repository at this point in the history
  • Loading branch information
PabstMirror authored and AndreasBrostrom committed Dec 3, 2021
1 parent 8acc383 commit 933c967
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion addons/killtracker/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ if ((getText (missionconfigfile >> "CfgDebriefingSections" >> QUOTE(XADDON) >> "
TRACE_1("no mission debriefing config",_this);
};

INFO("Running Kill Tracking");
private _global = missionNamespace getVariable [QGVAR(globalSync), false]; // Global Sync (e.g. for spectator)
INFO_1("Running Kill Tracking [Global: %1]",_global);

// Variables:
GVAR(eventsArray) = [];
Expand All @@ -35,13 +36,19 @@ GVAR(killCount) = 0;
GVAR(killCount) = GVAR(killCount) + 1;
GVAR(eventsArray) pushBack format [LLSTRING(Kill), _name, _killInfo];
XGVAR(outputText) = (format ["%1 %2<br/>", LLSTRING(TotalKills), GVAR(killCount)]) + (GVAR(eventsArray) joinString "<br/>");
if (missionNamespace getVariable [QGVAR(globalSync), false]) then {
ACE_player setVariable [QGVAR(output), XGVAR(outputText), true];
};
}] call CBA_fnc_addEventHandler;

[QGVAR(death), {
params ["_name", "_killInfo"];
TRACE_2("death eh",_name,_killInfo);
GVAR(eventsArray) pushBack format [LLSTRING(Killer), _name, _killInfo];
XGVAR(outputText) = (format ["%1 %2<br/>", LLSTRING(TotalKills), GVAR(killCount)]) + (GVAR(eventsArray) joinString "<br/>");
if (missionNamespace getVariable [QGVAR(globalSync), false]) then {
ACE_player setVariable [QGVAR(output), XGVAR(outputText), true];
};
}] call CBA_fnc_addEventHandler;

["ace_killed", {
Expand Down

0 comments on commit 933c967

Please sign in to comment.