createDialog "DeathScreen";
(findDisplay 7300) displaySetEventHandler ["KeyDown","if ((_this select 1) isEqualTo 1) then {true}"]; //Block the ESC menu
_unit spawn {
    private["_maxTime","_RespawnBtn","_Timer"];
    disableSerialization;
    _RespawnBtn = ((findDisplay 7300) displayCtrl 7302);
    _Timer = ((findDisplay 7300) displayCtrl 7301);
        if (LIFE_SETTINGS(getNumber,"respawn_timer") < 5) then {
            _maxTime = time + 5;
        } else {
            if (FETCH_CONST(life_adminlevel) == 5) exitWith {_maxTime = time + 5;};
            if (independent countSide playableUnits == 0) exitWith {_maxTime = time + LIFE_SETTINGS(getNumber,"respawn_timer_without_med");};
            _maxTime = time + LIFE_SETTINGS(getNumber,"respawn_timer");
        };
    _RespawnBtn ctrlEnable false;
    waitUntil {_Timer ctrlSetText format[localize "STR_Medic_Respawn",[(_maxTime - time),"MM:SS"] call BIS_fnc_secondsToString];
    round(_maxTime - time) <= 0 || isNull _this};
    _RespawnBtn ctrlEnable true;
    _Timer ctrlSetText localize "STR_Medic_Respawn_2";
};
[] spawn life_fnc_deathScreen;