Raised This Month: $ Target: $400
 0% 

How do I display a menu in a module?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-08-2005 , 00:14   How do I display a menu in a module?
Reply With Quote #1

Basically ask the question asks, if I try UTIL_ShowMenu, I get an identifier not found...

Is there another way?

Also, after I display the menu, how can I catch the result?

Thanks,
Josh
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 04-08-2005 , 08:07  
Reply With Quote #2

Get the UTIL_ShowMenu from AMXX / HLSdk ;)

You have to catch the menuselect commands. If the user presses 2, you get:

menuselect 2

Or something.
__________________
hello, i am pm
PM is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-08-2005 , 16:41  
Reply With Quote #3

so I won't know if the user like opens my menu... then say presses the button for the radio button, will I still get the same result?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 04-08-2005 , 17:11  
Reply With Quote #4

OK I thought I had it working but I get an error on the following line:

Code:
void UTIL_ShowMenu( edict_t* pEdict, int slots, int time, char *menu, int mlen ) {     char *n = menu;     char c = 0;     int a;     if (!gmsgShowMenu)         return;                         // some games don't support ShowMenu (Firearms)     while ( *n ) {         a = mlen;         if ( a > 175 ) a = 175;         mlen -= a;         c = *(n+=a);         *n = 0;                                     <<<<< Crashes here         MESSAGE_BEGIN( MSG_ONE , gmsgShowMenu, NULL, pEdict );         WRITE_SHORT( slots );         WRITE_CHAR( time );         WRITE_BYTE( c ? TRUE : FALSE);         WRITE_STRING( menu );         MESSAGE_END();         *n = c;         menu = n;     } }

I invoke it with:

Code:
    char *pimp = " Yo YO YO\n\0";     UTIL_ShowMenu(pEntity, (0<<1), -1, pimp, (int)strlen(pimp));

Any suggestions?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 05-08-2005 , 10:26  
Reply With Quote #5

Quote:
Originally Posted by Geesu
Code:
    char *pimp = " Yo YO YO\n\0";
delete the '\0' from your code.
if u write it in quotes, then it has automatically an '\0'.

in your pimp array u will see this:
Code:
  char *pimp = { ' ', 'Y', 'o', ' ', 'Y',  'O', ' ', 'Y',  'O', '\n', '\0', '\0' };
You see, that u have 2 '\0'. Ok it costs only 1 byte more of RAM, but if u have to code on things like an micromaster, there you dont have much of ram^^.

so just write:
Code:
    char *pimp = " Yo YO YO\n";
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
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 11:30.


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