Raised This Month: $51 Target: $400
 12% 

Menu Problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 07-11-2010 , 13:49   Menu Problem
Reply With Quote #1

For some reason all numbers returns fine for LineData, but on the second page, which would be labeled "Number 10" and every line above that are blank. The var LineText is also blank for 10+. Wth?
So my menus looks like

Quote:
NS Achievements 1/7

1. Number 1
2. Number 2
3. Number 3
4. Number 4
5. Number 5
6. Number 6
7. Number 7

#.Back
9.More
0.Exit
Quote:
NS Achievements 2/7

1. Number 8
2. Number 9
3.
4.
5.
6.
7.

8.Back
9.More
0.Exit
Quote:
NS Achievements 3/7

1.
2.
3.
4.
5.
6.
7.

8.Back
9.More
0.Exit
Code:
public help_menu(id,page) {     new title[24];     formatex(title,sizeof(title),"NS Achievements - v%s -",VERSION);             new menu = menu_create(title, "menu_a_main_handler");         for(new i=1; i<=45;i++)     {         new line_text[16];         formatex(line_text,sizeof(line_text),"Number %i",i);                 new line_data[2];         formatex(line_data,sizeof(line_data),"%i",i);                 menu_additem(menu, line_text, line_data);     }     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);     menu_display(id, menu, page); } public menu_a_main_handler(id, menu, item) {     if(item == MENU_EXIT)     {         menu_destroy(menu);         return PLUGIN_HANDLED;     }     new LineText[32],LineData[32], access, callback;     menu_item_getinfo(menu, item, access, LineData, sizeof(LineData), LineText, sizeof(LineText), callback);             client_print(id,print_chat,"Menu: title(%s) data(%s) callback(%d) access(%d)",LineText,LineData,callback,access);     menu_destroy(menu);         return PLUGIN_HANDLED; }
__________________


Last edited by mysticssjgoku4; 07-11-2010 at 14:15.
mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 07-11-2010 , 15:09   Re: Menu Problem
Reply With Quote #2

I tried moving the variables outside the loop, didn't help at all.
Then I tried switching from formatex to format, didn't help.
For some reason... sizeof(x) in a loop as in the code above creates an issue. Perhaps a bug?

This works for both line_text and line_data.
Code:
    new line_text[16], line_data[2];     for(new i=1; i<=45;i++)     {         format(line_text,15,"Number %i",i);         format(line_data,1,"%i",i);

This only works for line_data, while line_text is blank.
Code:
    new line_text[16], line_data[2];     for(new i=1; i<=45;i++)     {         format(line_text,sizeof(line_text),"Number %i",i);         format(line_data,sizeof(line_data),"%i",i);
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-11-2010 , 16:30   Re: Menu Problem
Reply With Quote #3

btw, it should be sizeof() - 1
__________________
fysiks is online now
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 07-11-2010 , 22:27   Re: Menu Problem
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
btw, it should be sizeof() - 1
Maybe that's why I had an issue.
Anyone know how to make a menu without an items in it with the newer menu system? It wont show up unless I have an item added to it, but I only want text, a back button for main menu, and exit button.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-11-2010 , 23:35   Re: Menu Problem
Reply With Quote #5

Look in newmenus.inc, your answer is there.
__________________
fysiks is online now
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 07-12-2010 , 01:20   Re: Menu Problem
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Look in newmenus.inc, your answer is there.
How original. I've studied it for hours, I have the exit button, just can't figure out how to have a custom button back button at the bottom that allows you go to a specific function.
Also wont let me show the menu without having options. What is the point of this new menu if I can't have a fully dynamic approach to everything? Perhaps it just was overlooked when they created it.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-12-2010 , 01:36   Re: Menu Problem
Reply With Quote #7

Just a little thing :

formatex(line_data,sizeof(line_data),"%i",i);

->

num_to_str(i, line_data, charsmax(line_data))
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 07-12-2010 , 02:04   Re: Menu Problem
Reply With Quote #8

Quote:
Originally Posted by ConnorMcLeod View Post
Just a little thing :

formatex(line_data,sizeof(line_data),"%i",i);

->

num_to_str(i, line_data, charsmax(line_data))
Until I see proof num_to_str performs better I prefer formatex. Thank you.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 07-12-2010 , 03:03   Re: Menu Problem
Reply With Quote #9

Quote:
Originally Posted by mysticssjgoku4 View Post
Until I see proof num_to_str performs better I prefer formatex. Thank you.
If connor says it, that's proof enough for me
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 07-12-2010 , 05:24   Re: Menu Problem
Reply With Quote #10

Proof > Opinion
Don't care who it is.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
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 18:04.


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