Post by Deleted on May 3, 2018 21:52:21 GMT
Hello guys today I want to help some people who do not know how to modify this and I hope all people understand how to modify this in a good way and there is no mistake in which to agree with
All regular servers remain:Code
Modify it to become much better and this is a fun way
To->
Code:
All regular servers remain:Code
// Extra Items Menu
show_menu_extras(id)
{
// Player dead?
if (!g_isalive[id])
return;
static menuid, menu[128], item, team, buffer[32]
// Title
formatex(menu, charsmax(menu), "%L [%L]\r", id, "MENU_EXTRA_TITLE", id, g_nemesis[id] ? "CLASS_NEMESIS" : g_assassin[id] ? "CLASS_ASSASSIN" : g_zombie[id] ? "CLASS_ZOMBIE" : g_survivor[id] ? "CLASS_SURVIVOR" : g_sniper[id] ? "CLASS_SNIPER" : "CLASS_HUMAN")
menuid = menu_create(menu, "menu_extras")
// Item List
for (item = 0; item < g_extraitem_i; item++)
{
// Retrieve item's team
team = ArrayGetCell(g_extraitem_team, item)
// Item not available to player's team/class
if ((g_zombie[id] && !g_nemesis[id] && !g_assassin[id] && !(team & ZP_TEAM_ZOMBIE)) || (!g_zombie[id] && !g_survivor[id] && !g_sniper[id] && !(team & ZP_TEAM_HUMAN)) || (g_nemesis[id] && !(team & ZP_TEAM_NEMESIS)) || (g_assassin[id] && !(team & ZP_TEAM_ASSASSIN)) || (g_survivor[id] && !(team & ZP_TEAM_SURVIVOR)) || (g_sniper[id] && !(team & ZP_TEAM_SNIPER)))
continue;
// Check if it's one of the hardcoded items, check availability, set translated caption
switch (item)
{
case EXTRA_NVISION:
{
if (!get_pcvar_num(cvar_extranvision)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA1")
}
case EXTRA_ANTIDOTE:
{
if (!get_pcvar_num(cvar_extraantidote) || g_antidotecounter >= get_pcvar_num(cvar_antidotelimit)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA2")
}
case EXTRA_MADNESS:
{
if (!get_pcvar_num(cvar_extramadness) || g_madnesscounter >= get_pcvar_num(cvar_madnesslimit)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA3")
}
case EXTRA_INFBOMB:
{
if (!get_pcvar_num(cvar_extrainfbomb) || g_infbombcounter >= get_pcvar_num(cvar_infbomblimit)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA4")
}
default:
{
if (item >= EXTRA_WEAPONS_STARTID && item <= EXTRAS_CUSTOM_STARTID-1 && !get_pcvar_num(cvar_extraweapons)) continue;
ArrayGetString(g_extraitem_name, item, buffer, charsmax(buffer))
}
}
// Add Item Name and Cost
formatex(menu, charsmax(menu), "%s \y%d %L", buffer, ArrayGetCell(g_extraitem_cost, item), id, "AMMO_PACKS2")
buffer[0] = item
buffer[1] = 0
menu_additem(menuid, menu, buffer)
}
// No items to display?
if (menu_items(menuid) <= 0)
{
zp_colored_print(id, "^x04{S.H.X}^x01 %L", id ,"CMD_NOT_EXTRAS")
menu_destroy(menuid)
return;
}
// Back - Next - Exit
formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
menu_setprop(menuid, MPROP_BACKNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
menu_setprop(menuid, MPROP_NEXTNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
menu_setprop(menuid, MPROP_EXITNAME, menu)
// If remembered page is greater than number of pages, clamp down the value
MENU_PAGE_EXTRAS = min(MENU_PAGE_EXTRAS, menu_pages(menuid)-1)
// Fix for AMXX custom menus
if (pev_valid(id) == PDATA_SAFE)
set_pdata_int(id, OFFSET_CSMENUCODE, 0, OFFSET_LINUX)
menu_display(id, menuid, MENU_PAGE_EXTRAS)
}
Modify it to become much better and this is a fun way
To->
Code:
// Extra Items Menu
show_menu_extras(id)
{
static menuid, menu[128], item, team, buffer[32]
// Title
formatex(menu, charsmax(menu), "%L [%L]\r", id, "MENU_EXTRA_TITLE", id, g_zombie[id] ? g_nemesis[id] ? "CLASS_NEMESIS" : "CLASS_ZOMBIE" : g_survivor[id] ? "CLASS_SURVIVOR" : "CLASS_HUMAN")
menuid = menu_create(menu, "menu_extras")
// Item List
for (item = 0; item < g_extraitem_i; item++)
{
// Retrieve item's team
team = ArrayGetCell(g_extraitem_team, item)
// Item not available to player's team/class
if ((g_zombie[id] && !g_nemesis[id] && !(team & ZP_TEAM_ZOMBIE)) || (!g_zombie[id] && !g_survivor[id] && !(team & ZP_TEAM_HUMAN)) || (g_nemesis[id] && !(team & ZP_TEAM_NEMESIS)) || (g_survivor[id] && !(team & ZP_TEAM_SURVIVOR)))
continue;
// Check if it's one of the hardcoded items, check availability, set translated caption
switch (item)
{
case EXTRA_NVISION:
{
if (!get_pcvar_num(cvar_extranvision)) continue;
formatex(buffer, charsmax(buffer), "%L", id, "MENU_EXTRA1")
}
case EXTRA_ANTIDOTE:
{
if (!get_pcvar_num(cvar_extraantidote) || g_antidotecounter >= get_pcvar_num(cvar_antidotelimit)) continue;
formatex(buffer, charsmax(buffer), "T-Virus Antidote [%d/%d] \rlimit", g_antidotecounter, get_pcvar_num(cvar_antidotelimit))
}
case EXTRA_MADNESS:
{
if (!get_pcvar_num(cvar_extramadness) || g_madnesscounter >= get_pcvar_num(cvar_madnesslimit)) continue;
formatex(buffer, charsmax(buffer), "Zombie Madness [%d/%d] \rlimit", g_madnesscounter, get_pcvar_num(cvar_madnesslimit))
}
case EXTRA_INFBOMB:
{
if (!get_pcvar_num(cvar_extrainfbomb) || g_infbombcounter >= get_pcvar_num(cvar_infbomblimit)) continue;
formatex(buffer, charsmax(buffer), "Infection Bomb [%d/%d] \rlimit", g_infbombcounter, get_pcvar_num(cvar_infbomblimit))
}
default:
{
if (item >= EXTRA_WEAPONS_STARTID && item <= EXTRAS_CUSTOM_STARTID-1 && !get_pcvar_num(cvar_extraweapons)) continue;
ArrayGetString(g_extraitem_name, item, buffer, charsmax(buffer))
}
}
// Add Item Name and Cost
formatex(menu, charsmax(menu), "\w-=\y|\rZP\y|\w=- %s \y%d %L", buffer, ArrayGetCell(g_extraitem_cost, item), id, "AMMO_PACKS2")
buffer[0] = item
buffer[1] = 0
menu_additem(menuid, menu, buffer)
}
// No items to display?
if (menu_items(menuid) <= 0)
{
zp_colored_print(id, "^x04[ZP]^x01 %L", id ,"CMD_NOT_EXTRAS")
menu_destroy(menuid)
return;
}
// Back - Next - Exit
formatex(menu, charsmax(menu), "%L", id, "MENU_BACK")
menu_setprop(menuid, MPROP_BACKNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_NEXT")
menu_setprop(menuid, MPROP_NEXTNAME, menu)
formatex(menu, charsmax(menu), "%L", id, "MENU_EXIT")
menu_setprop(menuid, MPROP_EXITNAME, menu)
menu_display(id, menuid)
}