diff --git a/UptimeRestarts/scripting/UptimeRestarts.sp b/UptimeRestarts/scripting/UptimeRestarts.sp index 1e72d87f..f7df35cf 100644 --- a/UptimeRestarts/scripting/UptimeRestarts.sp +++ b/UptimeRestarts/scripting/UptimeRestarts.sp @@ -17,11 +17,8 @@ public Plugin myinfo = public void OnPluginStart() { - RegAdminCmd("uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime since last Crash"); - RegAdminCmd("sm_uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime since last Crash"); - - RegAdminCmd("realuptime", Command_RealUptime, ADMFLAG_RCON, "Displays server Uptime since last controlled Restart/Crash"); - RegAdminCmd("sm_realuptime", Command_RealUptime, ADMFLAG_RCON, "Displays server Uptime since last controlled Restart/Crash"); + RegAdminCmd("uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime"); + RegAdminCmd("sm_uptime", Command_Uptime, ADMFLAG_GENERIC, "Displays server Uptime"); g_iRestartCountdown = 5; GetUptimeIfControlledRestart(); @@ -46,34 +43,8 @@ public void GetUptimeIfControlledRestart() } public Action Command_Uptime(int client, int args) -{ - float fUptime = GetEngineTime() + g_fUptime; - - char sUptime[64]; - int iUptime = RoundFloat(fUptime); - - int iDays = (iUptime / 86400); - int iHours = (iUptime / 3600) % 24; - int iMinutes = (iUptime / 60) % 60; - int iSeconds = (iUptime % 60); - - if (iDays) - Format(sUptime, sizeof(sUptime), "%d Days %d Hours %d Minutes %d Seconds.", iDays, iHours, iMinutes, iSeconds); - else if (iHours) - Format(sUptime, sizeof(sUptime), "%d Hours %d Minutes %d Seconds.", iHours, iMinutes, iSeconds); - else if (iMinutes) - Format(sUptime, sizeof(sUptime), "%d Minutes %d Seconds.", iMinutes, iSeconds); - else - Format(sUptime, sizeof(sUptime), "%d Seconds.", iSeconds); - - ReplyToCommand(client, "[SM] Server Uptime: %s", sUptime); - return Plugin_Handled; -} - -public Action Command_RealUptime(int client, int args) { float fUptime = GetEngineTime(); - char sUptime[64]; int iUptime = RoundFloat(fUptime); @@ -91,7 +62,26 @@ public Action Command_RealUptime(int client, int args) else Format(sUptime, sizeof(sUptime), "%d Seconds.", iSeconds); - ReplyToCommand(client, "[SM] Server Uptime since last controlled restart/crash: %s", sUptime); + ReplyToCommand(client, "[SM] Real Server Uptime: %s", sUptime); + + fUptime = GetEngineTime() + g_fUptime; + iUptime = RoundFloat(fUptime); + + iDays = (iUptime / 86400); + iHours = (iUptime / 3600) % 24; + iMinutes = (iUptime / 60) % 60; + iSeconds = (iUptime % 60); + + if (iDays) + Format(sUptime, sizeof(sUptime), "%d Days %d Hours %d Minutes %d Seconds.", iDays, iHours, iMinutes, iSeconds); + else if (iHours) + Format(sUptime, sizeof(sUptime), "%d Hours %d Minutes %d Seconds.", iHours, iMinutes, iSeconds); + else if (iMinutes) + Format(sUptime, sizeof(sUptime), "%d Minutes %d Seconds.", iMinutes, iSeconds); + else + Format(sUptime, sizeof(sUptime), "%d Seconds.", iSeconds); + + ReplyToCommand(client, "[SM] Cumulative Server Uptime: %s", sUptime); return Plugin_Handled; }