#include #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 fps_max for %N", client); int len = strlen(cvarValue); for (int i = 0; i < len; i++) { if (!IsCharNumeric(cvarValue[i])) { KickClient(client, "Invalid fps_max Format"); return; } } //fps_max 0 is probably acceptable if (StringToInt(cvarValue) == 0) return; if (StringToInt(cvarValue) < 58) KickClient(client, "Your fps_max is invalid, please set it to a higher value (>59)"); }