new afk_max_time = 180 // Максимальное время AFK (в секундах)
new afk_kickmsg = 1 // Сообщение про кик всем в чат?
new Float:g_lastactivity[33], bool:g_is_player[33]
register_plugin("AFK Kicker in BUTTONS", "2.0", "Leo_[BH]")
register_dictionary("afk_button.txt")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
public fw_PlayerPreThink(id)
if(pev(id, pev_button) != pev(id, pev_oldbuttons))
else if(g_lastactivity[id] == 0.0)
g_lastactivity[id] = get_gametime()
public client_putinserver(id)
if(!is_user_bot(id) && !is_user_hltv(id))
set_task(TIME_CHECK, "task_afk", id + 100, _, _, "b")
public client_disconnect(id)
if(task_exists(id+100)) remove_task(id+100)
check_afktime(taskid - 100)
if (g_lastactivity[id] != 0.0)
new timeleft = floatround(g_lastactivity[id] + afk_max_time - get_gametime())
if ( 0 < timeleft <= WARNING_TIME )
client_print(id, print_chat, "%L %L", id, "AFK_PREFIX", id, "AFK_WARN_CHAT", timeleft)
set_dhudmessage(224, 224, 0, -1.0, 0.75, 2, 6.0, 2.0, 0.03, 1.0); // // // // // HUD // // // // //
show_dhudmessage(id, "%L", id, "AFK_WARN_HUD", timeleft); // // // // // HUD // // // // //
get_user_name(id, name, charsmax(name))
client_print(0, print_chat, "%L %L", id, "AFK_PREFIX", id, "AFK_MSG_CHAT_KICK", name, afk_max_time)
server_cmd("kick #%d ^"%L^" ", get_user_userid(id), id, "AFK_KICK_REASON", afk_max_time)
// Автор плагина - Leo_[BH]
// Мои плагины: http://vk.com/cs_rain
// Разработка серверов зомби-мода под заказ: https://goo.gl/forms/GIyvSAw1IJ48szDn2