Raised This Month: $ Target: $400
 0% 

Solved Combine the menus


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 05-22-2021 , 18:25   Re: Combine the menus
Reply With Quote #5

Quote:
Originally Posted by fysiks View Post
you shouldn't be checking flags in the handler, check them before you show the menu and don't show the menu at all if they don't have access..
Oops, i will fix that !

Quote:
Originally Posted by fysiks View Post
You have to set and keep track of the the menu type for all players (e.g. in a global variable) which you are not even attempting to do. So, currently the handler doesn't know how to handle a menu item selection.

Finally, you're printing a message saying "you don't have access" even though you just performed the action.
I don't want to do this, an example for what i want to do is adding three commands for one menu:

Code:
 Calling same function     register_clcmd( "say /manage", "PlayerRank", ADMIN_RCON);     register_clcmd( "say /rr", "PlayerRank", ADMIN_RCON );      register_clcmd( "say /xplist", "PlayerRank", ADMIN_ALL ); public PlayerRank(id, iLevel, iCid) {  Check who can use that command     if(!cmd_access(id, iLevel, iCid, 1))     {         return PLUGIN_HANDLED     }     new iPlayers[MAX_PLAYERS], iPnum, szUserID[32], szTitle[128], iMenu      Check which command did player chose  if user use "/manage, /rr ,/xplist" command will open the same menu and calling the same handler     switch ( iMenu )     {         case CHECK_RANK:         {             MenuTitle("\yRank System: \rXP List")         }         case RESET_RANK:         {             MenuTitle("\yRank System: \rReset Data")         }         case MANAGE_RANK:         {             MenuTitle("\yRank System: \rManage Players")         }     }         iMenu = menu_create(szTitle, "Handler")     get_players(iPlayers, iPnum, "ch"); SortCustom1D(iPlayers, iPnum, "sort_players_by_xp")         for(new szItem[1024], iPlayer, i; i < iPnum; i++)     {         iPlayer = iPlayers[i]  EX: [ Player XP ] Player Name [ LvL , Rank ]         MenuInfo("\d[%i XP] \w%s \r[\yLevel %i: %s\r]")         formatex( szUserID, charsmax( szUserID ), "%d", get_user_userid(iPlayer))         menu_additem(iMenu, szItem, szUserID)     }         menu_setprop(iMenu, MPROP_BACKNAME, "Previous page")     menu_setprop(iMenu, MPROP_NEXTNAME, "Next page")     menu_setprop(iMenu, MPROP_EXITNAME, "\rClose")     menu_display(id, iMenu)     return PLUGIN_HANDLED } public Handler(id, iMenu, iItem) {     new iAccess, iCallback, iData[6],iName[64];         menu_item_getinfo(iMenu, iItem, iAccess, iData, charsmax(iData), iName, charsmax(iName), iCallback);         new iPlayer = str_to_num(iData);         switch ( iMenuMode )     {         case CHECK_RANK:         {  If user use /xplist command and choose player will close the menu             return PLUGIN_HANDLED         }         case RESET_RANK:         {  If user use  /rr command and choose player will reset his data             ResetPlayerRank(id, iPlayer);         }         case MANAGE_RANK:         {  If user use /manage command and choose player will open new menu have all ranks and select which rank want to change that player to             ManagePlayerRank(id, iPlayer);         }     }     menu_destroy(iMenu)     return PLUGIN_HANDLED }
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.

Last edited by Supremache; 05-22-2021 at 18:35.
Supremache 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 02:37.


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