Raised This Month: $ Target: $400
 0% 

concmd info


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-B1ng0-
Member
Join Date: Nov 2009
Old 10-24-2010 , 06:40   concmd info
Reply With Quote #1

Hey guys,

How i can get info of concmd.

Exemple:
i have:
register_concmd("amx_help", "cmdHelp", 0, "<page> [nr of cmds (only for server)] - displays this help")

and i want to get info to this command: <page> [nr of cmds (only for server)] - displays this help

i try with get_concmd but no results....


Ty.
-B1ng0- is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-24-2010 , 07:20   Re: concmd info
Reply With Quote #2

get_concmd() should work, how you use it ?
__________________
Arkshine is offline
-B1ng0-
Member
Join Date: Nov 2009
Old 10-24-2010 , 07:25   Re: concmd info
Reply With Quote #3

i have this:
Quote:
for (i = 0; i < g_Count; i++)
{
if (equali (arg, g_CmdsList[0][i], strlen (g_CmdsList[0][i])))
{
replace (arg, charsmax (arg), g_Slash, "");
formatex (command, charsmax (command),"amx_%s", arg);
client_cmd(id, command);

break;
}
}
and i whant when i type on of this commands: g_CmdsList[0][i] to get info of this, or show me how to get info only for one command like amx_help

Last edited by -B1ng0-; 10-24-2010 at 08:33.
-B1ng0- is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-24-2010 , 17:21   Re: concmd info
Reply With Quote #4

Looks like you would need to loop through all commands with get_concmd() and get_concmdsnum() to retreive the correct a single command info.

I would probably cache the command names and their associated indices in a Trie so that when I look for the one command it is quick and simple to get the index. Then with that index you would use get_concmd() to retrieve the information that you want.

Shouldn't be too hard to write one up.
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-24-2010 , 17:59   Re: concmd info
Reply With Quote #5

You can use this:
Code:
stock find_concmd_byname(const cmd[], &flags, info[], infolen, id = -1) {     new iIndex = -1, szCommand[ 32 ];         while( get_concmd( ++iIndex, szCommand, charsmax( szCommand ), flags, info, infolen, id ) )     {         if( equali( cmd, szCommand ) )         {             return iIndex;         }     }         flags = 0;     info[ 0 ] = 0;         return -1; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-24-2010 , 19:20   Re: concmd info
Reply With Quote #6

Much more compact than my method. Don't suppose that efficiency between yours and mine would be significant (ignoring plugin_cfg code to populate the trie)?
__________________
fysiks is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-24-2010 , 19:28   Re: concmd info
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
Much more compact than my method. Don't suppose that efficiency between yours and mine would be significant (ignoring plugin_cfg code to populate the trie)?
Really just depends on how much it is used.
I actually wouldn't use my function unless I'm using it for one command.
It would be better to imitate my function and filter the commands you want into the trie.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
-B1ng0-
Member
Join Date: Nov 2009
Old 10-25-2010 , 07:37   Re: concmd info
Reply With Quote #8

exolent can you show me an exemple with your stock metod!?
-B1ng0- is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-25-2010 , 10:56   Re: concmd info
Reply With Quote #9

PHP Code:
new iFlagsszInfo[40]
if( 
find_concmd_byname("amx_hello"iFlagsszInfocharsmax(szInfo)) > -)
{
    
// command exists, info is in iFlags and szInfo

Just put the variables in there.
__________________

Last edited by fysiks; 10-25-2010 at 10:58.
fysiks 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 10:29.


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