diff --git a/framework/client/functions/fn_bindEventHandlers.sqf b/framework/client/functions/fn_bindEventHandlers.sqf index 72faae7..15bc941 100644 --- a/framework/client/functions/fn_bindEventHandlers.sqf +++ b/framework/client/functions/fn_bindEventHandlers.sqf @@ -2,29 +2,29 @@ if ( !hasInterface ) exitWith {}; -player addEventHandler["Respawn", - { - params ["_unit", "_corpse"]; - private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"]; - if (_killer == "respawn_button") then { - private _timeWentUnconscious = _corpse getVariable [QGVARMAIN(lastTimeKnockedOut), -1]; - private _durationSpentUnconscious = -1; - if (_timeWentUnconscious > -1) then { - _durationSpentUnconscious = diag_tickTime - _timeWentUnconscious; - }; +["ace_killed", { + params ["_unit", "_causeOfDeath", "_killer", "_instigator"]; - [ - LEVEL_INFO, - QUOTE(COMPONENT), - "RESPAWNED WHILE UNCONSCIOUS", - [_unit, [ - ["durationSpentUnconscious", _durationSpentUnconscious] - ]] call EFUNC(common,addPlayerInfoToArray) - ] remoteExec [QEFUNC(common,log), 2]; - // format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0]; + if (!local _unit) exitWith {}; + + if (_causeOfDeath == "respawn_button") then { + private _timeWentUnconscious = _corpse getVariable [QGVARMAIN(lastTimeKnockedOut), -1]; + private _durationSpentUnconscious = -1; + if (_timeWentUnconscious > -1) then { + _durationSpentUnconscious = diag_tickTime - _timeWentUnconscious; }; - } -]; + + [ + LEVEL_INFO, + QUOTE(COMPONENT), + "RESPAWNED WHILE UNCONSCIOUS", + [_unit, [ + ["durationSpentUnconscious", _durationSpentUnconscious] + ]] call EFUNC(common,addPlayerInfoToArray) + ] remoteExec [QEFUNC(common,log), 2]; + // format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0]; + }; +}] call CBA_fnc_addEventHandler; [