#include <sourcemod>
#define PLUGIN_NAME "MinFPS"
#define PLUGIN_AUTHOR "Tony G."
#define PLUGIN_DESCRIPTION "Kicks a player if his/her fps_max convar value is below the value of 72."
#define PLUGIN_VERSION "1.0"
#define PLUGIN_URL "http://www.sourcemod.net/"
public Plugin:myinfo = {name = PLUGIN_NAME, author = PLUGIN_AUTHOR, description = PLUGIN_DESCRIPTION, version = PLUGIN_VERSION, url = PLUGIN_URL};
public OnPluginStart()
{
CreateConVar("sm_minfps_version", PLUGIN_VERSION, "MinFPS", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
CreateTimer(10.0, TriggerFPSCheck, _, TIMER_REPEAT);
}
public OnClientPostAdminCheck(client)
{
QueryClientConVar(client, "fps_max", ConVarQueryFinished:FPSCheck, client);
}
public Action:TriggerFPSCheck(Handle:timer)
{
for (new client = 1; client <= MaxClients; client++)
{
if (IsClientInGame(client) && !IsClientObserver(client))
{
QueryClientConVar(client, "fps_max", ConVarQueryFinished:FPSCheck, client);
}
}
return Plugin_Continue;
}
public FPSCheck(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
if (IsClientConnected(client))
{
new fps_max = StringToInt(cvarValue);
if (fps_max < 72 && fps_max != 0)
{
KickClient(client, "Please set your fps_max value to at least 72");
}
}
}