Note: put sqf files in C:\Users\USERNAME\Documents\Arma 3 - Other Profiles\ARMAUSERNAME\mpmissions\MISSIONNAME
enter_zone.sqf:
private "_duration";
_duration = _this select 0;
//function:
TAG_fnc_coloredCountdownHint = {
_color = "#45f442";//green
_timeLeft = TAG_fnc_countdownEndTime - time;
if (_timeLeft < 16) then {_color = "#eef441";};//yellow
if (_timeLeft < 6) then {_color = "#ff0000";};//red
if (_timeLeft < 0) exitWith {
//exit and remove eventhandler while politely closing the door
removeMissionEventhandler ["EachFrame",_thisEventHandler];
hintSilent parseText format ["<t color='%1'>--- Time is up! ---</t>",_color];
player setDamage 1;
};
hintSilent parseText format ["Time Left:<br/><t color='%1'>--- %2 ---</t>", _color, [(_timeLeft/3600),"HH:MM:SS"] call BIS_fnc_timetostring];
};
//calling the function:
TAG_fnc_countdownEndTime = time + _duration;
eventHandlerId = addMissionEventHandler ["EachFrame",{[] call TAG_fnc_coloredCountdownHint}];
leave_zone.sqf:
removeMissionEventhandler ["EachFrame",eventHandlerId];
_color="#45f442";
hintSilent parseText format ["<t color='%1'>--- You're Clear ---</t>",_color];
_time = 5;
while {_time > 0} do {
_time = _time - 1;
sleep 1;
};
hintSilent "";
Trigger:
condition : this
On Activation: enterzone = [10]execVM "enter_zone.sqf";
On Deactivation: leavezone = []execVM "leave_zone.sqf";