AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How does this menu work ? (https://forums.alliedmods.net/showthread.php?t=328546)

Abhinash 11-14-2020 17:49

How does this menu work ?
 
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 ?

redivcram 11-14-2020 17:51

Re: How does this menu work ?
 
What? Post the full code.

Abhinash 11-14-2020 17:53

Re: How does this menu work ?
 
1 Attachment(s)
Quote:

Originally Posted by redivcram (Post 2724938)
What? Post the full code.

Here you go.
Please check it out and let me know

Helmuth von August 11-15-2020 13:25

Re: How does this menu work ?
 
Hi,
Post code here

Abhinash 11-18-2020 17:34

Re: How does this menu work ?
 
Quote:

Originally Posted by Helmuth von August (Post 2725042)
Hi,
Post code here

Are you blind or you forgot to use your eyes ?
May I help you get a tutorial on how to use your Eyes ?


All times are GMT -4. The time now is 13:28.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.