View Single Post
edward.81
Junior Member
Join Date: Apr 2008
Old 07-22-2008 , 15:40   Re: AFK Manager
Reply With Quote #16

Thx for this plugin.
1.1 hare working very well in my server. now i try this new version.
But i have made a little change in the code for logging plugin action.

Code:
HandleAFKClient(client)
{
    new Float:f_SpecTime = GetConVarFloat(g_Cvar_TimeToMove) / 10.0;
    new Float:f_KickTime = GetConVarFloat(g_Cvar_TimeToKick) / 10.0;

    if(GetConVarInt(g_Cvar_MoveSpec) == 1 
        && g_TimeAFK[client] < f_KickTime 
        && g_TimeAFK[client] > f_SpecTime)
    {
        new f_Team = GetClientTeam(client);

        if(f_Team > 1){
            ChangeClientTeam(client, 1); // 1 == spec on TF2 and CSS
            LogAction(client, -1, "%L moved to spectator. (%i Players)", client, GetClientCount());
            return;
        }
    }

    if(((GetConVarInt(g_Cvar_MoveSpec) == 0
        && g_TimeAFK[client] >= f_SpecTime)
        || g_TimeAFK[client] >= f_KickTime)
        && !IsAdmin(client))
    {
        LogAction(client, -1, "%L kick for AFK. (%i Players)", client, GetClientCount());
        KickClient(client, "You were AFK for too long.");
    }
}
edward.81 is offline