|
@@ -15,7 +15,7 @@
|
|
|
|
|
|
#pragma newdecls required
|
|
#pragma newdecls required
|
|
|
|
|
|
-#define PLUGIN_VERSION "0.1.0"
|
|
|
|
|
|
+#define PLUGIN_VERSION "0.2.0"
|
|
public Plugin myinfo = {
|
|
public Plugin myinfo = {
|
|
name = "[CSRD] Uptime Limiter",
|
|
name = "[CSRD] Uptime Limiter",
|
|
author = "nosoop",
|
|
author = "nosoop",
|
|
@@ -26,6 +26,34 @@ public Plugin myinfo = {
|
|
|
|
|
|
int g_nMaxUptimeLimit = 60 * 60 * 12;
|
|
int g_nMaxUptimeLimit = 60 * 60 * 12;
|
|
|
|
|
|
|
|
+public void OnPluginStart() {
|
|
|
|
+ RegAdminCmd("csrd_uptime", AdminCmd_GetUptime, ADMFLAG_ROOT,
|
|
|
|
+ "Outputs the server's current uptime.");
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Command to output current uptime.
|
|
|
|
+ */
|
|
|
|
+public Action AdminCmd_GetUptime(int client, int argc) {
|
|
|
|
+ char uptime[64], limit[64];
|
|
|
|
+ FormatDuration(uptime, sizeof(uptime), GetUptime());
|
|
|
|
+ FormatDuration(limit, sizeof(limit), g_nMaxUptimeLimit);
|
|
|
|
+
|
|
|
|
+ ReplyToCommand(client, "Uptime: %s (limit %s)", uptime, limit);
|
|
|
|
+
|
|
|
|
+ return Plugin_Handled;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Pretty-prints a duration of nSeconds as hours / minutes / seconds.
|
|
|
|
+ */
|
|
|
|
+void FormatDuration(char[] buffer, int maxlen, int nSeconds) {
|
|
|
|
+ Format(buffer, maxlen, "%d hours, %d minutes, %d seconds",
|
|
|
|
+ nSeconds / 3600,
|
|
|
|
+ (nSeconds % 3600) / 60,
|
|
|
|
+ nSeconds % 60);
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Called when the Waiting for Players round state begins.
|
|
* Called when the Waiting for Players round state begins.
|
|
* At least one client, human or bot, must be connected for this forward to be called.
|
|
* At least one client, human or bot, must be connected for this forward to be called.
|