#define SND_MENU "silent/vip/menu/button.wav"
const KEYSMENU = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0
new const MAXBPAMMO[] = { -1, 52, -1, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120,
30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, -1, 100 }
new const MAXCLIP[] = { -1, 13, -1, 10, -1, 7, -1, 30, 30, -1, 30, 20, 25, 30, 35, 25, 12, 20,
10, 30, 100, 8, 30, 30, 20, -1, 7, 30, 30, -1, 50 }
native m134_give(id)
native vsk94_give(id)
native hk416_give(id)
native m4a1g_give(id)
native ak47g_give(id)
native awpg_give(id)
native aklong_give(id)
native xm8_give(id)
native k1ase_give(id)
native watergun_give(id)
native mg36xmas_give(id)
new g_iPrice[44]
new g_menu_type[33]
new Float:g_fSpeed[33]
new bool:g_bMusic[33]
new bool:g_bAmmo[33]
new bool:g_bMultijump[33]
new bool:jumpnum[33]
new bool:dojump[33]
public plugin_precache()
{
precache_sound(SND_MENU)
}
public plugin_cfg() set_task(0.1, "Task_PluginCfg");
public Task_PluginCfg()
{
new szCfgDir[64], szCfgFile[128];
get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir));
formatex(szCfgFile, charsmax(szCfgFile), "%s/shop.cfg", szCfgDir);
if(file_exists(szCfgFile)) server_cmd("exec %s", szCfgFile);
}
public plugin_init()
{
RegisterHam(Ham_Killed, "player", "ham_killed_post", 1)
register_clcmd("say /shop2", "clcmd_radio_three")
register_clcmd("say_team /shop2", "clcmd_radio_three")
register_clcmd("shop2", "clcmd_radio_three")
register_menu("Main Server Menu", KEYSMENU, "menu_server")
register_menu("Shoping Menu", KEYSMENU, "menu_shop2")
register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
register_message(get_user_msgid("CurWeapon"), "message_cur_weapon")
new buffer[32]
for (new i=1; i < 43; i++)
{
formatex(buffer, 31, "shop_price_%d", i)
g_iPrice[i]=register_cvar(buffer,"100")
}
}
public ham_killed_post(id)
{
g_fSpeed[id]=0.0
g_bAmmo[id]=false
g_bMultijump[id]=false
}
public client_connect(id)
{
g_fSpeed[id]=0.0
g_bAmmo[id]=false
g_bMultijump[id]=false
g_bMusic[id]=true
}
public clcmd_radio_three(id) return shop_main_open(id);
stock fm_cs_get_user_team(id)
{
if (pev_valid(id) != 2) return 0
return get_pdata_int(id, 114, 5)
}
public shop_main_open(id)
{
if(!is_user_alive(id))
{
colored_print(id, "!tМертвым меню !gне доступно!")
return PLUGIN_HANDLED;
}
new Float:Health
pev(id, pev_health, Health)
new Float:Armor
pev(id, pev_armorvalue, Armor)
new Float:Gravity
pev(id, pev_gravity, Gravity)
new Float:RAMT
pev(id, pev_renderamt, RAMT)
static menu[512], len
len = 0
len += formatex(menu[len], charsmax(menu) - len, "\y[\rT vs CT - CSDM\y]^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\yShop#2\r] \wМагазин Бонусов^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\yShop#1\r] \wВаша скидка: \y %d%%^n^n", dm_money_get_discount(id))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y1\r]\w Меню оружия^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\y2\r]\w Меню предметов^n")
len += formatex(menu[len], charsmax(menu) - len, Health>=450.0?"\r[\y3\r]\d Меню здоровья \r[\yMAX\r]^n":"\r[\y3\r]\w Меню здоровья^n")
len += formatex(menu[len], charsmax(menu) - len, Armor>=450.0?"\r[\y4\r]\d Меню брони \r[\yMAX\r]^n":"\r[\y4\r]\w Меню брони^n")
len += formatex(menu[len], charsmax(menu) - len, Gravity==0.4?"\r[\y5\r]\d Меню гравитации \r[\yMAX\r]^n":"\r[\y5\r]\w Меню гравитации^n")
len += formatex(menu[len], charsmax(menu) - len, g_fSpeed[id]==420.0?"\r[\y6\r]\d Меню скорости \r[\yMAX\r]^n":"\r[\y6\r]\w Меню скорости^n")
len += formatex(menu[len], charsmax(menu) - len, (get_user_flags(id)&ADMIN_LEVEL_H | ADMIN_BAN )?"\r[\y7\r]\w Премиум оружие \r[\yVIP\r | \yADM\r]^n^n":"\r[\y7\r]\d Премиум оружие \r[\yVIP\r | \yADM\r]^n^n")
len += formatex(menu[len], charsmax(menu) - len, "^n\r[\y9\r]\w Назад")
len += formatex(menu[len], charsmax(menu) - len, "^n\r[\y0\r]\w Выход")
return show_menu(id, KEYSMENU, menu, -1, "Main Server Menu")
}
public shop_second_open(id)
{
if(!is_user_alive(id))
{
colored_print(id, "!tМертвым меню !gне доступно!")
return
}
static menu[512], len
len = 0
switch(g_menu_type[id])
{
case 0:{
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Меню оружия^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Ваша скидка: \w%d%%^n^n", dm_money_get_discount(id))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y1\r]\w Minigun \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[1])))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y2\r]\w VSK-94 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[2])))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y3\r]\w HK416 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[3])))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y4\r]\w Gold M4A1 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[4])))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y5\r]\w Gold AK47 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[5])))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y6\r]\w Gold AWP \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[6])))
}
case 1:{
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Меню предметов^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Ваша скидка: \w%d%%^n^n", dm_money_get_discount(id))
len += formatex(menu[len], charsmax(menu) - len, g_bAmmo[id]?"\r[\y1\r]\d Бесконечные патроны \r(\y%d$\r)^n":"\r[\y1\r]\w Бесконечные патроны \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[7]))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y2\r]\w Все гранаты \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[8]))
len += formatex(menu[len], charsmax(menu) - len, g_bMultijump[id]?"\r[\y3\r]\d Мульти прыжок \r(\y%d$\r)^n":"\r[\y3\r]\w Мульти прыжок \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[9])))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y4\r]\w Купить 10 HE гранат \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[10]))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y5\r]\w Купить 15 FB гранат \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[11]))
}
case 2:{
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Меню здоровья^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Ваша скидка: \w%d%%^n^n", dm_money_get_discount(id))
new Float:Health
pev(id, pev_health, Health)
len += formatex(menu[len], charsmax(menu) - len, Health>=450.0?"\r[\y1\r]\d Здоровье +450 \r(\y%d$\r)^n":"\r[\y1\r]\w Здоровье +450 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[12])))
len += formatex(menu[len], charsmax(menu) - len, Health>=450.0?"\r[\y2\r]\d Здоровье +325 \r(\y%d$\r)^n":"\r[\y2\r]\w Здоровье +325 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[13])))
len += formatex(menu[len], charsmax(menu) - len, Health>=450.0?"\r[\y3\r]\d Здоровье +250 \r(\y%d$\r)^n":"\r[\y3\r]\w Здоровье +250 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[14])))
len += formatex(menu[len], charsmax(menu) - len, Health>=450.0?"\r[\y4\r]\d Здоровье +150 \r(\y%d$\r)^n":"\r[\y4\r]\w Здоровье +150 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[15])))
len += formatex(menu[len], charsmax(menu) - len, Health>=450.0?"\r[\y5\r]\d Здоровье +100 \r(\y%d$\r)^n":"\r[\y5\r]\w Здоровье +100 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[16])))
len += formatex(menu[len], charsmax(menu) - len, Health>=450.0?"\r[\y6\r]\d Здоровье +50 \r(\y%d$\r)^n":"\r[\y6\r]\w Здоровье +50 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[17])))
}
case 3:{
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Меню брони^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Ваша скидка: \w%d%%^n^n", dm_money_get_discount(id))
new Float:Armor
pev(id, pev_armorvalue, Armor)
len += formatex(menu[len], charsmax(menu) - len, Armor>=450.0?"\r[\y1\r]\d Броня +450 \r(\y%d$\r)^n":"\r[\y1\r]\w Броня +450 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[18])))
len += formatex(menu[len], charsmax(menu) - len, Armor>=450.0?"\r[\y2\r]\d Броня +325 \r(\y%d$\r)^n":"\r[\y2\r]\w Броня +325 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[19])))
len += formatex(menu[len], charsmax(menu) - len, Armor>=450.0?"\r[\y3\r]\d Броня +250 \r(\y%d$\r)^n":"\r[\y3\r]\w Броня +250 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[20])))
len += formatex(menu[len], charsmax(menu) - len, Armor>=450.0?"\r[\y4\r]\d Броня +150 \r(\y%d$\r)^n":"\r[\y4\r]\w Броня +150 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[21])))
len += formatex(menu[len], charsmax(menu) - len, Armor>=450.0?"\r[\y5\r]\d Броня +100 \r(\y%d$\r)^n":"\r[\y5\r]\w Броня +100 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[22])))
len += formatex(menu[len], charsmax(menu) - len, Armor>=450.0?"\r[\y6\r]\d Броня +50 \r(\y%d$\r)^n":"\r[\y6\r]\w Броня +50 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[23])))
}
case 4:{
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Меню гравитации^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Ваша скидка: \w%d%%^n^n", dm_money_get_discount(id))
new Float:Gravity
pev(id, pev_gravity, Gravity)
len += formatex(menu[len], charsmax(menu) - len, (Gravity==0.4)?"\r[\y1\r]\d Гравитация 400 \r(\y%d$\r)^n":"\r[\y1\r]\w Гравитация 400 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[24])))
len += formatex(menu[len], charsmax(menu) - len, (Gravity==0.4||Gravity==0.5)? "\r[\y2\r]\d Гравитация 500 \r(\y%d$\r)^n":"\r[\y2\r]\w Гравитация 500 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[25])))
len += formatex(menu[len], charsmax(menu) - len, (Gravity==0.4||Gravity==0.5||Gravity==0.6)?"\r[\y3\r]\d Гравитация 600 \r(\y%d$\r)^n":"\r[\y3\r]\w Гравитация 600 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[26])))
len += formatex(menu[len], charsmax(menu) - len, (Gravity==0.4||Gravity==0.5||Gravity==0.6||Gravity==0.7)?"\r[\y4\r]\d Гравитация 700 \r(\y%d$\r)^n":"\r[\y4\r]\w Гравитация 700 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[27])))
}
case 5:{
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Меню скорости^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Ваша скидка: \w%d%%^n^n", dm_money_get_discount(id))
len += formatex(menu[len], charsmax(menu) - len, g_fSpeed[id]==420.0?"\r[\y1\r]\d Скорость 420 \r(\y%d$\r)^n":"\r[\y1\r]\w Скорость 420 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[28])))
len += formatex(menu[len], charsmax(menu) - len, (g_fSpeed[id]==420.0||g_fSpeed[id]==380.0)?"\r[\y2\r]\d Скорость 380 \r(\y%d$\r)^n":"\r[\y2\r]\w Скорость 380 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[29])))
len += formatex(menu[len], charsmax(menu) - len, (g_fSpeed[id]==420.0||g_fSpeed[id]==380.0||g_fSpeed[id]==340.0)?"\r[\y3\r]\d Скорость 340 \r(\y%d$\r)^n":"\r[\y3\r]\w Скорость 340 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[30])))
len += formatex(menu[len], charsmax(menu) - len, (g_fSpeed[id]==420.0||g_fSpeed[id]==380.0||g_fSpeed[id]==340.0||g_fSpeed[id]==300.0)?"\r[\y4\r]\d Скорость 300 \r(\y%d$\r)^n":"\r[\y4\r]\w Скорость 300 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[31])))
len += formatex(menu[len], charsmax(menu) - len, (g_fSpeed[id]==420.0||g_fSpeed[id]==380.0||g_fSpeed[id]==340.0||g_fSpeed[id]==300.0||g_fSpeed[id]==260.0)?"\r[\y5\r]\d Скорость 260 \r(\y%d$\r)^n":"\r[\y5\r]\w Скорость 260 \r(\y%d$\r)^n", get_price(id, get_pcvar_num(g_iPrice[32])))
}
case 6:{
len += formatex(menu[len], charsmax(menu) - len, "\r[\wShop#2\r]\y Меню премиум оружия^n^n")
len += formatex(menu[len], charsmax(menu) - len, "\r[\y1\r]\w K1ASE \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[33]))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y2\r]\w Watergun \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[34]))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y3\r]\w MG36 Xmas \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[35]))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y4\r]\w AK47 Long \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[36]))
len += formatex(menu[len], charsmax(menu) - len, "\r[\y5\r]\w XM8 Basic \r(\y%d$\r)^n", get_pcvar_num(g_iPrice[37]))
}
}
len += formatex(menu[len], charsmax(menu) - len, "^n\r[\y9\r]\w Назад")
len += formatex(menu[len], charsmax(menu) - len, "^n\r[\y0\r]\w Выход")
show_menu(id, KEYSMENU, menu, -1, "Shoping Menu")
}
public menu_server(id, key)
{
if(!is_user_alive(id))
{
colored_print(id, "!tМертвым меню !gне доступно!")
return
}
if(key==9) return
if(key==7&&!(get_user_flags(id)&ADMIN_LEVEL_H)){
colored_print(id, "!tДоступно только для !gVIP!y/!gADMIN")
return
}
new Float:Gravity, Float:RAMT
new Float:Health
new Float:Armor
pev(id, pev_health, Health)
pev(id, pev_armorvalue, Armor)
pev(id, pev_gravity, Gravity)
pev(id, pev_renderamt, RAMT)
switch(key){
case 2: if(Health>=450.0) return
case 3: if(Armor>=450.0) return
case 4: if(Gravity==0.4) return
case 5: if(RAMT==50.0) return
case 6: if(g_fSpeed[id]==420.0) return
}
g_menu_type[id]=key
shop_second_open(id)
return
}
public menu_shop2(id, key)
{
if(!is_user_alive(id))
{
colored_print(id, "!tМертвым меню !gне доступно!")
return
}
if(key==8){
shop_main_open(id)
return
}
else if(key==9)return
switch(g_menu_type[id])
{
case 0:
{
if(key>5)return
if(cs_get_user_money(id)<get_price(id, get_pcvar_num(g_iPrice[1+key]))){
colored_print(id, "!yУ вас !tне хватает денег !yна покупку !gэтого оружия !y[!tнужно !g%d$!y]", get_price(id, get_pcvar_num(g_iPrice[1+key])))
client_cmd(id, "spk sound/dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return
}
switch(key)
{
case 0:
{
m134_give(id)
colored_print(id, "!yПоздравляю !tвы купили !gMinigun!y!")
}
case 1:
{
vsk94_give(id)
colored_print(id, "!yПоздравляю !tвы купили !gVsk-94!y!")
}
case 2:
{
hk416_give(id)
colored_print(id, "!yПоздравляю !tвы купили !ghHk-416!y!")
}
case 3:
{
m4a1g_give(id)
colored_print(id, "!yПоздравляю !tвы купили !gGold M4A1!y!")
}
case 4:
{
ak47g_give(id)
colored_print(id, "!yПоздравляю !tвы купили !gGold Ak-47!y!")
}
case 5:
{
awpg_give(id)
colored_print(id, "!yПоздравляю !tвы купили !gGold AWP!y!")
}
}
cs_set_user_money(id, cs_get_user_money(id)-get_price(id, get_pcvar_num(g_iPrice[1+key])))
}
case 1:
{
if(key>4)return
switch(key)
{
case 0:
{
if(g_bAmmo[id])return
if(cs_get_user_money(id)<get_pcvar_num(g_iPrice[7+key])){
colored_print(id, "!yУ вас !tне хватает денег !yна покупку !y[!tнужно !g%d$!y]", get_pcvar_num(g_iPrice[7+key]))
client_cmd(id, "spk sound/dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return
}
g_bAmmo[id]=true
colored_print(id, "!yПоздравляю !tвы купили !gбесконечные патроны")
cs_set_user_money(id, cs_get_user_money(id)-get_pcvar_num(g_iPrice[7+key]))
}
case 1:
{
if(cs_get_user_money(id)<get_pcvar_num(g_iPrice[7+key])){
colored_print(id, "!yУ вас !tне хватает денег !yна покупку !y[!tнужно !g%d$!y]", get_pcvar_num(g_iPrice[7+key]))
client_cmd(id, "spk sound/dmsentries/fail_update_2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
return
}
fm_give_item(id, "weapon_hegrenade")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_flashbang")
fm_give_item(id, "weapon_smokegrenade")
colored_print(id, "!yПоздравляю !tвы купили !gНабор Гранат!y!")
cs_set_user_money(id, cs_get_user_money(id)-get_pcvar_num(g_iPrice[7+key]))