PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <zombie_plague_advance>
#define PLUGIN "[ZP] Pack Assasin,Survivor,Nemesis,Sniper"
#define VERSION "2.1"
#define AUTHOR "Ghost95V"
#define ZP_TEAM_HUMAN (1<<1)
new const g_item_nem_name[] = "Buy Nemesis"
new const g_item_sur_name[] = "Buy Survivor"
new const g_item_assassin_name[] = "Buy Assassin"
new const g_item_sniper_name[] = "Buy Sniper"
new const g_costnemesis = 155
new const g_costsurvivor = 300
new const g_costsniper = 300
new const g_costassassin = 155
new g_maxplayers, g_msgSayText
new g_nemesis, g_survivor, g_assassin, g_sniper
new g_buyable, g_endround, RoundCount, cvar_delay
new has_moded[33]
new g_can
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_logevent("logevent_round_end", 2, "1=Round_End")
g_nemesis = zp_register_extra_item(g_item_nem_name, g_costnemesis, ZP_TEAM_HUMAN)
g_survivor = zp_register_extra_item(g_item_sur_name, g_costsurvivor, ZP_TEAM_HUMAN)
g_assassin = zp_register_extra_item(g_item_assassin_name, g_costassassin, ZP_TEAM_HUMAN)
g_sniper = zp_register_extra_item(g_item_sniper_name, g_costsniper, ZP_TEAM_HUMAN)
cvar_delay = register_cvar("zp_buy_classes_delay", "3")
g_maxplayers = get_maxplayers()
g_msgSayText = get_user_msgid("SayText")
}
public zp_extra_item_selected(player, itemid)
{
if(itemid == g_nemesis)
{
if (!g_can)
{
zp_colored_print(player, "^x04[ZP]^x01 Bug Prevention")
return PLUGIN_HANDLED;
}
if (!g_buyable)
{
if (RoundCount == get_pcvar_num(cvar_delay))
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 one^x01 more round before you can buy this item")
}
else
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 %d^x01 rounds until you can buy this item", get_pcvar_num(cvar_delay) - RoundCount + 1)
}
return ZP_PLUGIN_HANDLED;
}
if (zp_has_round_started() == 1 || g_endround)
{
zp_colored_print(player, "^x04[ZP]^x01 This item can only be bought before the round mode starts")
return ZP_PLUGIN_HANDLED;
}
if (has_moded[player])
{
zp_colored_print(player, "^x04[ZP]^x01 You only can buy mode^x04 once^x01 in a map")
return ZP_PLUGIN_HANDLED;
}
zp_make_user_nemesis(player)
new name[32]
get_user_name(player, name, charsmax(name))
zp_colored_print(0, "^x04[ReverseZM]^x03 %s^x01 has bought^x04 Nemesis", name)
has_moded[player] = true
g_buyable = false
}
else if(itemid == g_survivor)
{
if (!g_buyable)
{
if (RoundCount == get_pcvar_num(cvar_delay))
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 one^x01 more round before you can buy this item")
}
else
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 %d^x01 rounds until you can buy this item", get_pcvar_num(cvar_delay) - RoundCount + 1)
}
return ZP_PLUGIN_HANDLED;
}
if (zp_has_round_started() == 1 || g_endround)
{
zp_colored_print(player, "^x04[ZP]^x01 This item can only be bought before the round mode starts")
return ZP_PLUGIN_HANDLED;
}
if (has_moded[player])
{
zp_colored_print(player, "^x04[ZP]^x01 You only can buy mode^x04 once^x01 in a map")
return ZP_PLUGIN_HANDLED;
}
zp_make_user_survivor(player)
new name[32]
get_user_name(player, name, charsmax(name))
zp_colored_print(0, "^x04[ReverseZM]^x03 %s^x01 has bought^x04 Survivor", name)
has_moded[player] = true
g_buyable = false
}
else if(itemid == g_assassin)
{
if (!g_buyable)
{
if (RoundCount == get_pcvar_num(cvar_delay))
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 one^x01 more round before you can buy this item")
}
else
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 %d^x01 rounds until you can buy this item", get_pcvar_num(cvar_delay) - RoundCount + 1)
}
return ZP_PLUGIN_HANDLED;
}
if (zp_has_round_started() == 1 || g_endround)
{
zp_colored_print(player, "^x04[ZP]^x01 This item can only be bought before the round mode starts")
return ZP_PLUGIN_HANDLED;
}
if (has_moded[player])
{
zp_colored_print(player, "^x04[ZP]^x01 You only can buy mode^x04 once^x01 in a map")
return ZP_PLUGIN_HANDLED;
}
zp_make_user_assassin(player)
new name[32]
get_user_name(player, name, charsmax(name))
zp_colored_print(0, "^x04[ReverseZM]^x03 %s^x01 has bought^x04 Assassin", name)
has_moded[player] = true
g_buyable = false
}
else if(itemid == g_sniper)
{
if (!g_buyable)
{
if (RoundCount == get_pcvar_num(cvar_delay))
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 one^x01 more round before you can buy this item")
}
else
{
zp_colored_print(player, "^x04[ZP]^x01 You have to wait^x04 %d^x01 rounds until you can buy this item", get_pcvar_num(cvar_delay) - RoundCount + 1)
}
return ZP_PLUGIN_HANDLED;
}
if (zp_has_round_started() == 1 || g_endround)
{
zp_colored_print(player, "^x04[ZP]^x01 This item can only be bought before the round mode starts")
return ZP_PLUGIN_HANDLED;
}
if (has_moded[player])
{
zp_colored_print(player, "^x04[ZP]^x01 You only can buy mode^x04 once^x01 in a map")
return ZP_PLUGIN_HANDLED;
}
zp_make_user_sniper(player)
new name[32]
get_user_name(player, name, charsmax(name))
zp_colored_print(0, "^x04[ReverseZM]^x03 %s^x01 has bought^x04 Sniper", name)
has_moded[player] = true
g_buyable = false
}
return PLUGIN_CONTINUE
}
public event_round_start()
{
g_can = false
g_endround = false
g_buyable = true
RoundCount = 0
set_task(3.0, "enable")
}
public logevent_round_end()
{
g_endround = true
if (g_buyable)
return;
if (RoundCount < get_pcvar_num(cvar_delay))
RoundCount++
else if (RoundCount >= get_pcvar_num(cvar_delay))
{
g_buyable = true
RoundCount = 0
}
}
public enable()
{
g_can = true
}
zp_colored_print(target, const message[], any:...)
{
static buffer[512], i, argscount
argscount = numargs()
// Send to everyone
if (!target)
{
static player
for (player = 1; player <= g_maxplayers; player++)
{
// Not connected
if (!is_user_connected(player))
continue;
// Remember changed arguments
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
changedcount = 0
// Replace LANG_PLAYER with player id
for (i = 2; i < argscount; i++)
{
if (getarg(i) == LANG_PLAYER)
{
setarg(i, 0, player)
changed[changedcount] = i
changedcount++
}
}
// Format message for player
vformat(buffer, charsmax(buffer), message, 3)
// Send it
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, player)
write_byte(player)
write_string(buffer)
message_end()
// Replace back player id's with LANG_PLAYER
for (i = 0; i < changedcount; i++)
setarg(changed[i], 0, LANG_PLAYER)
}
}
// Send to specific target
else
{
// Format message for player
vformat(buffer, charsmax(buffer), message, 3)
// Send it
message_begin(MSG_ONE, g_msgSayText, _, target)
write_byte(target)
write_string(buffer)
message_end()
}
}