View Single Post
Author Message
Abhinash
Senior Member
Join Date: Jan 2015
Location: India,kolkata
Old 11-14-2020 , 17:49   How does this menu work ?
Reply With Quote #1

Hey guys.
So I wanna know how this menu works by removing out some items for zombies.

First Var -
Code:
new g_iShopItemsTeams[8] =
{
	2, 0, 0, 0, 0, 0, 2, 0
};
Second check in menu -
Code:
case 2:
			{
				static cNumber[3];
				static cLine[128];
				static i;
				g_iShopMenu = menu_create("Shop Menu", "_ShopMenu", 0);
				i = 0;
				while (i < 8)
				{
					if (g_iShopItemsTeams[i] == 2 && g_bZombie[iPlayer])
					{
					}
					else
					{
						formatex(cLine, 128, "%s %s", g_cShopItems[i], g_cShopItemsPrices[i]);
						num_to_str(i, cNumber, 3);
						menu_additem(g_iShopMenu, cLine, cNumber, 0, -1);
					}
					i += 1;
				}
				menu_display(iPlayer, g_iShopMenu, 0);
			}
And Finally third and last part in menu handler -
Code:
case 0:
			{
				if (g_iShopItemsPrices[iChoice] > g_iPoints[iPlayer])
				{
					client_print_color(iPlayer, print_team_grey, "^4[Zombie Outstanding]^1 You don't have enough points!");
				}
				else
				{
					if (g_iShopItemsTeams[iChoice] == 2 && g_bZombie[iPlayer])
					{
						client_print_color(iPlayer, print_team_grey, "^4[Zombie Outstanding]^1 This item is not for your team!");
					}
					if (!g_bAlive[iPlayer])
					{
						client_print_color(iPlayer, print_team_grey, "^4[Zombie Outstanding]^1 You should be alive!");
					}
					g_bDoubleDamage[iPlayer] = 1;
                    set_hudmessage(205, 102, 29, -1.00, 0.70, 1, 0.00, 3.00, 2.00, 1.00, -1);
					ShowSyncHudMsg(0, g_iEventsHudmessage, "%s bought Double Damage!", g_cName[iPlayer]);
					client_print_color(0, print_team_grey, "^4[Zombie Outstanding]^3 %s^1 bought^4 Double Damage", g_cName[iPlayer]);
					g_iPoints[iPlayer] -= g_iShopItemsPrices[iChoice];
					SaveRank(iPlayer);
				}
			}
In effect if I am Human I can see all items of Team = 0 and 2 and when I am a Zombie then the items with Team = 2 are removed from my menu.

Can anyone make me understand how this works ?
Please ?

Last edited by Abhinash; 11-14-2020 at 17:50.
Abhinash is offline