Raised This Month: $ Target: $400
 0% 

Solved new menus bug?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 09-10-2022 , 14:44   new menus bug?
Reply With Quote #1

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



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

__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 09-11-2022 at 12:08.
kww is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 09-10-2022 , 18:36   Re: new menus bug?
Reply With Quote #2

don t use a native, just add ^n at the end of the item name
lexzor is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 09-10-2022 , 18:38   Re: new menus bug?
Reply With Quote #3

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);

__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 09-10-2022 at 18:41.
kww is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 09-10-2022 , 19:17   Re: new menus bug?
Reply With Quote #4

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);


Last edited by lexzor; 09-10-2022 at 19:17.
lexzor is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 09-11-2022 , 12:08   Re: new menus bug?
Reply With Quote #5

Thank you. Anyways, someone should fix it
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951
kww is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-11-2022 , 16:51   Re: new menus bug?
Reply With Quote #6

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.
__________________
fysiks is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 09-12-2022 , 10:29   Re: new menus bug?
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
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 View Post
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
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951

Last edited by kww; 09-14-2022 at 13:33.
kww is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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