From f3c95322e97453ff7ce7c18de2c24ab3c4c51d16 Mon Sep 17 00:00:00 2001 From: IndigoFox Date: Mon, 19 Feb 2024 16:11:42 -0800 Subject: [PATCH] change respawn button use warning to use ace_killed CBA event --- .../client/functions/fn_bindEventHandlers.sqf | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) 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; [