EDG

Auto Server Restart For Dummies

85 posts in this topic

Ok so thanks to @Seth^^ i finally got auto restarts to work on my server. It was no simple task as it was not in detail. This is why i decided to make a in debt tutorial giving all the credit of coarse to @Seth^^.

Install

Go to your arma 3 server root folder and open up mpmission, then you want to unpack the Exile.Altis pbo.

Open the unpack pbo and create a folder called restart. In that folder you will create a SQF file called ExileServer_system_rcon_thread_check and drop this code in that file and save as a SQF.

/**
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_restartTime","_restartMessages","_useAutoKick","_kickTime","_lockTime","_uptime","_timeTilRestart","_time","_i"];
_restartTime = _this select 0;
_restartMessages = _this select 1;
_useAutoKick = _this select 2;
_kickTime = _this select 3;
_lockTime = _this select 4;
_uptime = call ExileServer_util_time_uptime;
_timeTilRestart = _restartTime - _uptime;
if (typeName _restartMessages isEqualTo "ARRAY") then
{
	if !(_restartMessages isEqualTo []) then
	{
		{
			_time = _x;
			if (_timeTilRestart < _time) then
			{
				if !(ExileSessions isEqualTo []) then
				{
					["notificationRequest",["RestartWarning",[format["Server restart in %1 min!",_time]]]] call ExileServer_system_network_send_broadcast;
				};
				ExileServerRestartMessages deleteAt _forEachIndex;
				format ["Restart Warrnings for %1min sent",_time] call ExileServer_util_log;
			};
		} 
		forEach _restartMessages;
	};
};
if (_timeTilRestart < _lockTime) then
{
	if !(ExileServerIsLocked) then
	{
		"#lock" call ExileServer_system_rcon_event_sendCommand;
		"Server locked for restart" call ExileServer_util_log;
		["notificationRequest",["LockKickWarning",["You will be kicked from the server due to restart."]]] call ExileServer_system_network_send_broadcast;
		ExileServerIsLocked = true;
	};
	if (_timeTilRestart < _kickTime) then
	{
		if !(ExileServerRestartMode) then
		{
			call ExileServer_system_rcon_event_kickAllrestart;
			"Evryone kicked for restart" call ExileServer_util_log;
			call ExileServer_system_rcon_event_clearBuffers;
			"Buffers cleared!" call ExileServer_util_log;
			for "_i" from 0 to 9 do
			{
				"SERVER READY FOR RESTART!!" call ExileServer_util_log;
			};
			ExileServerRestartMode = true;
			uiSleep 10;
			"#shutdown" call ExileServer_system_rcon_event_sendCommand;
		};
	};
};
true

Once that is done go to the unpacked mpmission again open the config.cpp file. In that file search for Class CfgExileCustomCode it is near line 1556 and replace it with this

class CfgExileCustomCode 
{


	ExileServer_system_rcon_thread_check = "restart\ExileServer_system_rcon_thread_check.sqf";

	


	
};

So it should look like this

///////////////////////////////////////////////////////////////////////////////
	// Zamak
	///////////////////////////////////////////////////////////////////////////////
	class Exile_Car_Zamak 								{ quality = 1; price = 3000; };
};
class CfgExileCustomCode 
{


	ExileServer_system_rcon_thread_check = "restart\ExileServer_system_rcon_thread_check.sqf";

	


	
};
class CfgExileMusic
{
	Ambient[] = {"ExileTrack03","ExileTrack04"};
	Combat[] = {"ExileTrack06","ExileTrack07"};
	Intro[] = {"ExileTrack02","ExileTrack03"};
};

Once you have done the first 2 step go ahead and pack the Exile.Altis into a pbo. Next create a .bat file in your arma 3 server root directory called autorestart.bat and add this in to the bat

@echo off
color 0a
title Server Starter
:Serverstart
echo Launching Server
F: 
cd "F:\servers\Exile"
echo Watching DTG Arma 3 Exile Server
start "Arma3" /min /wait arma3server.exe -mod=@exile;Kart,Mark,Heli; -servermod=@exileserver;@infiSTAR_servermod; -config=F:\servers\Exile\@ExileServer\config.cfg -ip=63.251.20.138 -port=2302 -profiles=SC -cfg=F:\servers\Exile\@ExileServer\basic.cfg -name=SC -autoinit
ping 127.0.0.1 -n 15 >NUL
echo Server with Exile has exited ... Restarting!
ping 127.0.0.1 -n 5 >NUL
cls
goto Serverstart

Make sure that you change the info for the start parameters to your own. Then send a copy of this .bat to you desktop, and there you go.

VERY IMPORTANT this set up will not work if you removed the server auto lock in the config.ccp of the exile_server_config pbo so make sure that your config matches as follows,

// Autolocks server until its ready to accept players
		useAutoLock = 1;

		// Server will autoLock at that time before restart (minutes)
		restartAutoLock = 2;

		/*
			Number of hours and minutes of your restart period.

			Examples:

			{4, 0} = Every 4 hours
			{1, 30} = Every one and a half hour (who the hell would do this?)
		*/
		restartTimer[] = {3, 0};

		/*
			Kicks players before restart to prevent gear loss.
			We strongely recommend to use this!

			0 = off
			1 = on
		*/
		useAutoKick = 1;

		/*
			Number of minutes before the server kicks players that did
			not disconnect before the restart. Should at least be two
			minutes!
		*/
		kickTime = 2;

		/*
			Self-explanatory

			0 = off
			1 = on
		*/
		useRestartMessages = 1;

		/*
			Number of minutes before the restart to inform your players.

			Only use full minutes here. Value like 5.5 have not been tested.
		*/
		restartWarrningTime[] = {15, 10, 5, 3}; 

 

Once again a great thanks to @seth^^ and with the help of @s. i figured this out. Cheers to you both.

 

Edited by EDG
  • Like 8

Share this post


Link to post
Share on other sites
Advertisement

Ok so i have been testing this and seem to not work i will do more research on my end and see what is going on. As for starting the server it works but closing it down and kicking people it did not work. I will look to see were it is calling and get back with a report.

Share this post


Link to post
Share on other sites

@Seth^^ The guide and download I created also includes a restart bat. file the works 100% with your mission script.

I can't thank you enough good sir :)

  • Like 1

Share this post


Link to post
Share on other sites

@@EDG If you make the changes we discussed don't forget to update your Status bar mod to match :ph34r:

Took me a good amount of time to realize they both had to be edited.

You can always set your server restart to {0, 10} for a quick 10 min test.

Let me know when it works :D

Share this post


Link to post
Share on other sites

Update i have finally got it to work thanks to the assistance of @S. i have made some change in my instruction make sure that you follow them accordingly. Don't be shy to ask for help.

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.