In the past, players on my server often used the+duck command to avoid Idle KICK. This plug-in has helped me solve this problem.
But recently I found some problems with this plug-in.
In some maps, players are forced to squat down. Even if they are not in the AFK state, the plug-in will also think that the player is in the AFK state to execute the KICK. Is there any way to solve this problem?
PHP Code:
#include <sourcemod>
int g_iTurnBind[MAXPLAYERS+1], g_iCD[MAXPLAYERS+1];
public Plugin myinfo =
{
name = "Turnbind Restrictor",
author = "Cruze",
description = "Kicks the player if player uses turn jump, duck, left, or right bind for more than 15 seconds.",
version = "1.3",
url = "http://steamcommunity.com/profiles/76561198132924835"
};
public void OnClientPostAdminCheck(int client)
{
g_iTurnBind[client] = 120;
if(!IsFakeClient(client))
{
CreateTimer(1.0, Timer_CheckTurnBind, client, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
}
public Action Timer_CheckTurnBind(Handle timer, int client)
{
if(!client || !IsClientInGame(client))
{
return Plugin_Stop;
}
if(!IsPlayerAlive(client))
{
return Plugin_Continue;
}
int buttons = GetClientButtons(client)
if(buttons & IN_LEFT || buttons & IN_RIGHT || buttons & IN_DUCK || buttons & IN_JUMP || buttons & IN_ATTACK)
{
DisplayMSG(client);
g_iTurnBind[client]--;
}
else
{
g_iTurnBind[client] = 120;
}
if(g_iTurnBind[client] <= 0)
{
KickClient(client, "Idle");
}
return Plugin_Continue;
}
void DisplayMSG(int client)
{
if(g_iCD[client] <= GetTime())
{
g_iCD[client] = GetTime()+15;
PrintToChat(client, "", g_iTurnBind[client]);
}
}