Raised This Month: $ Target: $400
 0% 

Menu Problems


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 05-30-2007 , 15:57   Menu Problems
Reply With Quote #1

Can someone plz show me how to create a menu and read the input from the user and switch the key to go to different menus...i dont know what im doing wrong...well i do, but i dont know how to read what the user hits...here is what i have.

Code:
public plugin_init() {     register_plugin(Plugin, Version, Author);         register_clcmd("say /rewards", "cmdrewardsmenu", ADMIN_ALL, "")     register_clcmd("say_team /rewards", "cmdrewardsmenu", ADMIN_ALL, "")         TeamInfo = get_user_msgid("TeamInfo");     SayText = get_user_msgid("SayText");     MaxSlots = get_maxplayers();     rewardsMenu = menu_create("Which rewards shall you purchase?", "show_rewardsMenu");     menu_additem(rewardsMenu, "Administrative Rewards", "1", 0, -1);     menu_additem(rewardsMenu, "Player Rewards", "2", 0, -1);     menu_additem(rewardsMenu, "Bunny Hop Rewards", "3", 0, -1);     menu_additem(rewardsMenu, "Fun Stuff", "4", 0, -1);         adminMenu = menu_create("Admin Rewards", "rewards_admin");     menu_additem(adminMenu, "FULL Admin Rights     - 10,000 Points", "1", 0, -1);     menu_additem(adminMenu, "Partial Admin Rights  -  5,000 Points", "2", 0, -1);     menu_additem(adminMenu, "Limited Admin Rights  -  1,000 Points", "3", 0, -1);     playerMenu = menu_create("Player Rewards", "rewards_player");     menu_additem(playerMenu, "Custom Player Model  - 2,500 Points", "1", 0, -1);     menu_additem(playerMenu, "Brass Knuckles       -   900 Points", "2", 0, -1);     bunnyhopMenu = menu_create("Bunny Hop Rewards", "rewards_bunnyhop");     menu_additem(bunnyhopMenu, "Auto Bunny Hop     - 250 Points", "1", 0, -1);     funMenu = menu_create("Fun Rewards", "rewards_fun");     menu_additem(funMenu, "Invincible           -   750 Points", "1", 0, -1);     menu_additem(funMenu, "Invisibility         -   750 Points", "2", 0, -1);     menu_additem(funMenu, "Teleport             -   500 Points", "3", 0, -1);     menu_additem(funMenu, "No Clip              -   500 Points", "4", 0, -1);     menu_additem(funMenu, "Hook                 -   500 Points", "5", 0, -1);     menu_additem(funMenu, "Low Gravity          -   250 Points", "4", 0, -1);     menu_additem(funMenu, "Parachute            -   250 Points", "7", 0, -1);     menu_additem(funMenu, "Glow                 -    50 Points", "8", 0, -1);     menu_additem(funMenu, "Trail                -    50 Points", "9", 0, -1); }

Code:
public cmdrewardsmenu(id, level, cid) {     if( !cmd_access(id, level, cid, 1) )     {         return PLUGIN_HANDLED;     }         menu_display(id, rewardsMenu, 0);         return PLUGIN_HANDLED; }

Code:
public show_rewardsMenu(id, menu, item) {     //i dont know what to do here...to read user input     new key;     switch( key )     {             case '-':         {             return PLUGIN_HANDLED;         }         case '1':         {             menu_display(id, adminMenu, 0);         }         case '2':         {             menu_display(id, playerMenu, 0);         }         case '3':         {                 menu_display(id, bunnyhopMenu, 0);         }         case '4':         {                 menu_display(id, funMenu, 0);         }         case '5':         {             show_points(id);         }     }         return PLUGIN_HANDLED; }
bwgrubbs1 is offline
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 05-30-2007 , 16:56   Re: Menu Problems
Reply With Quote #2

I get the main menu to come up if i type /rewards

Which rewards shall you purchase?
1. Admin Rewards
2. Player Rewards
3. Bunny Hop Rewards
4. Fun Rewards
5. Exit

But when i hit a key it just exits out of the menu.

Here is one of the Sub menus...not completed yet.

Code:
public rewards_fun(id) {         new key;     switch( key )     {             case '-':         {             return PLUGIN_HANDLED;         }         case '1':         {             //invincible             client_print(id,print_chat,"INVINCIBILITY COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '2':         {             //invisible             client_print(id,print_chat,"INVISIBILITY COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '3':         {                 //teleport             client_print(id,print_chat,"TELEPORT COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '4':         {                 //no clip             client_print(id,print_chat,"NO CLIP COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '5':         {             //hook             client_print(id,print_chat,"HOOK COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '6':         {             //low grav             client_print(id,print_chat,"LOW GRAVITY COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '7':         {             //parachute             client_print(id,print_chat,"PARACHUTE COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '8':         {                 //glow             client_print(id,print_chat,"GLOW COMMING SOON")             menu_display(id, rewardsMenu, 0);         }         case '9':         {                 //trail             client_print(id,print_chat,"TRAIL COMMING SOON")             menu_display(id, rewardsMenu, 0);         }     }         return PLUGIN_HANDLED }
bwgrubbs1 is offline
slmclarengt
Veteran Member
Join Date: Jul 2004
Location: The Cookie Jar... or Pul
Old 05-30-2007 , 17:08   Re: Menu Problems
Reply With Quote #3

Take a look at mapsmenu.sma and look at the function displayVoteMapsMenu as it contains this type of information. There are plenty of plugins that use menus to reference - just look around. Most of them are probably easier to read than mapsmenu :-).

Slmclarengt
__________________
But we don’t beat the Reaper by living longer. We beat the Reaper by living well. -Dr. Randy Pausch, R.I.P.

Come play WC3:FT on BnD Clan Server! You know you want to: Connect to WC3:FT BnD - go ahead click me!
slmclarengt is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-30-2007 , 18:51   Re: Menu Problems
Reply With Quote #4

Take a look at my Jump Menu plugin: http://forums.alliedmods.net/showthread.php?p=214497
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 05-30-2007 , 23:04   Re: Menu Problems
Reply With Quote #5

ok, well i still don't understand what I am doing wrong. I can get the main menu to show, but when i hit a key to go to a sub menu, it exits the menu...how do i make this go to the next menu?
bwgrubbs1 is offline
bwgrubbs1
Senior Member
Join Date: Sep 2006
Old 05-30-2007 , 23:17   Re: Menu Problems
Reply With Quote #6

nvm, i got it, did some searching around. thx tho your jump menu helped
bwgrubbs1 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 10:41.


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