Код за потвърждение: Избери целия код
#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <cstrike>
#define PLUGIN "AFK: Transfer Spec"
#define VERSION "1.8.2"
#define AUTHOR "Wilian M."
#define TASK_AFK 10092017
new xCvarTimeAfk
new g_isalive[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
xCvarTimeAfk = register_cvar("afkt_parado_tempo", "45")
RegisterHam(Ham_Spawn, "player", "fw_playerspawn_post", 1)
RegisterHam(Ham_Killed, "player", "fw_playerkilled")
}
public client_disconnected(id)
{
if(task_exists(id+TASK_AFK)) remove_task(id+TASK_AFK)
g_isalive[id] = false
}
public fw_playerspawn_post(id) g_isalive[id] = true
public fw_playerkilled(victim, attacker, shouldgib) g_isalive[victim] = false
public client_PostThink(id)
{
if(check_alive_ok(id))
{
new button = get_user_button(id)
if(button & IN_ATTACK || button & IN_ATTACK2 || button & IN_BACK || button & IN_FORWARD || button & IN_RUN
|| button & IN_JUMP || button & IN_MOVELEFT || button & IN_MOVERIGHT || button & IN_LEFT || button & IN_RIGHT)
{
if(task_exists(id+TASK_AFK))
{
remove_task(id+TASK_AFK)
}
}
else
{
if(!task_exists(id+TASK_AFK))
{
set_task(float(get_pcvar_num(xCvarTimeAfk)), "xTransferPlayerSpec", id+TASK_AFK)
}
}
}
}
public xTransferPlayerSpec(id)
{
id -= TASK_AFK
if(check_alive_ok(id))
{
new xName[32]; get_user_name(id, xName, 31);
set_hudmessage(255, 100, 050, -1.0, 0.62, 0, 6.0, 5.0, 0.1, 0.2)
show_hudmessage(0, "Player [ %s ] e premesten kum SPEC !^n!! Prichina: AFK !!.", xName)
user_silentkill(id)
cs_set_user_team(id, CS_TEAM_UNASSIGNED)
}
remove_task(id+TASK_AFK)
}
stock check_alive_ok(id)
{
if(g_isalive[id] && (get_user_team(id) == 1 || get_user_team(id) == 2) && is_user_connected(id))
return 1;
return 0;
}