Slay Afk

zer0

Участник
Сообщения
178
Реакции
27
Не работает плагин, помогите настроить чтобы живых афк игроков убивало за х секунд
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define PLUGIN_VERSION "0.1"

public Plugin myinfo =
{
name = "Kill AFK's",
author = "DeweY",
version = PLUGIN_VERSION,
description = "Kills AFK's after 5 seconds.",
url = "Omega Gaming"
};

Handle timer_afkicker[MAXPLAYERS+1] = null;

public void OnPluginStart()
{
HookEvent("player_spawned", Event_Spawn, EventHookMode_Post);
HookEvent("round_end", Event_RoundEnd, EventHookMode_Post);
}

public Action Event_Spawn(Handle event, const char[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));

if (!IsValidClient(client, false))
{
return;
}

if ((GetClientTeam(client) == 2 || GetClientTeam(client) == 3) && timer_afkicker[client]== null) //Only activate if they're on CT or T and the timer isn't already started.
{
timer_afkicker[client] = CreateTimer(5.0, Timer_CheckClients, GetClientUserId(client));
}
}

public Action Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
{
ServerCommand("sm_slay @alive");
}

public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{
if (timer_afkicker[client] != null)
{
KillTimer(timer_afkicker[client], false);
timer_afkicker[client] = null;
}
}

public Action Timer_CheckClients(Handle timer, any data)
{
int client = GetClientOfUserId(data);

if (GetClientTeam(client) == 2 || GetClientTeam(client) == 3)
{
ForcePlayerSuicide(client);
}
}

bool IsValidClient(int client, bool bAllowBots = false)
{
if(!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots))
{
return false;
}
return true;
}
 
Сверху Снизу