AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Menu Number (https://forums.alliedmods.net/showthread.php?t=325879)

Supremache 07-09-2020 18:42

Menu Number
 
Hello guys,
I was editing zombie classess of basebuilder mod and i was want to change admin access to level access and i did it but i have something wrong, When i checked it the menu didn't show all classes and i said the problem in number of the menu and i changed it from menu[512] to menu[2048] but i still have the same problem so can someone tell me how to fix that or where is the problem Oo

The problem
https://i.ibb.co/TTH6SfD/51.png

Orginal menu with admin access
PHP Code:

public show_zclass_menu(id,offset)
{
    if(
offset<0offset 0

    
new keyscurnummenu[512], szCache1[32], szCache2[32], iCache3
    
for(new i=offset;i<g_iZClasses;i++)
    {
        
ArrayGetString(g_zclass_nameiszCache1charsmax(szCache1))
        
ArrayGetString(g_zclass_infoiszCache2charsmax(szCache2))
        
iCache3 ArrayGetCell(g_zclass_admini)
        
        
// Add to menu
        
if (== g_iZombieClass[id])
            
format(menu,511,"%s^n\r[\d%d\r].\d %s \r[ \y%s\r ] \r-=\wSELECTED\r=-"menucurnum+1szCache1szCache2iCache3 == ADMIN_ALL  "" :"" )
        else
            
format(menu,511,"%s^n\r[\w%d\r].\w %s \r[ \y%s\r ]"menucurnum+1szCache1szCache2iCache3 == ADMIN_ALL "" "" )
        
        
g_iMenuOptions[id][curnum] = i
        keys 
+= (1<<curnum)
    
        
curnum++
        
        if(
curnum==8)
            break;
    }

    
format(menu,511,"\ySelect Your Class:^n\r%s^n"menu)
    if(
curnum==&& offset<12)
    {
        
keys += (1<<8)
        
format(menu,511,"%s^n\r[\w9\r].\w Next",menu)
    }
    if(
offset)
    {
        
keys += (1<<9)
        
format(menu,511,"%s^n\r[\w0\r].\w Back",menu)
    }

    
show_menu(id,keys,menu,-1,"ZClassSelect")


What i did with level access
PHP Code:

public show_zclass_menu(id,offset)
{
    if(
offset<0offset 0

    
new keyscurnummenu[512], szCache1[32], szCache2[32], iCache3
    
for(new i=offset;i<g_iZClasses;i++)
    {
        
ArrayGetString(g_zclass_nameiszCache1charsmax(szCache1))
        
ArrayGetString(g_zclass_infoiszCache2charsmax(szCache2))
        
iCache3 ArrayGetCell(g_zclass_lvli)
        
        if(
get_user_level(id) >= ArrayGetCell(g_zclass_lvli))
        {
            if (
== g_iZombieClass[id])
            {
                if(
ArrayGetCell(g_zclass_lvli) > 0)
                {
                    
format(menu511,"%s^n\r[\d%d\r].\d %s \r[ \y%s\r ] \d(Level :: %d) \r-=\wSELECTED\r=-"menucurnum+1szCache1szCache2iCache3)
                }
                else
                {
                    
format(menu511"%s^n\r[\d%d\r].\d %s \r[ \y%s\r ] \r-=\wSELECTED\r=-"menucurnum+1szCache1szCache2)
                }
            }
            else
            {
                if(
ArrayGetCell(g_zclass_lvli) > 0)
                {
                    
format(menu511,"%s^n\r[\w%d\r].\w %s \r[ \y%s\r ] \r(\wLevel\r ::\w %d\r)"menucurnum+1szCache1szCache2iCache3)
                }
                else
                {
                    
format(menu511"%s^n\r[\w%d\r].\w %s \r[ \y%s\r ]"menucurnum+1szCache1szCache2)
                }
            }
        }
        else
        {
            
format(menu511"%s^n\r[\w%d\r].\w %s \r[ \y%s\r ] \r(\wLevel\r ::\w %d\r)"menucurnum+1szCache1szCache2iCache3)
        }
        
// Add to menu
        //if (i == g_iZombieClass[id])
        //    format(menu,511,"%s^n\r[\d%d\r].\d %s \r[ \y%s\r ] \r-=\wSELECTED\r=-", menu, curnum+1, szCache1, szCache2, iCache3 == ADMIN_ALL  ? "" :"" )
        //else
        //    format(menu,511,"%s^n\r[\w%d\r].\w %s \r[ \y%s\r ]", menu, curnum+1, szCache1, szCache2, iCache3 == ADMIN_ALL ? "" : "" )
        
        
g_iMenuOptions[id][curnum] = i
        keys 
+= (1<<curnum)
    
        
curnum++
        
        if(
curnum==8)
            break;
    }

    
format(menu,511,"\ySelect Your Class:^n\r%s^n"menu)
    if(
curnum==&& offset<12)
    {
        
keys += (1<<8)
        
format(menu,511,"%s^n\r[\w9\r].\w Next",menu)
    }
    if(
offset)
    {
        
keys += (1<<9)
        
format(menu,511,"%s^n\r[\w0\r].\w Back",menu)
    }

    
show_menu(id,keys,menu,-1,"ZClassSelect")



OciXCrom 07-09-2020 18:58

Re: Menu Number
 
The maximum amount of character that a menu can display is 512. You cannot go above this limit. Color symbols are counted too and you have a lot of them.

From amxconst.inc:

Code:
#define MAX_MENU_LENGTH 512

And no, changing this value in amxconst.inc won't allow you to exceed it. This is hardcoded in the game itself.

Supremache 07-09-2020 20:00

Re: Menu Number
 
Quote:

Originally Posted by OciXCrom (Post 2709489)
The maximum amount of character that a menu can display is 512. You cannot go above this limit. Color symbols are counted too and you have a lot of them.

From amxconst.inc:

Code:
#define MAX_MENU_LENGTH 512

And no, changing this value in amxconst.inc won't allow you to exceed it. This is hardcoded in the game itself.

So i can't fix it ? or i need to change the full menu?

OciXCrom 07-09-2020 20:22

Re: Menu Number
 
Reduce the number of characters you have in the menu. You can start by removing the ' in the square brackets because that's not how English works.

Natsheh 07-10-2020 05:01

Re: Menu Number
 
Remove keyword zombie and free from The menu

Supremache 07-10-2020 07:54

Re: Menu Number
 
@OciXcrom - I did it before in zombie plague mod and worked perfectly without anyproblem , i think the problem in something in that menu

@Natsheh - Can you give me example

Supremache 07-10-2020 10:39

Re: Menu Number
 
I changed it from 512 to 2048 and keys from 511 to 2047 and i still have the same thing
PHP Code:

public show_zclass_menu(id,offset)
{
    if(
offset<0offset 0

    
new keyscurnummenu[2048], szCache1[32], szCache2[32], iCache3
    
for(new i=offset;i<g_iZClasses;i++)
    {
        
ArrayGetString(g_zclass_nameiszCache1charsmax(szCache1))
        
ArrayGetString(g_zclass_infoiszCache2charsmax(szCache2))
        
iCache3 ArrayGetCell(g_zclass_lvli)
        
        
// Add to menu
        
if (== g_iZombieClass[id])
            
format(menu,2047,"%s^n\r[\d%d\r].\d %s \r[ \y%s\r ] \d(Level :: %d) \r-=\wSELECTED\r=-"menucurnum+1szCache1szCache2iCache3)
        else
            
format(menu,2047,"%s^n\r[\w%d\r].\w %s \r[ \y%s\r ] \r(\wLevel\r ::\w %d\r)"menucurnum+1szCache1szCache2iCache3)
        
        
g_iMenuOptions[id][curnum] = i
        keys 
+= (1<<curnum)
    
        
curnum++
        
        if(
curnum==8)
            break;
    }

    
format(menu,2047,"\ySelect Your Class:^n\r%s^n"menu)
    if(
curnum==&& offset<12)
    {
        
keys += (1<<8)
        
format(menu,2047,"%s^n\r[\w9\r].\w Next",menu)
    }
    if(
offset)
    {
        
keys += (1<<9)
        
format(menu,2047,"%s^n\r[\w0\r].\w Back",menu)
    }

    
show_menu(id,keys,menu,-1,"ZClassSelect")



DruGzOG 07-10-2020 10:49

Re: Menu Number
 
Quote:

Originally Posted by Supremache (Post 2709532)
@OciXcrom - I don't understand, do you mean I should change the number of words menu, If you mean that so I did it before and I changed the number from 512 to 2048 and i have got the same thing

@Natsheh - Can you give me example

As in reduce the amount of letters you have. The engine has a limit to the amount of characters you can use.

Supremache 07-10-2020 11:06

Re: Menu Number
 
Quote:

Originally Posted by DruGzOG (Post 2709553)
As in reduce the amount of letters you have. The engine has a limit to the amount of characters you can use.

When i was using admin access it was working without showing this problem and after i added level access i got this problem, i think the problem not in the amount of letters

https://i.ibb.co/q15Q6XQ/41.png

Supremache 07-10-2020 15:02

Re: Menu Number
 
There's no one know how to fix it !!!! ?


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

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