Code: Select all
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <levels>
new menu
new xp
public plugin_init()
{
register_plugin("Zombie Escape Nades Shop", "1.1", "Raheem")
register_clcmd("grshop","ShowMenu")
}
public ShowMenu(id)
{
menu = menu_create( "\yExtra-Item\w: \rOthers", "menu_handler" )
menu_additem( menu, "Fire Nade \yx3 \r40 XP\R\dH", "", 0 )
menu_additem( menu, "Frost Nade \yx2 \r80 XP\R\dH", "", 0 )
menu_additem( menu, "Unlimited Clip \r80 XP\R\dH", "", 0 )
menu_additem( menu, "Madness \r100 XP\R\dZ", "", 0 )
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
menu_display( id, menu, 0 )
}
public menu_handler(id, menu, item)
{
xp = get_user_xp(id)
switch(item)
{
case 0:
{
if ((xp >= 40) && is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT))
{
give_item( id, "weapon_hegrenade" )
set_user_xp(id, get_user_xp(id) - 40)
cs_set_user_bpammo(id, CSW_HEGRENADE, 3)
client_print_color(id, "!y[!gZombie Escape!y] !tYou have bought 3 Fire Nades!y.")
}
else if ((xp >= 40) && !is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT))
{
client_print_color(id, "!y[!gZombie Escape!y] !tTo buy Fire Nades You need to be alive!y!")
}
else if (xp <= 40 && is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT))
{
client_print_color(id, "!y[!gZombie Escape!y] !tYou don't have enough XP!y.")
}
else if(cs_get_user_team(id) == CS_TEAM_T)
{
client_print_color(id, "!y[!gZombie Escape!y] !tThis Item for Humans only!y.")
}
else
{
return PLUGIN_HANDLED
}
}
case 1:
{
if ((xp >= 80) && is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT))
{
give_item( id, "weapon_smokegrenade" )
set_user_xp(id, get_user_xp(id) - 80)
cs_set_user_bpammo(id, CSW_SMOKEGRENADE, 2)
client_print_color(id, "!y[!gZombie Escape!y] !tYou have bought 2 Frost Nades!y.")
}
else if (xp >= 80 && !is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT))
{
client_print_color(id, "!y[!gZombie Escape!y] !tTo buy Frost Nades You need to be alive!y!")
}
else if (xp <= 80 && is_user_alive(id) && (cs_get_user_team(id) == CS_TEAM_CT))
{
client_print_color(id, "!y[!gZombie Escape!y] !tYou don't have enough XP!y.")
}
else if(cs_get_user_team(id) == CS_TEAM_T)
{
client_print_color(id, "!y[!gZombie Escape!y] !tThis Item for Humans only!y.")
}
else
{
return PLUGIN_HANDLED
}
}
case 2:
{
client_cmd(id, "unlimitedclip")
}
case 3:
{
client_cmd(id, "madness")
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
stock client_print_color(const id, const input[], any:...)
{
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!g", "^x04"); // Green Color
replace_all(msg, 190, "!y", "^x01"); // Default Color
replace_all(msg, 190, "!t", "^x03"); // Team Color
if (id) players[0] = id; else get_players(players, count, "ch");
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}