PHP Code:
#include <amxmodx>
#include <engine>
#include <fun>
#include <cstrike>
#include <hamsandwich>
enum _:g_eWeaponData {
_NameForChat[32],
_WeaponName[32],
_Ammo,
_CSW
}
new const g_szSecondary[][g_eWeaponData] = {
{"Glock18", "weapon_glock18", 240, CSW_GLOCK18},
{"Usp", "weapon_usp", 240, CSW_USP},
{"P228", "weapon_p228", 240, CSW_P228},
{"Dual Elites", "weapon_elite", 240, CSW_ELITE},
{"Fiveseven", "weapon_fiveseven", 240, CSW_FIVESEVEN},
{"Deagle", "weapon_deagle", 240, CSW_DEAGLE}
};
new RoundCount = 0;
new EnabledCvar;
new bool:IsPistolRound = false;
public plugin_init() {
register_plugin("Pistol Round", "1.0", "Uzviseni Bog");
EnabledCvar = register_cvar("amx_enable_pistolround", "1");
register_logevent("OnRoundStart", 2, "1=Round_Start");
register_clcmd("buy", "BlockBuyCommand");
register_clcmd("cl_autobuy", "BlockBuyCommand");
register_clcmd("cl_rebuy", "BlockBuyCommand");
register_clcmd("cl_setautobuy", "BlockBuyCommand");
register_clcmd("cl_setrebuy", "BlockBuyCommand");
register_clcmd("glock", "BlockBuyCommand");
register_clcmd("usp", "BlockBuyCommand");
register_clcmd("p228", "BlockBuyCommand");
register_clcmd("deagle", "BlockBuyCommand");
register_clcmd("elites", "BlockBuyCommand");
register_clcmd("fn57", "BlockBuyCommand");
register_clcmd("mp5", "BlockBuyCommand");
register_clcmd("smg", "BlockBuyCommand");
register_clcmd("mac10", "BlockBuyCommand");
register_clcmd("tmp", "BlockBuyCommand");
register_clcmd("ump45", "BlockBuyCommand");
register_clcmd("p90", "BlockBuyCommand");
register_clcmd("m3", "BlockBuyCommand");
register_clcmd("xm1014", "BlockBuyCommand");
register_clcmd("famas", "BlockBuyCommand");
register_clcmd("m4a1", "BlockBuyCommand");
register_clcmd("ak47", "BlockBuyCommand");
register_clcmd("sg552", "BlockBuyCommand");
register_clcmd("galil", "BlockBuyCommand");
register_clcmd("aug", "BlockBuyCommand");
register_clcmd("scout", "BlockBuyCommand");
register_clcmd("awp", "BlockBuyCommand");
register_clcmd("sg550", "BlockBuyCommand");
register_clcmd("g3sg1", "BlockBuyCommand");
register_clcmd("m249", "BlockBuyCommand");
register_clcmd("hegren", "BlockBuyCommand");
register_clcmd("flash", "BlockBuyCommand");
register_clcmd("sgren", "BlockBuyCommand");
register_clcmd("vest", "BlockBuyCommand");
register_clcmd("vesthelm", "BlockBuyCommand");
register_clcmd("shield", "BlockBuyCommand");
register_clcmd("buyammo1", "BlockBuyCommand");
register_clcmd("buyammo1", "BlockBuyCommand");
register_clcmd("buyequip", "BlockBuyCommand");
}
public OnRoundStart() {
if (get_pcvar_num(EnabledCvar)) {
RoundCount++;
IsPistolRound = (RoundCount % 3 == 0);
if (IsPistolRound) {
SetPistolRound();
}
}
}
public BlockBuyCommand(id) {
if (IsPistolRound) {
client_print(id, print_chat, "Buy is off");
return PLUGIN_HANDLED;
}
return PLUGIN_CONTINUE;
}
SetPistolRound() {
for (new i = 1; i <= get_maxplayers(); i++) {
if (is_user_connected(i)) {
strip_user_weapons(i);
new randomPistol = random_num(0, sizeof(g_szSecondary) - 1);
give_item(i, g_szSecondary[randomPistol][_WeaponName]);
cs_set_user_bpammo(i, g_szSecondary[randomPistol][_CSW], g_szSecondary[randomPistol][_Ammo]);
}
}
client_print(0, print_chat, "Pistol Round Started");
}