PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "SURF SHOP"
#define VERSION "1.0"
#define AUTHOR "DoviuX"
/*================================================================================
[Customization]
=================================================================================*/
new const gHealth[] = "SurfShop/Health.wav"
new const gArmor[] = "SurfShop/Armor.wav"
new const gGun[] = "SurfShop/Gun.wav"
new const gNoMoney[] = "SurfShop/NoMoney.wav"
/*================================================================================
[New Variables]
=================================================================================*/
new health
new armor
new randomgun
new BoostHealth
/*================================================================================
[Init and Precache]
=================================================================================*/
public plugin_init()
{
register_plugin( PLUGIN, VERSION, AUTHOR );
register_logevent( "logevent_round_start", 2, "1=Round_Start" );
register_clcmd("say /shop", "SurfShop")
register_clcmd("say_team /shop", "SurfShop")
BoostHealth = register_cvar("amx_boost_health", "145");
health = register_cvar("price_healthbooster", "3500")
armor = register_cvar("price_armor", "2000")
randomgun = register_cvar("price_gun", "16000")
register_dictionary("surf_shop.txt");
}
/*================================================================================
[Plugin Start]
=================================================================================*/
public plugin_precache()
{
precache_sound("gHealth")
precache_sound("gArmor")
precache_sound("gGun")
precache_sound("gNoMoney")
}
public SurfShop(id)
{
new menu = menu_create("\ySurf Shop!", "menu_handler")
menu_additem(menu, "Health Booster", "1", 0)
menu_additem(menu, "Armor", "2", 0)
menu_additem(menu, "Random Gun", "3", 0)
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
}
public menu_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data, 5, iName, 63, callback)
new key = str_to_num(data)
switch(key)
{
case 1:
{
new Cost = get_pcvar_num(health);
new Money = cs_get_user_money(id);
if (Money < Cost)
{
client_print(id, print_chat, "%L", LANG_PLAYER, "NO_MONEY", Cost);
client_cmd( 0, "spk %s", gNoMoney);
return PLUGIN_HANDLED;
}
else
{
set_user_health(id, get_user_health(id) + get_pcvar_num(health));
client_print(id, print_chat, "%L", LANG_PLAYER, "HEALTH");
client_cmd( 0, "spk %s", gHealth);
Money -= Cost;
cs_set_user_money(id, Money);
}
case 2:
{
new Cost = get_pcvar_num(armor);
new Money = cs_get_user_money(id);
if (Money < Cost)
{
client_print(id, print_chat, "%L", LANG_PLAYER, "NO_MONEY", Cost);
client_cmd( 0, "spk %s", gNoMoney);
return PLUGIN_HANDLED
}
else
{
set_user_armor(id, 100)
client_print(id, print_chat, "%L", LANG_PLAYER, "ARMOR");
client_cmd( 0, "spk %s", gARMOR);
Money -= Cost;
cs_set_user_money(id, Money);
}
case 3:
{
new Cost = get_pcvar_num(randomgun);
new Money = cs_get_user_money(id);
if (Money < Cost)
{
client_print(id, print_chat, "%L", LANG_PLAYER, "NO_MONEY", Cost);
client_cmd( 0, "spk %s", gNoMoney);
return PLUGIN_HANDLED
}
else
{
strip_user_weapons(id)
give_item(id, Primary[random_num(0, sizeof Primary - 1)])
give_item(id, Secondary[random_num(0, sizeof Secondary - 1)])
give_item(id, Grenades[random_num(0, sizeof Grenades - 1)])
give_item(id, weapon_knife)
client_print(id, print_chat, "%L", LANG_PLAYER, "RANDOMGUN");
client_cmd( 0, "spk %s", gGun);
Money -= Cost;
cs_set_user_money(id, Money);
}
}
}
menu_destroy(menu)
return PLUGIN_HANDLED;
}
public logevent_round_start(id)
{
set_hudmessage(255, 100, 0, 1.0, 0.33, 1, 2.0, 5.0);
show_hudmessage( 0, "SurfShop maded by TBagT !" );
}