Raised This Month: $ Target: $400
 0% 

Menu remaking


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-13-2013 , 17:58   Re: Menu remaking
Reply With Quote #4

Before my answer I just want to show people how a GOOD explanation looks like.
Quote:
Originally Posted by ~Ice*shOt
--------------------------------------------------
Here is main menu.
--------------------------------------------------
// All theses disabled
1. First [ Need 200 $ ]
2. Second [ Need 600 $ ]
3. Third [ Need 800 $ ]
4. Fourth [ Need 300 $ ]
--------------------------------------------------
For example I have 200 $ and press #1.
--------------------------------------------------
// #1 enabled, others disabled
1. First
2. Second [ Need 600 $ ]
3. Third [ Need 800 $ ]
4. Fourth [ Need 300 $ ]
--------------------------------------------------
Again press #1.
--------------------------------------------------
// All theses disabled
1. First [ Selected ]
2. Second [ Need 600 $ ]
3. Third [ Need 800 $ ]
4. Fourth [ Need 300 $ ]
--------------------------------------------------
Now I have collected 300 $ and press #4
--------------------------------------------------
// #4 enabled, others disabled
1. First [ Selected ]
2. Second [ Need 600 $ ]
3. Third [ Need 800 $ ]
4. Fourth
--------------------------------------------------
Again press #4
--------------------------------------------------
// #1 enabled, others disabled
1. First
2. Second [ Need 600 $ ]
3. Third [ Need 800 $ ]
4. Fourth [ Selected ]
//////////////
All this I've in two menus.. one needed
Here's my result:


This code won't allow you to chose "nothing" as soon as you chose something. Is that something you need?
And here is the code:
Code:
#include <amxmodx> #define MENUITEM_DISABLED   (1<<26) enum enumSelections {     name[32],     cost } new const g_Selections[][enumSelections] = {     { "First" , 100 },     { "Second" , 300 },     { "Third" , 50 },     { "Fourth" , 500 } }; new bool:g_Unlocked[33][sizeof g_Selections]; new g_Selected[33]; new g_Points[33]; public plugin_init() {     register_plugin("Dual Action Menu", "1.0", "[ --{-@ ]");     register_clcmd("menu", "cmd_menu");     register_clcmd("say /pts", "GivePts"); } public client_connect(id) {     g_Points[id] = 0;     g_Selected[id] = -1; } public GivePts(id) {     g_Points[id] += 100; } public cmd_menu(id) {     new menu = menu_create("\rHello pirate!", "menu_handler")     for ( new i = 0; i < sizeof g_Selections ; i++ ) {         new menuitem[64], menuitem_disable = 0;                 if ( g_Selected[id] == i ) {             formatex(menuitem, charsmax(menuitem), "\d%s   [SELECTED]", g_Selections[i][name])             menuitem_disable = MENUITEM_DISABLED;         }         else if ( g_Unlocked[id][i] )             formatex(menuitem, charsmax(menuitem), "\y%s", g_Selections[i][name])         else if ( g_Points[id] < g_Selections[i][cost] ) {             formatex(menuitem, charsmax(menuitem), "\d%s   \d[\r%d Pts\d]", g_Selections[i][name], g_Selections[i][cost])             menuitem_disable = MENUITEM_DISABLED;         }         else             formatex(menuitem, charsmax(menuitem), "\y%s   \d[\w%d Pts\d]", g_Selections[i][name], g_Selections[i][cost])                 menu_additem(menu, menuitem, "", menuitem_disable);     }         menu_display(id, menu, 0) } public menu_handler(id, menu, item) {     if ( item == MENU_EXIT ) {         menu_destroy(menu)         return PLUGIN_HANDLED     }         if ( g_Unlocked[id][item] ) {             g_Selected[id] = item;         client_print(id, print_chat, "You have selected %s", g_Selections[item][name]);                 return PLUGIN_CONTINUE     }         g_Points[id] -= g_Selections[item][cost];     g_Unlocked[id][item] = true;         client_print(id, print_chat, "You have unlocked %s", g_Selections[item][name]);         return PLUGIN_HANDLED }
Attached Thumbnails
Click image for larger version

Name:	pirate_menu.jpg
Views:	311
Size:	16.0 KB
ID:	124244  
__________________

Last edited by Black Rose; 08-13-2013 at 18:02.
Black Rose is offline
 



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:55.


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