[FilterScript] Server Restart Command for Rcon Admins - The first of its kind!
#1

Server Restart Command for Rcon Admins
By Aerotactics


Includes *new*
-zcmd

Changelog
-made string arrays smaller
-revised a section of script to be even smaller
-utilized zcmd to shorten the script a couple lines, and for it's efficiency
-corrected duplicating objects script -- see below
-added a fix for objects duplicating after a restart, causing issues with Incognito's Streamer
-fixed a bug that allowed the command to be called by 2 people at once, causing a server crash
-Removed define "MAX_FS"
-fixed a typo

About
I was on my way to bed, when I got a random idea. Since I learned how to make a server restart command today, I thought "why don't I create a filterscript that lets the server owner set it up easier?" This idea bugged me until I got out of bed and started scripting.

The Script
This was, by far, my favorite script to write because I have not seen this anywhere before. This script is completely original, and it is mine. Don't take it as your own. I wrote this script to be customizable by the user and easy to use for anyone. While the script looks noobish and simple at best, there is NO other filterscript like it.

The script is TINY and has a nice settings setup for server owners. When restarting the server, it also restarts every filterscript in live time. If you were to edit a filterscript and restart the server, your filterscript would be updated as well. The ONLY filterscript not able to be updated is THIS filterscript, which causes the server to crash. To update the restart filterscript, make changes as necessary, then type the command "/rcon reloadfs restart" and the filterscript will update for your use.

The command to restart your server is "/restart" which is an Rcon only command. You don't have to type "/rcon restart," you just have to be logged into rcon to type "/restart."

If you are interested in the script, here it is:
pawn Код:
#define FILTERSCRIPT
#define COLOR_RED 0xFF0606FF
#include <a_samp>
#include <zcmd>
//==========================================//
// Server Restart Command filterscript
// by Aerotactics
//==========================================//

//SETTINGS
#define TIME 3 // In Seconds, the time before the server restarts.
new FS[][] =
{
    "filterscript1",
    "filterscript2",
    "filterscript3"
};
// Add each of your filterscript's names in this section. Be sure that
// the last item in the list does NOT have a comma, and DO NOT add
// the filterscript "restart" as it will crash your server.
// Therefor, the only filterscript you can't update live is this one.
//==========================================//
new restartcheck = 0;
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print("\n------------------------------------------");
    print("Server Restart Filterscript by Aerotactics");
    print("------------------------------------------\n");
    return 1;
}
#endif
CMD:restart(playerid, params[])
{
    if (!IsPlayerAdmin(playerid)) return 0;
    if (restartcheck == 1) return SendClientMessage(playerid,COLOR_RED,"The server is already restarting!");
    restartcheck = 1;
    new string[36];
    format(string,sizeof(string),"Server is restarting in %i seconds.",TIME);
    SendClientMessageToAll(COLOR_RED,string);
    SetTimer("ServerRestart", TIME*1000, 0);
    return 1;
}
forward ServerRestart();
public ServerRestart()
{
    SendRconCommand("gmx");
    for(new i = 0; i <sizeof(FS); i++)
    {
        new string[32];
        format(string,sizeof(string),"reloadfs %s",FS[i]);
        SendRconCommand(string);
    }
    restartcheck = 0;
    return 1;
}
Download the Filterscript here: Mediafire

Compile it in Pawno and add it under filterscripts in your server.cfg

If you like it, show your thanks by giving me rep. Thank you for your time.


Warnings
-the server might crash if you try to restart while someone else is uploading files via FTP.
-To fix the object duplication due to GMX, you must add this script to your map filterscript (or whatever script your map is located in):
pawn Код:
public OnGameModeExit()
{
    for(new i; i<MAX_OBJECTS; i++)
    {
        if(IsValidObject(i)){DestroyObject(i);}
    }
}
Conclusion
My partner and I have implemented this filterscript in our server and use it constantly. It is extremely handy for bugfixing and restarting constantly in development. Thanks for downloading!
Reply


Messages In This Thread
Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 23.02.2014, 11:04
Re: Server Restart Command for Rcon Admins - The first of its kind! - by jueix - 23.02.2014, 13:06
Re: Server Restart Command for Rcon Admins - The first of its kind! - by LeGGGeNNdA - 23.02.2014, 13:11
Re : Server Restart Command for Rcon Admins - The first of its kind! - by FosterK - 23.02.2014, 14:04
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 23.02.2014, 17:57
Respuesta: Server Restart Command for Rcon Admins - The first of its kind! - by Gryphus One - 24.02.2014, 20:59
Re: Server Restart Command for Rcon Admins - The first of its kind! - by biker122 - 25.02.2014, 09:42
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Hax0rm - 25.02.2014, 09:43
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 02.03.2014, 18:28
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 31.03.2014, 00:16
Re: Server Restart Command for Rcon Admins - The first of its kind! - by TDM - 31.03.2014, 00:52
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Pottus - 31.03.2014, 01:05
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 31.03.2014, 07:01
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Team_PRO - 31.03.2014, 12:01
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Pottus - 02.04.2014, 12:08
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 14.04.2014, 13:15
Re: Server Restart Command for Rcon Admins - The first of its kind! - by sterling123 - 14.04.2014, 22:36
Re: Server Restart Command for Rcon Admins - The first of its kind! - by burke1234 - 15.04.2014, 16:41
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 15.04.2014, 16:53
Re: Server Restart Command for Rcon Admins - The first of its kind! - by iRaiDeN - 15.04.2014, 18:37
Re: Server Restart Command for Rcon Admins - The first of its kind! - by SForever - 15.04.2014, 21:20
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 16.04.2014, 00:10
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 04.05.2014, 17:36
Re: Server Restart Command for Rcon Admins - The first of its kind! - by iRaiDeN - 04.05.2014, 17:37
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Calgon - 04.05.2014, 17:38
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 07.05.2014, 05:52
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 02.06.2014, 08:19
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Calgon - 02.06.2014, 08:30
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Aerotactics - 02.06.2014, 22:16
Re: Server Restart Command for Rcon Admins - The first of its kind! - by Godde - 20.02.2015, 13:21

Forum Jump:


Users browsing this thread: 2 Guest(s)