AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved new menus bug? (https://forums.alliedmods.net/showthread.php?t=339452)

kww 09-10-2022 14:44

new menus bug?
 
Is it intentional or it is a bug?
When I do menu_addblank(menu, 0); then Exit option shifts to slot9

https://i.ibb.co/QdVFx8F/image.png

Or menu_addblank2(menu);, then Exit shifts to what?

https://i.ibb.co/nCTCyNd/image.png

lexzor 09-10-2022 18:36

Re: new menus bug?
 
don t use a native, just add ^n at the end of the item name

kww 09-10-2022 18:38

Re: new menus bug?
 
Workarounds...

What if I build menu like this?
PHP Code:

public Menu_Frontend(id)
{
    new 
menu menu_create("\yWhat da dog doin?""Menu_Backend");
    new 
szLine[17], szData[4];

    for(new 
ieListi++)
    {
        
formatex(szLinecharsmax(szLine), "%i"i);
        
formatex(szDatacharsmax(szData), "#%i"i);
        
menu_additem(menuszLineszData__);
    }

    
menu_addblank(menu0);

    
menu_additem(menu"a""$"__);
    
menu_additem(menu"b""%"__);

    
menu_addblank2(menu); // workaround for shifted Exit option

    
menu_display(idmenu);



lexzor 09-10-2022 19:17

Re: new menus bug?
 
expecting eList is an int variable you can check if the current item that will be listed is the last item that should be listed and add ^n at the end of his name. i think this is the best option to add a blank in the menu

PHP Code:

public Menu_Frontend(id)
{
    new 
menu menu_create("\yWhat da dog doin?""Menu_Backend");
    new 
szLine[17], szData[4];

    for(new 
ieListi++)
    {
        
formatex(szLinecharsmax(szLine), "%i"i);
        
formatex(szDatacharsmax(szData), "#%i"i);
        if(
== eList 1add(szLinecharsmax(szLine), "^n");
        
menu_additem(menuszLineszData);
    }


    
menu_additem(menu"a""$");
    
menu_additem(menu"b""%");

    
menu_display(idmenu);



kww 09-11-2022 12:08

Re: new menus bug?
 
Thank you. Anyways, someone should fix it

fysiks 09-11-2022 16:51

Re: new menus bug?
 
menu_addblank(menu, 1) and menu_addblank2(menu) did the same thing ("a" and "b" are at 6 and 7) for me and never shifted the exit button (the exit button stayed at 0).

menu_addblank(menu, 0) puts "a" and "b" at 5 and 6 but does shift the exit button to 9.

I could not get it to shift the exit button to 11.

kww 09-12-2022 10:29

Re: new menus bug?
 
Quote:

Originally Posted by fysiks (Post 2788588)
I could not get it to shift the exit button to 11.

I don't know how I moved it, but now I can't reproduce that
In the code it looked like below and was shifted to 11
PHP Code:

public Menu_Frontend(id)
{
    new 
menu menu_create("\yWhat da dog doin?""Menu_Backend");
    new 
szLine[17], szData[4];

    for(new 
ieControllersi++)
    {
        
formatex(szLinecharsmax(szLine), "%i"i);
        
formatex(szDatacharsmax(szData), "#%i"i);
        
menu_additem(menuszLineszData__);
    }

    
menu_addblank2(menu);

    
menu_additem(menu"Load""$"__);
    
menu_additem(menu"Reset""%"__);

    
menu_display(idmenu);


Quote:

Originally Posted by lexzor (Post 2788521)
expecting eList is an int variable you can check if the current item that will be listed is the last item that should be listed and add ^n at the end of his name. i think this is the best option to add a blank in the menu

PHP Code:

public Menu_Frontend(id)
{
    new 
menu menu_create("\yWhat da dog doin?""Menu_Backend");
    new 
szLine[17], szData[4];

    for(new 
ieListi++)
    {
        
formatex(szLinecharsmax(szLine), "%i"i);
        
formatex(szDatacharsmax(szData), "#%i"i);
        if(
== eList 1add(szLinecharsmax(szLine), "^n");
        
menu_additem(menuszLineszData);
    }

    
menu_additem(menu"a""$");
    
menu_additem(menu"b""%");

    
menu_display(idmenu);



After test, adding ^n doesn't seem to work in menu items


All times are GMT -4. The time now is 15:35.

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