RRyanward 0 Posted May 27, 2016 I have a problem with the "restartwarnings.sqf" When the mission ends this script doesn't reset the timer it still thinks it's at 0 and mission ends which is a loop. I'm thinking its something to do with []spawn maybe there's a way to re-spawn the timer. restartwarnings.sqf restartWarningTxt = "== WARNING =="; warningSchedule = [60,30,20,15,10,5,3,2,1]; END_TIME = 400; if (isServer) then { [] spawn { ELAPSED_TIME = 0; START_TIME = diag_tickTime; while {ELAPSED_TIME < END_TIME} do { ELAPSED_TIME = diag_tickTime - START_TIME; publicVariable "ELAPSED_TIME"; sleep 1; }; }; }; if!(isDedicated) then { [] spawn { while{ELAPSED_TIME < END_TIME } do { timey = floor(END_TIME - ELAPSED_TIME); finish_time_minutes = floor(timey / 60); finish_time_seconds = floor(timey) - (60 * finish_time_minutes); finish_time_hours = floor(timey / 3600); if(finish_time_seconds < 10) then { finish_time_seconds = format ["0%1", finish_time_seconds]; }; if(finish_time_minutes < 10) then { finish_time_minutes = format ["0%1", finish_time_minutes]; }; formatted_time = format ["%1:%2", finish_time_hours, finish_time_minutes]; }; }; }; givewarning = compileFinal preprocessFileLineNumbers "addons\restart_warnings\givewarning.sqf"; timecheck = compileFinal preprocessFileLineNumbers "addons\restart_warnings\timecheck.sqf"; [warningSchedule] spawn timecheck; timecheck.sqf _END = 99; //_END = count warningSchedule; while { _END == 99 } do { if (timey == 60) then { playMusic "1min"; sleep 2; }; if (timey == 120) then { playMusic "2min"; sleep 2; }; if (timey == 180) then { playMusic "3min"; sleep 2; }; if (timey == 300) then { playMusic "5min"; sleep 2; }; if (timey == 30) then { playMusic "30sec"; sleep 2; }; if (timey == 10) then { playMusic "10sec"; sleep 2; }; if (timey <= 0) then { endMission "END1"; _END = 98; }; _find = warningSchedule find finish_time_minutes; if (_find > -1) then { [warningSchedule select _find, restartWarningTxt] spawn givewarning; warningSchedule = warningSchedule - [warningSchedule select _find]; //timey = timey -1 }; }; pawn BIS_fnc_typeText; givewarning.sqf _minutesLeft = _this select 0; _minuteOrMinutes = "s"; if(_minutesLeft == 1) then { _minuteOrMinutes = ""; }; _notif = [ [ [format["%1", restartWarningTxt],"<t align = 'center' shadow = '1' size = '1' color ='#E44646' font='PuristaBold'>%1</t><br />"], [format["Next restart in %1 minute%2....", _minutesLeft, _minuteOrMinutes],"<t align = 'center' shadow = '1' size = '0.8'>%1</t><br/>"] ] ] spawn BIS_fnc_typeText; Share this post Link to post Share on other sites
RRyanward 0 Posted May 28, 2016 Iv'e tried to loop back to the spawn with preset numbers but the game doesn't like my format. Please if anyone could help much would be appreciated. Share this post Link to post Share on other sites