AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Plugin compiles but no valid command in game (https://forums.alliedmods.net/showthread.php?t=45545)

josjau 10-05-2006 10:28

[HELP] Plugin compiles but no valid command in game
 
SO. This plugin is a edit of EKS admin_aimmenu to fit my server environment

As far as I can tell, everything seems to be right. It compiles fine, says it is running on the server, but when I go to run the menu from the console, it gives an invalid command.

Rolnaaba 10-05-2006 10:52

Re: [HELP] Plugin compiles but no valid command in game
 
try using
Code:
register_concmd("amx_pointmenu", "cmdPointMenu", ADMIN_LEVEL_B)

Zenith77 10-05-2006 12:24

Re: [HELP] Plugin compiles but no valid command in game
 
Um no, you need to return PLUGIN_HANDLED, not PLUGIN_CONTINUE in your command hooks.

josjau 10-05-2006 12:46

Re: [HELP] Plugin compiles but no valid command in game
 
I have made the command hook changes and will test them when I get off work. I will let you know if that fixed the issue. Thank you.

josjau 10-05-2006 20:34

Re: [HELP] Plugin compiles but no valid command in game
 
OK the plugin now loads and menus show up but all actions chosen on menu just close the menu. I cannot find an error message

Code:
/* Plugin Created by Dethmaul 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 basicaly 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 // If you want to change the command sent to the client to show the rules search for "amx_publicrules" /* ******************************* 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("Aim Adminmenu"),1023,"aimadminmenu")     //register_concmd("amx_pointmenu", "cmdPointMenu", ADMIN_LEVEL_B, "Amx_pointmenu Options First..")     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 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_evilpimpslap #%d",get_user_userid(g_AdminTarget[id]))             }                 }     return PLUGIN_HANDLED     } public DisplayAimAdminmenu(id){     new menuBody[512],VictimName[33],len     get_user_name(g_AdminTarget[id],VictimName,32)     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" )     len += format(menuBody[len],2047 - len,"\w8. MegaSlap Player^n^n^n" )     len += format(menuBody[len],2047 - len,"\w0. Exit" )     new 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)     } 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

Zenith77 10-05-2006 21:21

Re: [HELP] Plugin compiles but no valid command in game
 
That's because you need to add this to your switch statements or something else somehow:

Code:
DisplayAimAdminmenu(id);

This will re-open the menu when they press a key.

josjau 10-05-2006 22:12

Re: [HELP] Plugin compiles but no valid command in game
 
I dont have a problem with the menu closing. Its supposed to do that after a key press, the problem is when I select an option from the menu nothing happens... the menu closes and no action is taken

Xanimos 10-05-2006 22:52

Re: [HELP] Plugin compiles but no valid command in game
 
change
Quote:

Originally Posted by josjau (Post 388040)
Code:
    register_menucmd(register_menuid("Aim Adminmenu"),1023,"aimadminmenu")

to
Code:
    register_menucmd(register_menuid("\rPoint Menu"),1023,"aimadminmenu")

josjau 10-06-2006 00:59

Re: [HELP] Plugin compiles but no valid command in game
 
That fixed the issue. This was my first plugin so I knew I was overlooking something simple

josjau 10-06-2006 01:07

Re: [HELP] Plugin compiles but no valid command in game
 
Just one more I promise to quit being a bother

I added another case
Code:
case 7:             {             g_LastTarget[id] = g_AdminTarget[id]             //param[0] = 0             param[0] = g_AdminTarget[id]             param[1] = id             //EchoAdminAction(param)             server_cmd("amx_forcequit #%d",get_user_userid(g_AdminTarget[id]))             }

For some reason if I enter amx_forcequit <playername> in console the command runs, but if I try to run it from the menu it does nothing. Any ideas on a better way to get the <playername> from my plugin


All times are GMT -4. The time now is 04:57.

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