From b6a452caea3fd579c633ed548462a01973efae0c Mon Sep 17 00:00:00 2001
From: neon <>
Date: Mon, 23 Sep 2019 17:58:38 +0200
Subject: [PATCH] adding FPSMaxEnforce

---
 FPSMaxEnforce/scripting/FPSMaxEnforce.sp | 49 ++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 FPSMaxEnforce/scripting/FPSMaxEnforce.sp

diff --git a/FPSMaxEnforce/scripting/FPSMaxEnforce.sp b/FPSMaxEnforce/scripting/FPSMaxEnforce.sp
new file mode 100644
index 00000000..728be183
--- /dev/null
+++ b/FPSMaxEnforce/scripting/FPSMaxEnforce.sp
@@ -0,0 +1,49 @@
+#include <sourcemod>
+
+#pragma semicolon 1
+#pragma newdecls required
+
+//----------------------------------------------------------------------------------------------------
+// Purpose:
+//----------------------------------------------------------------------------------------------------
+public Plugin myinfo =
+{
+	name         = "FPSMaxEnforce",
+	author       = "Neon (i decompiled it, now its mine!)",
+	description  = "",
+	version      = "1.0.0",
+	url 		= "https://steamcommunity.com/id/n3ontm"
+};
+
+//----------------------------------------------------------------------------------------------------
+// Purpose:
+//----------------------------------------------------------------------------------------------------
+public void OnPluginStart()
+{
+	HookEvent("player_spawn", OnClientSpawn);
+}
+
+//----------------------------------------------------------------------------------------------------
+// Purpose:
+//----------------------------------------------------------------------------------------------------
+public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast)
+{
+	int client = GetClientOfUserId(hEvent.GetInt("userid"));
+	QueryClientConVar(client, "fps_max", OnConVarQueryFinished);
+}
+
+//----------------------------------------------------------------------------------------------------
+// Purpose:
+//----------------------------------------------------------------------------------------------------
+public void OnConVarQueryFinished(QueryCookie cookie, int client, ConVarQueryResult result, const char[] cvarName, const char[] cvarValue)
+{
+	if (!IsClientInGame(client))
+		return;
+
+	if (result != ConVarQuery_Okay)
+		LogError("Could not query ConVar \"cvarName\" for %N", client);
+
+	if (StringToInt(cvarValue) < 58)
+		KickClient(client, "Your fps_max is invalid, please set it to a higher value (>59)");
+
+}
\ No newline at end of file