Jump to content
maihym

Why isn't this working?

Recommended Posts

So I'm basically trying to make a restart warning script but to test it I'm trying to make it execute after 3 minutes but waitUntil {serverTime == 180}; doesn't seem to be doing anything. Here is the full script.

[] spawn {
	_2hours =
		[
			[format["== WARNING =="],"<t align = 'center' shadow = '1' size = '0.8' color ='#E44646' font='PuristaBold'>%1</t><br />"],
			[format["Next restart in 2 hours...."],"<t align = 'center' shadow = '1' size = '0.6'>%1</t><br/>"]
		];

	_1hour =
		[
			[format["== WARNING =="],"<t align = 'center' shadow = '1' size = '0.8' color ='#E44646' font='PuristaBold'>%1</t><br />"],
			[format["Next restart in 1 hour...."],"<t align = 'center' shadow = '1' size = '0.6'>%1</t><br/>"]
		];

	_30minutes =
		[
			[format["== WARNING =="],"<t align = 'center' shadow = '1' size = '0.8' color ='#E44646' font='PuristaBold'>%1</t><br />"],
			[format["Next restart in 30 minutes...."],"<t align = 'center' shadow = '1' size = '0.6'>%1</t><br/>"]
		];

	_10minutes =
		[
			[format["== WARNING =="],"<t align = 'center' shadow = '1' size = '0.8' color ='#E44646' font='PuristaBold'>%1</t><br />"],
			[format["Next restart in 10 minutes...."],"<t align = 'center' shadow = '1' size = '0.6'>%1</t><br/>"]
		];

	_5minutes =
		[
			[format["== WARNING =="],"<t align = 'center' shadow = '1' size = '0.8' color ='#E44646' font='PuristaBold'>%1</t><br />"],
			[format["Next restart in 5 minutes...."],"<t align = 'center' shadow = '1' size = '0.6'>%1</t><br/>"]
		];

	_1minute =
		[
			[format["== WARNING =="],"<t align = 'center' shadow = '1' size = '0.8' color ='#E44646' font='PuristaBold'>%1</t><br />"],
			[format["Next restart in 1 minute...."],"<t align = 'center' shadow = '1' size = '0.6'>%1</t><br/>"]
		];

	while {true} do {
		waitUntil {serverTime == 180}; 
			[_2hours] spawn BIS_fnc_typeText;
		sleep 3600;
			[_1hour] spawn BIS_fnc_typeText;
		sleep 1800;
			[_30minutes] spawn BIS_fnc_typeText;
		sleep 1200;
			[_10minutes] spawn BIS_fnc_typeText;
		sleep 300;
			[_5minutes] spawn BIS_fnc_typeText;
		sleep 240;
			[_1minute] spawn BIS_fnc_typeText;
		sleep 59;
			serverCommand ('#login '+passwordAdmin);
			serverCommand ('#shutdown');
	};
};

Share this post


Link to post
Share on other sites

serverTime doesn't sync in the first 5 minutes after server start, as far as I recall.

Also you're trying to check if serverTime == number, this will never return true, use >= instead.

 

Cheers

Share this post


Link to post
Share on other sites

serverTime doesn't sync in the first 5 minutes after server start, as far as I recall.

Also you're trying to check if serverTime == number, this will never return true, use >= instead.

 

Cheers

 

That still didn't work, should I make it wait until about 10 minutes?

Share this post


Link to post
Share on other sites

Bec with Firedaemon = flawless restarts with advance notice :)

Share this post


Link to post
Share on other sites

my problem isn't shutting down the server. my problem is getting the notifications at the accurate time.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×