I would do something like this:
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <cstrike>
#include <sdktools_gamerules>
static const char WPN[][] = {"ump45", "p90", "mp9", "mp7", "mp5sd", "mac10", "bizon", "ssg08", "sg556", "scar20", "m4a1_silencer", "m4a1", "galilar", "g3sg1", "famas", "awp", "aug", "ak47", "xm1014", "sawedoff", "nova", "negev", "mag7", "m249"};
bool bBlock;
public void OnPluginStart()
{
HookEvent("round_start", Event_Start, EventHookMode_PostNoCopy);
CheckRoundNum();
}
public void Event_Start(Event event, const char[] name, bool dontBroadcast)
{
CheckRoundNum();
}
stock void CheckRoundNum()
{
int round = GameRules_GetProp("m_totalRoundsPlayed");
bBlock = round == 0 || round == 15;
PrintToChatAll("%s allowed", bBlock ? "Only pistols" : "All guns are");
}
public Action CS_OnBuyCommand(int client, const char[] weapon)
{
if(!bBlock)
return Plugin_Continue;
for(int i; i < sizeof(WPN); i++) if(!strcmp(weapon, WPN[i]))
{
PrintToChat(client, "'You're rich BUT I FORBID YOU TO BUY' - shadowbringer.");
return Plugin_Handled;
}
return Plugin_Continue;
}
__________________