UptimeRestarts: small adjustements
This commit is contained in:
parent
ee131275b7
commit
44a024b078
@ -11,17 +11,17 @@ public Plugin myinfo =
|
|||||||
name = "UptimeRestart",
|
name = "UptimeRestart",
|
||||||
author = "Dogan",
|
author = "Dogan",
|
||||||
description = "Display Server Uptime and do controlled Restarts",
|
description = "Display Server Uptime and do controlled Restarts",
|
||||||
version = "1.0.0",
|
version = "1.1.0",
|
||||||
url = ""
|
url = ""
|
||||||
};
|
};
|
||||||
|
|
||||||
public void OnPluginStart()
|
public void OnPluginStart()
|
||||||
{
|
{
|
||||||
RegAdminCmd("uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime (controlled Restarts not included)");
|
RegAdminCmd("uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime since last Crash");
|
||||||
RegAdminCmd("sm_uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime (controlled Restarts not included)");
|
RegAdminCmd("sm_uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime since last Crash");
|
||||||
|
|
||||||
RegAdminCmd("c_uptime", Command_C_Uptime, ADMFLAG_RCON, "Displays server Uptime since last controlled Restart");
|
RegAdminCmd("realuptime", Command_RealUptime, ADMFLAG_RCON, "Displays server Uptime since last controlled Restart/Crash");
|
||||||
RegAdminCmd("sm_c_uptime", Command_C_Uptime, ADMFLAG_RCON, "Displays server Uptime since last controlled Restart");
|
RegAdminCmd("sm_realuptime", Command_RealUptime, ADMFLAG_RCON, "Displays server Uptime since last controlled Restart/Crash");
|
||||||
|
|
||||||
g_iRestartCountdown = 5;
|
g_iRestartCountdown = 5;
|
||||||
GetUptimeIfControlledRestart();
|
GetUptimeIfControlledRestart();
|
||||||
@ -33,7 +33,7 @@ public void GetUptimeIfControlledRestart()
|
|||||||
{
|
{
|
||||||
File UptimeFile = OpenFile("uptime.txt", "r");
|
File UptimeFile = OpenFile("uptime.txt", "r");
|
||||||
|
|
||||||
if(UptimeFile != null)
|
if(UptimeFile != null)//Server was restarted automatically by this plugin
|
||||||
{
|
{
|
||||||
char sUptime[64];
|
char sUptime[64];
|
||||||
UptimeFile.ReadLine(sUptime, sizeof(sUptime));
|
UptimeFile.ReadLine(sUptime, sizeof(sUptime));
|
||||||
@ -41,6 +41,8 @@ public void GetUptimeIfControlledRestart()
|
|||||||
delete UptimeFile;
|
delete UptimeFile;
|
||||||
DeleteFile("uptime.txt");
|
DeleteFile("uptime.txt");
|
||||||
}
|
}
|
||||||
|
else//Server crashed or restarted manually
|
||||||
|
LogToFile("addons/sourcemod/logs/restarts.txt", "Server crashed or was restarted manually.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Command_Uptime(int client, int args)
|
public Action Command_Uptime(int client, int args)
|
||||||
@ -68,7 +70,7 @@ public Action Command_Uptime(int client, int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action Command_C_Uptime(int client, int args)
|
public Action Command_RealUptime(int client, int args)
|
||||||
{
|
{
|
||||||
float fUptime = GetEngineTime();
|
float fUptime = GetEngineTime();
|
||||||
|
|
||||||
@ -89,13 +91,13 @@ public Action Command_C_Uptime(int client, int args)
|
|||||||
else
|
else
|
||||||
Format(sUptime, sizeof(sUptime), "%d Seconds.", iSeconds);
|
Format(sUptime, sizeof(sUptime), "%d Seconds.", iSeconds);
|
||||||
|
|
||||||
ReplyToCommand(client, "[SM] Server Uptime since last controlled restart: %s", sUptime);
|
ReplyToCommand(client, "[SM] Server Uptime since last controlled restart/crash: %s", sUptime);
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action CheckRestart(Handle timer)
|
public Action CheckRestart(Handle timer)
|
||||||
{
|
{
|
||||||
if(!IsItRestartTime)
|
if(!IsItRestartTime())
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
|
|
||||||
if(GetEngineTime() < 57500) //16 hours
|
if(GetEngineTime() < 57500) //16 hours
|
||||||
|
Loading…
Reference in New Issue
Block a user