Raised This Month: $ Target: $400
 0% 

get_concmd problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Salin
Member
Join Date: Nov 2007
Old 02-20-2009 , 09:36   get_concmd problem
Reply With Quote #1

Hi, I`m having a little problem with get_concmd.


I registered (let`s say) 11 commands. At my 11th command I made the amx_help for those commands.

PHP Code:
register_concmd("amx_1""func_1"ADMIN_LEVEL_C"Some info")
register_concmd("amx_0""func_0"ADMIN_LEVEL_C"Some info")
register_concmd("amx_3""func_3"ADMIN_LEVEL_C"Some info")
register_concmd("amx_2""func_2"ADMIN_LEVEL_C"Some info")
register_concmd("amx_4""func_4"ADMIN_LEVEL_C"Some info")
register_concmd("amx_5""func_5"ADMIN_LEVEL_C"Some info")
register_concmd("amx_6""func_6"ADMIN_LEVEL_C"Some info")
register_concmd("amx_7""func_7"ADMIN_LEVEL_C"Some info")
register_concmd("amx_8""func_8"ADMIN_LEVEL_C"Some info")
register_concmd("amx_9""func_9"ADMIN_LEVEL_C"Some info")
register_concmd("amx_example""func_help"ADMIN_LEVEL_C"Some info"
The func_help function is like this:

PHP Code:
public func_help(idlevelcid)
{
    new 
p_Flag get_user_flags(id0)
    
    new 
cmd[32], eflagsinfo[128]
    
    new 
start 0
    
    
new nrofcmds get_concmdsnum(p_Flagid)
    
    for(new 
i=starti<nrofcmdsi++)
    {
        
get_concmd(icmd31eflagsinfo127p_Flagid)
        
client_print(idprint_chat"Command: %s"cmd)
    }
    
    return 
PLUGIN_HANDLED

So basically what the function does is showing all the commands, sorted alphabetically, asc. The only problem is, it is now showing the amx_1 command in the output.

The output is something like this:

Code:
Command: amx_0
Command: amx_2
Command: amx_3
Command: amx_4
Command: amx_5
Command: amx_6
Command: amx_7
Command: amx_8
Command: amx_9
Command: amx_example
I`ve noticed that if I put instead of:

PHP Code:
    for(new i=starti<nrofcmdsi++)
    {
        
get_concmd(icmd31eflagsinfo127p_Flagid)
        
client_print(idprint_chat"Command: %s"cmd)
    } 
this one

PHP Code:
         get_concmd(-5cmd31eflagsinfo127p_Flagid)
         
client_print(idprint_chat"Command: %s"cmd
I can see the amx_1 command.

What should I do to fix this?

Last edited by Salin; 02-20-2009 at 09:41.
Salin is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 02-20-2009 , 11:40   Re: get_concmd problem
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> public plugin_init() {     register_plugin("Command Example", "1.0", "Spunky")     register_concmd("amx_1", "func_1", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_0", "func_0", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_3", "func_3", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_2", "func_2", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_4", "func_4", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_5", "func_5", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_6", "func_6", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_7", "func_7", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_8", "func_8", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_9", "func_9", ADMIN_LEVEL_C, "Some info")     register_concmd("amx_example", "func_help", ADMIN_LEVEL_C, "Some info") } public func_0(id, level, cid)     return PLUGIN_HANDLED public func_1(id, level, cid)     return PLUGIN_HANDLED public func_2(id, level, cid)     return PLUGIN_HANDLED public func_3(id, level, cid)     return PLUGIN_HANDLED public func_4(id, level, cid)     return PLUGIN_HANDLED public func_5(id, level, cid)     return PLUGIN_HANDLED public func_6(id, level, cid)     return PLUGIN_HANDLED public func_7(id, level, cid)     return PLUGIN_HANDLED public func_8(id, level, cid)     return PLUGIN_HANDLED public func_9(id, level, cid)     return PLUGIN_HANDLED public func_help(id, level, cid) {     if (!cmd_access(id, level, cid, 1))         return PLUGIN_HANDLED     new szCmd[32], iFlags, szInfo[128], iIndex = 0     while (get_concmd(iIndex++, szCmd, 31, iFlags, szInfo, 127, -1, -1))         console_print(id, "Command: %s", szCmd)     return PLUGIN_HANDLED }

Untested, but try it.
Spunky is offline
Send a message via AIM to Spunky
Salin
Member
Join Date: Nov 2007
Old 02-23-2009 , 03:25   Re: get_concmd problem
Reply With Quote #3

This still skips that registered command and now i see different:

Code:
Command: amx_0
Command: amx_0
Command: amx_2
Command: amx_2
Command: amx_3
Command: amx_3
Command: amx_4
Command: amx_4
Command: amx_5
Command: amx_5
Command: amx_6
Command: amx_6
Command: amx_7
Command: amx_7
Command: amx_8
Command: amx_8
Command: amx_9
Command: amx_9
Command: amx_example
So, any other commands, i see them doubled, but the help command i see it just once.

On your example i can see all the commands even those i don`t have access to. Looks ok but i still have 2 commands that aren`t mine (amx_addadmin and amx_reloadadmins).

Last edited by Salin; 02-23-2009 at 05:57.
Salin is offline
Spunky
Senior Member
Join Date: May 2008
Location: Orlando, Fl.
Old 02-23-2009 , 18:50   Re: get_concmd problem
Reply With Quote #4

Code:
while (get_concmd(iIndex++, szCmd, 31, iFlags, szInfo, 127, -1, -1) && iIndex < 11)

I really have no idea why amx_1 won't display...
Spunky is offline
Send a message via AIM to Spunky
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 17:02.


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