#include <sourcemod>
#include <profiler>
#include <sdktools>
#define CHECKLIMIT 3
#include <csgo_colors>
new Handle:g_hCvarMethod;
new g_iMethod = 1;
new g_PlayerTime[MAXPLAYERS+1];
new g_PlayerLimit[MAXPLAYERS+1];
public Plugin:myinfo =
{
name = "Block +left and +right",
author = "Afronanny, Impact, 0-BuTaJIuK-0",
description = "Block +left and +right",
version = "1.2",
url = "vk.com/butagames"
}
public OnPluginStart()
{
g_hCvarMethod = CreateConVar("sm_leftright_method", "2", "1 for block, 2 for kick");
HookConVarChange(g_hCvarMethod, ConVarChanged_Method);
g_iMethod = GetConVarInt(g_hCvarMethod);
}
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
if(buttons & IN_LEFT || buttons & IN_RIGHT)
{
switch(g_iMethod)
{
case 1:
{
// Gets the GameTime
new acttime = GetTime();
// Only if some time has passed
if(g_PlayerTime[client] < acttime-1)
{
// Increase the amount..
g_PlayerLimit[client]++;
// If used too often
if(g_PlayerLimit[client] >= CHECKLIMIT)
{
// ServerCommand("sm_stop");
FakeClientCommandEx(client, "say /stop");
PrintToChat(client, "\x03 Your time has been stopped due to a +left/right script")
// Reset the limit
g_PlayerLimit[client] = 0;
}
// Sets the clients time
g_PlayerTime[client] = acttime;
}
}
case 2:
{
if(IsClientInGame(client) && !IsFakeClient(client) && IsPlayerAlive(client))
{
ForcePlayerSuicide(client);
ChangeClientTeam(client, 1);
CGOPrintToChat(client, "{GRAY}[{LIGHTBLUE}СЕРВЕР{GRAY}]{LIGHTGREEN} Ты позорище со скриптами");
}
}
}
}
}
public ConVarChanged_Method(Handle:convar, const String:oldValue[], const String:newValue[])
{
switch(StringToInt(newValue))
{
case 1:
{
g_iMethod = 1;
}
case 2:
{
g_iMethod = 2;
}
default:
{
g_iMethod = 2;
}
}
}