#include <amxmodx>
#include <fakemeta>
++#define MAX_BADWARNINGS 3
++#define MAX_BADFPS 105
public plugin_init()
{
register_plugin("Fps Checker", "0.1", "Dev-CS.ru")
register_forward(FM_PlayerPreThink, "PreThink");
}
new Fps[33];
new Float:LastCheck[33];
new Frames[33];
new Warnings[33];
public client_connect(id)
{
Warnings[id] = 0;
LastCheck[id] = 0.0;
}
public PreThink(id)
{
if(LastCheck[id] <= get_gametime())
{
Fps[id] = Frames[id];
-- if(Fps[id] > 101)
++ if(Fps[id] > MAX_BADFPS)
{
-- if(++Warnings[id] > 3)
++ if(++Warnings[id] > MAX_BADWARNINGS)
{
++ kick_user(id, "Bad fps");
}
}
++ else
++ {
++ Warnings[id] = 0;
++ }
Frames[id] = 0;
LastCheck[id] = get_gametime() + 1.0;
}
Frames[id]++;
}
stock kick_user(id, szReason[])
{
new iUserId = get_user_userid(id);
server_cmd("kick #%d ^"%s^"", iUserId, szReason)
return 1
}