public Cmd_MenuMain(id) // Menu Main
{
if (!is_user_alive(id)) return PLUGIN_HANDLED
new menu_title[64], item_1[64], item_2[64], item_3[64], item_4[64]
, item_5[64], item_6[64]
format(menu_title, charsmax(menu_title), "[NST Player] %L:", LANG_PLAYER, "MENUTEAM_TITLE")
format(item_1, charsmax(item_1),"%L", LANG_PLAYER, "MENU_TITLE_RIFLES")
format(item_2, charsmax(item_2),"%L", LANG_PLAYER, "MENU_TITLE_PISTOLS")
format(item_3, charsmax(item_3),"%L", LANG_PLAYER, "MENU_TITLE_KNIFE")
format(item_4, charsmax(item_4),"%L", LANG_PLAYER, "MENU_TITLE_HE")
format(item_5, charsmax(item_5),"%L", LANG_PLAYER, "MENU_ITEM_REBUY")
format(item_6, charsmax(item_6),"%L", LANG_PLAYER, "MENU_ITEM_AUTOBUY")
new mHandleID = menu_create(menu_title, "menu_main_handler")
menu_additem(mHandleID, item_1, "1", 0)
menu_additem(mHandleID, item_2, "2", 0)
menu_additem(mHandleID, item_3, "3", 0)
menu_additem(mHandleID, item_4, "4", 0)
menu_additem(mHandleID, item_5, "5", 0)
menu_additem(mHandleID, item_6, "6", 0)
menu_display(id, mHandleID, 0)
return PLUGIN_HANDLED
}
public menu_main_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0:mainweapon(id)
case 1:secondweapon(id)
case 2:knifeweapon(id)
case 3:heweapon(id)
case 4:cmd_rebuy_wpn(id)
case 5:auto_rebuy(id)
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public mainweapon(id)
{
new title[64]
format(title, charsmax(title), "[%L] %L:", LANG_PLAYER, "MENU_TITLE_SHOP", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buymainweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buymainweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0:shotgunweapon(id)
case 1:smgweapon(id)
case 2:riflesweapon(id)
case 3:mgweapon(id)
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public shotgunweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buyshotgunweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyshotgunweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
//new szClip, szAmmon, szWeapID = get_user_weapon( id, szClip, szAmmo )
//if(szWeapID == CHANGE_WEAPON && CURENT_WEAPON) {
if(CHANGE_WEAPON == CSW_M3 || CHANGE_WEAPON == CSW_XM1014) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public smgweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buysmgweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buysmgweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_MAC10 || CHANGE_WEAPON == CSW_UMP45 || CHANGE_WEAPON == CSW_MP5NAVY || CHANGE_WEAPON == CSW_TMP || CHANGE_WEAPON == CSW_P90) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public riflesweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buyriflesweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyriflesweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_AWP || CHANGE_WEAPON == CSW_SCOUT ||CHANGE_WEAPON == CSW_SG550 || CHANGE_WEAPON == CSW_G3SG1 || CHANGE_WEAPON == CSW_AK47 || CHANGE_WEAPON == CSW_M4A1 ||CHANGE_WEAPON == CSW_AUG || CHANGE_WEAPON ==CSW_GALIL || CHANGE_WEAPON == CSW_FAMAS || CHANGE_WEAPON == CSW_SG552) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public mgweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buymgweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buymgweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_M249) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public secondweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_PISTOLS")
new mHandleID = menu_create(title, "buysecondweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buysecondweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_DEAGLE || CHANGE_WEAPON == CSW_USP || CHANGE_WEAPON == CSW_GLOCK18 || CHANGE_WEAPON == CSW_ELITE || CHANGE_WEAPON == CSW_FIVESEVEN || CHANGE_WEAPON == CSW_P228) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public knifeweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_KNIFE")
new mHandleID = menu_create(title, "buyknifeweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyknifeweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_KNIFE) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public heweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_HE")
new mHandleID = menu_create(title, "buyheeweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyheweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_FLASHBANG || CHANGE_WEAPON == CSW_HEGRENADE || CHANGE_WEAPON == CSW_SMOKEGRENADE) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public show_weapon_msg(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new i, check_value = 1
while (check_value && i<MAX_WPN)
{
if ( (c_team[i] && get_user_team(id)!=c_team[i]) || !c_buy[i])
{
i++
continue;
}
if (c_wpnchange[i] <= 0) check_value = 0
if (check_value) {
new item_name[150], idwpn[32],wpn_cost = c_cost[i]
format(item_name, 149, "%s: %i$", c_name[i], wpn_cost)
format(idwpn, 31, "%i", i)
new check_money, user_money, free_wpn = nst_wpn_free()
user_money = cs_get_user_money(id)
if (!free_wpn && user_money<wpn_cost) check_money = 1
menu_additem(menu, item_name, idwpn, check_money)
}
i++
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
{
if (!is_user_alive(id)) return PLUGIN_HANDLED
new menu_title[64], item_1[64], item_2[64], item_3[64], item_4[64]
, item_5[64], item_6[64]
format(menu_title, charsmax(menu_title), "[NST Player] %L:", LANG_PLAYER, "MENUTEAM_TITLE")
format(item_1, charsmax(item_1),"%L", LANG_PLAYER, "MENU_TITLE_RIFLES")
format(item_2, charsmax(item_2),"%L", LANG_PLAYER, "MENU_TITLE_PISTOLS")
format(item_3, charsmax(item_3),"%L", LANG_PLAYER, "MENU_TITLE_KNIFE")
format(item_4, charsmax(item_4),"%L", LANG_PLAYER, "MENU_TITLE_HE")
format(item_5, charsmax(item_5),"%L", LANG_PLAYER, "MENU_ITEM_REBUY")
format(item_6, charsmax(item_6),"%L", LANG_PLAYER, "MENU_ITEM_AUTOBUY")
new mHandleID = menu_create(menu_title, "menu_main_handler")
menu_additem(mHandleID, item_1, "1", 0)
menu_additem(mHandleID, item_2, "2", 0)
menu_additem(mHandleID, item_3, "3", 0)
menu_additem(mHandleID, item_4, "4", 0)
menu_additem(mHandleID, item_5, "5", 0)
menu_additem(mHandleID, item_6, "6", 0)
menu_display(id, mHandleID, 0)
return PLUGIN_HANDLED
}
public menu_main_handler(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0:mainweapon(id)
case 1:secondweapon(id)
case 2:knifeweapon(id)
case 3:heweapon(id)
case 4:cmd_rebuy_wpn(id)
case 5:auto_rebuy(id)
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public mainweapon(id)
{
new title[64]
format(title, charsmax(title), "[%L] %L:", LANG_PLAYER, "MENU_TITLE_SHOP", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buymainweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buymainweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
switch(item)
{
case 0:shotgunweapon(id)
case 1:smgweapon(id)
case 2:riflesweapon(id)
case 3:mgweapon(id)
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
public shotgunweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buyshotgunweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyshotgunweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
//new szClip, szAmmon, szWeapID = get_user_weapon( id, szClip, szAmmo )
//if(szWeapID == CHANGE_WEAPON && CURENT_WEAPON) {
if(CHANGE_WEAPON == CSW_M3 || CHANGE_WEAPON == CSW_XM1014) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public smgweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buysmgweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buysmgweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_MAC10 || CHANGE_WEAPON == CSW_UMP45 || CHANGE_WEAPON == CSW_MP5NAVY || CHANGE_WEAPON == CSW_TMP || CHANGE_WEAPON == CSW_P90) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public riflesweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buyriflesweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyriflesweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_AWP || CHANGE_WEAPON == CSW_SCOUT ||CHANGE_WEAPON == CSW_SG550 || CHANGE_WEAPON == CSW_G3SG1 || CHANGE_WEAPON == CSW_AK47 || CHANGE_WEAPON == CSW_M4A1 ||CHANGE_WEAPON == CSW_AUG || CHANGE_WEAPON ==CSW_GALIL || CHANGE_WEAPON == CSW_FAMAS || CHANGE_WEAPON == CSW_SG552) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public mgweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_RIFLES")
new mHandleID = menu_create(title, "buymgweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buymgweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_M249) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public secondweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_PISTOLS")
new mHandleID = menu_create(title, "buysecondweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buysecondweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_DEAGLE || CHANGE_WEAPON == CSW_USP || CHANGE_WEAPON == CSW_GLOCK18 || CHANGE_WEAPON == CSW_ELITE || CHANGE_WEAPON == CSW_FIVESEVEN || CHANGE_WEAPON == CSW_P228) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public knifeweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_KNIFE")
new mHandleID = menu_create(title, "buyknifeweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyknifeweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_KNIFE) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public heweapon(id)
{
new title[64]
format(title, charsmax(title), "[NST Wpn] %L:", LANG_PLAYER, "MENU_TITLE_HE")
new mHandleID = menu_create(title, "buyheeweapon")
show_weapon_msg(id, mHandleID, 0)
menu_display(id, mHandleID, 0)
}
public buyheweapon(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new CURENT_WEAPON = g_weapon[id]
new CHANGE_WEAPON = c_wpnchange[CURENT_WEAPON]
if(CHANGE_WEAPON == CSW_FLASHBANG || CHANGE_WEAPON == CSW_HEGRENADE || CHANGE_WEAPON == CSW_SMOKEGRENADE) buy_weapon(id, CHANGE_WEAPON)
menu_destroy(menu)
return PLUGIN_HANDLED
}
public show_weapon_msg(id, menu, item)
{
if (item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new i, check_value = 1
while (check_value && i<MAX_WPN)
{
if ( (c_team[i] && get_user_team(id)!=c_team[i]) || !c_buy[i])
{
i++
continue;
}
if (c_wpnchange[i] <= 0) check_value = 0
if (check_value) {
new item_name[150], idwpn[32],wpn_cost = c_cost[i]
format(item_name, 149, "%s: %i$", c_name[i], wpn_cost)
format(idwpn, 31, "%i", i)
new check_money, user_money, free_wpn = nst_wpn_free()
user_money = cs_get_user_money(id)
if (!free_wpn && user_money<wpn_cost) check_money = 1
menu_additem(menu, item_name, idwpn, check_money)
}
i++
}
menu_destroy(menu)
return PLUGIN_HANDLED
}