#pragma semicolon 1
#pragma newdecls required
#include <sdkhooks>
bool
bBlock,
bLate;
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
bLate = late;
}
public void OnPluginStart()
{
if(!bLate) return;
for(int i = 1; i <= MaxClients; i++) if(IsClientInGame(i)) OnClientPostAdminCheck(i);
}
public void OnMapStart()
{
char buffer[64];
GetCurrentMap(buffer, sizeof(buffer));
bBlock = StrContains(buffer, "$2000$", false) != -1;
}
public void OnClientPostAdminCheck(int client)
{
if(bBlock && !IsFakeClient(client)) SDKHook(client, SDKHook_WeaponEquip, Hook_Equip);
}
public Action Hook_Equip(int client, int wpn)
{
static char cls[18];
GetEntityClassname(wpn, cls, sizeof(cls));
return IsAllowedWeapon(client, cls[7]);
}
public Action CS_OnBuyCommand(int client, const char[] weapon)
{
return bBlock ? IsAllowedWeapon(client, weapon) : Plugin_Continue;
}
stock Action IsAllowedWeapon(int client, const char[] wpn)
{
if(strcmp(wpn, "flashbang", false) && strcmp(wpn, "hegrenade", false) && strcmp(wpn, "smokegrenade", false))
return Plugin_Continue;
PrintToChat(client, "Гранаты на этой карте запрещены.");
return Plugin_Handled;
}