Jump to content

[scarCODE] S.R.W. (Server Restart Warnings) by IT07


IT07

Recommended Posts

S.R.W. (Server Restart Warnings)
by IT07

 

 

FEATURES
- Linux & Windows server compatible
- Runs client-side through missionfile
- Very easy configuration: just change a few numbers

- Support for Scheduled restart patterns

- Configurable restart interval

- You decide when warnings will be shown 

INFO
This light-weight script will automatically warn players when a restart is closing in. It uses BIS_fnc_typeText.

It is fully customizable in terms of when the restart warnings are given and the schedule or interval.
Just make sure that you put in the right configuration to match your server :)
In case your were wondering: yes it does work with players that join after 1 or more warnings for a restart have been given.

 

IMPORTANT

If you own a version before version 02039_PATCH1 then you HAVE to upgrade.

It fixes a big security leak in the script.

 

RECOMMENDED
- Notepadd++ for editing the files http://notepad-plus-plus.org/

VIDEO
https://youtu.be/sBg3Co4LGL8

NOTES
This script DOES NOT restart your server. It only gives warnings depending on how you configured it to do so.

ISSUES

- bugged restarts warning times when using scheduled _restartMode. More details about that:

the command missionStart when ran on the server should return [year,month,day,hour,minute,second] of when the server was started.

But it does not do that. Instead, it returns some weird date back in 1970. This prevents the script from being able to check when the server was started.

Which renders the whole idea of the script useless. This issue has been submitted to the ArmA 3 feedback tracker: http://feedback.arma3.com/view.php?id=23373

please upvote this post and ask anyone that wants to help to do the same. It will allow implementation of  working support for scheduled restarts into this script.

news 30th March 2015: The issue has been confirmed by ArmA 3 Devs!

 

DOWNLOAD & INSTALLATION

https://github.com/IT07/A3_ScarCode_ScriptBundle

Link to comment
Share on other sites

] execVM "IgiLoad\IgiLoadInit.sqf";
 
[] execVM "wai\remote.sqf";
 
//Supply Drop Alert Event
"SDROP_Alert" addPublicVariableEventHandler {
hint parseText format["%1", _this select 1];
};
 
if (isServer) then 
{
fn_getBuildingstospawnLoot = compile preProcessFileLineNumbers "Custom\LSpawner\fn_LSgetBuildingstospawnLoot.sqf"; 
LSdeleter = compile preProcessFileLineNumbers "Custom\LSpawner\LSdeleter.sqf";
execVM "Custom\LSpawner\Lootspawner.sqf";
};
 
// Status Bar
[] execVM "scripts\fn_statusBar.sqf";
// Welcome Credits
[] execVM "custom\welcome.sqf";
 
if(hasInterface)then
{execVM "semClient.sqf"
// Time until next restart by IT07
private["_SC_restartIntvlHours"];
/////// CONFIG /////// 
// Please edit the 3 lines below to your likings
_SC_restartIntvlHours = 4; // Change the number 1 into the number of hours your server will be up before it restarts
_SC_restartWarnTopMessage = "== WARNING =="; // What the first line of the warning should say
_SC_restartTimeHintSilent = false;  // RECOMMENDED: false; If true, it will mess with debug monitor!
////////////////////// DO NOT CHANGE ANYTHING BELOW THIS LINE
[_SC_restartIntvlHours, _SC_restartWarnTopMessage, _SC_restartTimeHintSilent] ExecVM "ScarCode\SC_restartTime.sqf";
};
 
//cmEARPLUGS CODE START
//////////////////////////////////////////////////////////////////////////
call compile preProcessFileLineNumbers "cmEarplugs\cm_veh_fun.sqf";
//cmEARPLUGS CODE END
//////////////////////////////////////////////////////////////////////////
 

 
 
Is this correct?   my server restart is every 4 hours please check my above init file 
Link to comment
Share on other sites

I tried li,e this way but my SEM mission wont start... :(

 

any reason why?

 

if i create a different 

 

if(hasInterface)then..... 

 

just for your script sem wont stsrt.. 

Please advise.

 

Sorry I only looked at how you put in my script. If you want me to check your code for errors then you're gonna have to PM me instead ;)

 

I haven't tried it yet as my server hasn't restarted, but this is fantastic IT07... Many thanks for this ;)

 

You are very welcome! I hope you and your players are going to appreciate it forever :)

Link to comment
Share on other sites

I really like this and will play with it, i just have a question though, is there any way to link this to system time? Say for instance the server crashes at 4PM and the next restart is at 6PM, the restart warning would be out of whack completely correct? 

 

If we could link that to pre-defined times that would be the most legend server restart warning around!!

Link to comment
Share on other sites

I really like this and will play with it, i just have a question though, is there any way to link this to system time? Say for instance the server crashes at 4PM and the next restart is at 6PM, the restart warning would be out of whack completely correct? 

 

If we could link that to pre-defined times that would be the most legend server restart warning around!!

No matter what happens, the restart warnings will always work correctly.

It works like this: when the server starts, it will start counting in milliseconds how long the mission has been running.

My script will then execute on the player's computer and will check what the elapsed time is in miliseconds.

Depending on what the time is, it will do certain things to make sure that the player will get the correct warnings.

In short: do not worry about server crashes, this script will still properly work.

Link to comment
Share on other sites

So those of us that have restart schedules set by time, it will still work even if the server was manually restarted halfway through a cycle?

So say my restart is at 6pm, next one would be at 12 but the server crashed/manually restarted at 3, surely this system wouldn't know there is a restart until 6 hours later, not 3?

Link to comment
Share on other sites

So those of us that have restart schedules set by time, it will still work even if the server was manually restarted halfway through a cycle?

So say my restart is at 6pm, next one would be at 12 but the server crashed/manually restarted at 3, surely this system wouldn't know there is a restart until 6 hours later, not 3?

 

This is what I also want to make sure of. 

 

I understand that the script counts time in game and gives the warning to players at the same time, but I want to know if I restart the server half an hour before the actual scheduled restart, will the server warn the players 10 minutes later that the server will restart in 20 minutes because that is the scheduled restart time?

 

Is there a way we can let them know the restart times as well with this method, just spamming messages like BEC that the server restarts at certain time intervals

Link to comment
Share on other sites

Awesome thanks for looking into our suggestion, if you get that waxed to keep time with the server so that I can keep my 6 hour restart schedule as well as irregular restarts without worrying about the warning going all haywire, then your work will certainly be legendary and I can live without BEC. 

 

You sir are a legend and a scholar! Your work is definitely commendable!

Link to comment
Share on other sites

Awesome thanks for looking into our suggestion, if you get that waxed to keep time with the server so that I can keep my 6 hour restart schedule as well as irregular restarts without worrying about the warning going all haywire, then your work will certainly be legendary and I can live without BEC. 

 

You sir are a legend and a scholar! Your work is definitely commendable!

 

I'm glad you like it. Thank you for your appreciation.

Link to comment
Share on other sites

Ok hold on I get it. I will look into this for sure. If I succeed, I will reupload that version and include an option to enable it.

EDIT: Found something useful: https://community.bistudio.com/wiki/serverTime

I will check it out when I get back from work.

 

Another reason you're awesome.

 

Pretty damn awesome script just as it is.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...