Raised This Month: $ Target: $400
 0% 

Menu problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
josjau
Junior Member
Join Date: Oct 2006
Old 10-30-2006 , 13:01   Menu problem
Reply With Quote #1

Ok simple problem I canno seem to resolve...

This menu is working correctly EXCEPT the back option.

When I hit 0 to go back, it just closes my menu. I can go forward to all the menus, but the back function just closes the menu. Any help would be great.

Code:
/* Plugin Created by Dethmaul <div align="left"> This plugins is a heavily modified version of admin_aimmenu. Usage: Bind keys to : amx_aimadminmenu, amx_lastadminmenu Aim at desired target and then press the key to bring up the Point Menu The amx_lastadminmenu basicly recalls the last targeted player (Allows you to quickly target a player that was kicked - as long as you haven't selected a new target since kicking the last perpetrator.) This plugins requires the following other plugins to work correctly: dod_eviladmin, amx_forcequit, & spray_management to work correctly.   */ #include <amxmodx> #include <amxmisc> /* ******************************* Define section *********************************** */ #define MaxPlayers 20            // Max players #define BanTime 10            // How long the Temp ban should last #define LastAdminTarget 1        // Include amx_lastadminmenu code #define SlapDMG 0                // How much dmg the slap does /* ******************************* Define section end *********************************** */ new g_AdminTarget[MaxPlayers+1]        // Used to store the target, a array is used incase 2+ admins use the menu at the same time. new g_LastTarget[MaxPlayers+1]        // Contains the ID of the last admin target. public plugin_init() {     register_plugin("AMX Point Mneu","1.0","Dethmaul")     register_menucmd(register_menuid("\rPoint Menu"),1023,"aimadminmenu")     register_menucmd(register_menuid("\rMenu Two"),1023,"aimadminmenutwo")     register_menucmd(register_menuid("\rThird Menu"),1023,"aimadminmenutre")     register_clcmd("amx_aimadminmenu","cmdAimAdminmenu",ADMIN_BAN,"Loads adminmenu based on who your aiming at") #if LastAdminTarget == 1     register_clcmd("amx_lastadminmenu","cmdLastAdminTarget",ADMIN_BAN,"Loads adminmenu based on the last player a admin action was taken agaist") #endif     } public DisplayAimAdminmenu(id) {     new menuBody[512],VictimName[33],len     get_user_name(g_AdminTarget[id],VictimName,32)     new keys     len = format(menuBody,2047,"\rPoint Menu^nTarget aquired:  %s^n^n",VictimName)     len += format(menuBody[len],2047 - len,"\w1. Make Player Glow/Not Glow^n" )     len += format(menuBody[len],2047 - len,"\w2. Slap Player (%d Damage)^n",SlapDMG )     len += format(menuBody[len],2047 - len,"\w3. Change Player Name to DoDUser^n" )     len += format(menuBody[len],2047 - len,"\w4. Bury/Unbury Player^n" )     len += format(menuBody[len],2047 - len,"\w5. Change Player Vision^n" )     len += format(menuBody[len],2047 - len,"\w6. Force Melee/Regular^n" )     len += format(menuBody[len],2047 - len,"\w7. Change Player Run Speed^n^n" )     len += format(menuBody[len],2047 - len,"\w8. More^n^n^n" )     len += format(menuBody[len],2047 - len,"\w0. Exit" )     keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)     show_menu(id,keys,menuBody)         return PLUGIN_HANDLED } public DisplayAimAdminmenutwo(id) {     new menuBody[512],VictimName[33],len     get_user_name(g_AdminTarget[id],VictimName,32)     new keys2     len = format(menuBody,2047,"\rMenu Two^nTarget aquired:  %s^n^n",VictimName)     len += format(menuBody[len],2047 - len,"\w1. MegaSlap Player^n" )     len += format(menuBody[len],2047 - len,"\w2. Mirror Damage On/Off^n" )     len += format(menuBody[len],2047 - len,"\w3. Kick Player^n" )     len += format(menuBody[len],2047 - len,"\w4. Reduce HP to 1.^n" )     len += format(menuBody[len],2047 - len,"\w5. Disable Player Prone^n" )     len += format(menuBody[len],2047 - len,"\w6. Force Tag Spray^n" )     len += format(menuBody[len],2047 - len,"\w7. Disable Player Spray^n^n" )     len += format(menuBody[len],2047 - len,"\w8. More^n^n^n" )     len += format(menuBody[len],2047 - len,"\w0. Back" )     keys2 = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)     show_menu(id,keys2,menuBody)         return PLUGIN_HANDLED } public DisplayAimAdminmenutre(id) {     new menuBody[512],VictimName[33],len     get_user_name(g_AdminTarget[id],VictimName,32)     new keys3     len = format(menuBody,2047,"\rThird Menu^nTarget aquired:  %s^n^n",VictimName)     len += format(menuBody[len],2047 - len,"\w1. Reenable Player Spray^n" )         len += format(menuBody[len],2047 - len,"\w2. Display Rules to Player^n" )     len += format(menuBody[len],2047 - len,"\w3. Slay Player (Explosion!)^n" )     len += format(menuBody[len],2047 - len,"\w4. Kick Player (Evil)^n" )     len += format(menuBody[len],2047 - len,"\w5. Ban Player 10 Mins.^n" )     len += format(menuBody[len],2047 - len,"\w6. Ban Player Permanently^n" )     len += format(menuBody[len],2047 - len,"\w7. Mute/Unmute Player^n" )     len += format(menuBody[len],2047 - len,"\w8. Shutdown Steam^n^n^n" )         len += format(menuBody[len],2047 - len,"\w0. Back" )     keys3 = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)     show_menu(id,keys3,menuBody)         return PLUGIN_HANDLED } public aimadminmenu(id,key) {     if (!is_user_connected(g_AdminTarget[id])){         client_print(id,print_center,"This player has left the server")                 return PLUGIN_HANDLED         }         new param[2]     switch(key)     {         case 0:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilglow #%d",get_user_userid(g_AdminTarget[id]))             }                     case 1:             {             user_slap(g_AdminTarget[id],SlapDMG)             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             }                                 case 2:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_nick #%d DoDUser",get_user_userid(g_AdminTarget[id]))             }                 case 3:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilbury #%d",get_user_userid(g_AdminTarget[id]))             }                 case 4:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilvision #%d",get_user_userid(g_AdminTarget[id]))             }                 case 5:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilmelee #%d",get_user_userid(g_AdminTarget[id]))             }                     case 6:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilslowdown #%d",get_user_userid(g_AdminTarget[id]))             }                 case 7:             {             DisplayAimAdminmenutwo(id)             }     }     return PLUGIN_HANDLED } public aimadminmenutwo(id,key) {     if (!is_user_connected(g_AdminTarget[id])){         client_print(id,print_center,"This player has left the server")                 return PLUGIN_HANDLED         }         new param[2]     switch(key)     {         case 0:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilpimpslap #%d",get_user_userid(g_AdminTarget[id]))             }             case 1:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilmirrordmg #%d",get_user_userid(g_AdminTarget[id]))             }                     case 2:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_kick #%d",get_user_userid(g_AdminTarget[id]))             }                     case 3:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evillowhealth #%d",get_user_userid(g_AdminTarget[id]))             }                     case 4:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilnoprone #%d",get_user_userid(g_AdminTarget[id]))             }                 case 5:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_forcespray #%d",get_user_userid(g_AdminTarget[id]))             }                 case 6:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             new vAuthid[35]             new aName[32],aAuthid[35]             get_user_authid(g_AdminTarget[id],vAuthid,34)             get_user_authid(id,aAuthid,34)             get_user_name(id,aName,31)             server_cmd("amx_spray #%d 1",get_user_userid(g_AdminTarget[id]))             }                     case 7:             {             //client_cmd(id,"DisplayAimAdminmenutre")             DisplayAimAdminmenutre(id)             }                 case 8:             {             //client_cmd(id,"DisplayAimAdminmenu")             DisplayAimAdminmenu(id)             }     }             return PLUGIN_HANDLED }         public aimadminmenutre(id,key) {     if (!is_user_connected(g_AdminTarget[id])){         client_print(id,print_center,"This player has left the server")                 return PLUGIN_HANDLED         }         new param[2]     switch(key)     {         case 0:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             new vAuthid[35]             new aName[32],aAuthid[35]             get_user_authid(g_AdminTarget[id],vAuthid,34)             get_user_authid(id,aAuthid,34)             get_user_name(id,aName,31)             server_cmd("amx_spray #%d 0",get_user_userid(g_AdminTarget[id]))             }         case 1:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             client_cmd(g_AdminTarget[id],"say /rules")             }             case 2:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilslay #%d",get_user_userid(g_AdminTarget[id]))             }             case 3:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilkick #%d",get_user_userid(g_AdminTarget[id]))             }         case 4:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             new vAuthid[35]             new aName[32],aAuthid[35]             get_user_authid(g_AdminTarget[id],vAuthid,34)             get_user_authid(id,aAuthid,34)             get_user_name(id,aName,31)             server_cmd("amx_ban #%d 10",get_user_userid(g_AdminTarget[id]))             }                     case 5:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             new vAuthid[35]             new aName[32],aAuthid[35]             get_user_authid(g_AdminTarget[id],vAuthid,34)             get_user_authid(id,aAuthid,34)             get_user_name(id,aName,31)             server_cmd("amx_ban #%d 0",get_user_userid(g_AdminTarget[id]))             }         case 6:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_evilstfu #%d",get_user_userid(g_AdminTarget[id]))             }                 case 7:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             client_cmd(g_AdminTarget[id],"quit")             }             //{             //g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             //param[0] = g_AdminTarget[id]             //param[1] = id             //EchoAdminAction(param)             //new vAuthid[35]             //new aName[32],aAuthid[35]             //get_user_authid(g_AdminTarget[id],vAuthid,34)             //get_user_authid(id,aAuthid,34)             //get_user_name(id,aName,31)             //server_cmd("amx_forcequit #%d",get_user_userid(g_AdminTarget[id]))             //}                 case 8:             {             //client_cmd(id,"DisplayAimAdminmenutwo")             DisplayAimAdminmenutwo(id)             }     }             return PLUGIN_HANDLED }             public cmdAimAdminmenu(id,level,cid){ // This part of the code gets who the admin is aiming at, and checks for immmunity      if(!cmd_access (id,level,cid,1))       {       return PLUGIN_HANDLED      }      new TargetID,body      get_user_aiming(id,TargetID,body)        if (!TargetID){ // Checks to see if "TargetID" has any value, if it does not. Then the admin is not aiming at anyone.           client_print(id,print_center,"No valid target for Adminmenu")           return PLUGIN_HANDLED          }      if(access(TargetID, ADMIN_IMMUNITY)) {     //if (get_user_flags(TargetID) && ADMIN_IMMUNITY){ // Checks if the TargetID has admin immunity           client_print(id,print_center,"Target has admin immunity")           return PLUGIN_HANDLED          }        g_AdminTarget[id] = TargetID        DisplayAimAdminmenu(id)      return PLUGIN_HANDLED     } #if LastAdminTarget == 1 public cmdLastAdminTarget(id,level,cid){ // This code checks if g_LastTarget[id] has any value.  If it does, it opens the menu menu     if(!cmd_access (id,level,cid,1)) return PLUGIN_HANDLED     if (!g_LastTarget[id]){ // Checks to see if "TargetID" has any value, if it does not. Then the admin is not aiming at anyone.         client_print(id,print_center,"There is no last admin target.")         return PLUGIN_HANDLED         }     g_AdminTarget[id] = g_LastTarget[id]     DisplayAimAdminmenu(id)     return PLUGIN_HANDLED     } #endif </div>



Last edited by josjau; 10-30-2006 at 17:29.
josjau is offline
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-30-2006 , 16:25   Re: Menu problem
Reply With Quote #2

a couple things , firstly please post your code in [small] tags so we can read it , then breifly i noticed that you re-defined the keys many times. you can remove alot of that by simply declaring keys globaly at the top of your code like so ,
Code:
new keys = MENU_KEY_0 | MENU_KEY_1 | MENU_KEY_2
all the way till you hit 9 (so that all the key options are available)
Nostrodamous is offline
Da_sk8rboy
Veteran Member
Join Date: Jul 2006
Old 10-30-2006 , 16:31   Re: Menu problem
Reply With Quote #3

http://sniperbeamer.amxmod.info/menumaker/menumaker.htm?en

That can help you with making a menu easier
__________________
i stop around here and there.
Da_sk8rboy is offline
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-30-2006 , 16:35   Re: Menu problem
Reply With Quote #4

Broken Link ???
Nostrodamous is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-30-2006 , 16:48   Re: Menu problem
Reply With Quote #5

Just use the menu generator in AMXX studio.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-30-2006 , 16:55   Re: Menu problem
Reply With Quote #6

Quote:
Originally Posted by Zenith77 View Post
Just use the menu generator in AMXX studio.
or learn how to do them the right way (personaly I dont like the style of the menu generator I use XeroBloods version of making menus ) but the generator is good for noobs that need menus
Nostrodamous is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-30-2006 , 17:27   Re: Menu problem
Reply With Quote #7

I fear you have no clue what you're talking about.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
josjau
Junior Member
Join Date: Oct 2006
Old 10-30-2006 , 17:43   Re: Menu problem
Reply With Quote #8

Would defining my keys globally like this help?
I know this is probably a newby issue, but this is my first plugin.

Code:
new keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)
josjau is offline
Nostrodamous
BANNED
Join Date: Oct 2006
Old 10-30-2006 , 18:33   Re: Menu problem
Reply With Quote #9

yes defning variables gloably when you use the same thing localy (in one function liek you did) , more then once , saves memeory and cleasn up your code and makes the easier to read. every time you declare a varaible it allocates spcae for the varailbe , so its good programming habitts to use hongarian notion ( g_ = global , i = interger) , to make it easier .
Nostrodamous is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 10-30-2006 , 19:33   Re: Menu problem
Reply With Quote #10

You should also practice good grammar habits .
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 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 04:45.


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