Raised This Month: $ Target: $400
 0% 

Register Commands with Space


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
deadman909
Veteran Member
Join Date: Oct 2008
Old 07-18-2011 , 02:31   Register Commands with Space
Reply With Quote #1

Okay so just a simple question but how do you register commands with a space in them.

Example:
// This Command Works
register_clcmd( "say /ServerRules", "Rules" );


// But this command doesn't because there is a space between Server and Rules.
register_clcmd( "say /Server Rules", "Rules" );

// What I want to know is how to make it so this above command also works as well.
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2011 , 03:55   Re: Register Commands with Space
Reply With Quote #2

You might have to register just "say" then check there (however, this is less efficient but don't know how much).
__________________
fysiks is offline
deadman909
Veteran Member
Join Date: Oct 2008
Old 07-18-2011 , 04:21   Re: Register Commands with Space
Reply With Quote #3

You mean just put it like this

register_clcmd( "say", "Rules" );

//and than under put?
register_clcmd( "say /Server Rules", "Rules" );
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
Aykay
Senior Member
Join Date: Jul 2009
Location: Australia
Old 07-18-2011 , 04:57   Re: Register Commands with Space
Reply With Quote #4

Quote:
Originally Posted by deadman909 View Post
You mean just put it like this

register_clcmd( "say", "Rules" );

//and than under put?
register_clcmd( "say /Server Rules", "Rules" );
I think he means within the function called by 'say', check if "Server Rules" was the input and then call the "Rules" function.
__________________

Aykay is offline
Send a message via MSN to Aykay
deadman909
Veteran Member
Join Date: Oct 2008
Old 07-18-2011 , 05:06   Re: Register Commands with Space
Reply With Quote #5

Quote:
Originally Posted by Aykay View Post
I think he means within the function called by 'say', check if "Server Rules" was the input and then call the "Rules" function.
Thank you for your reply but can you give an example to what your trying to tell me?
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-18-2011 , 05:29   Re: Register Commands with Space
Reply With Quote #6

register "say", get arg string, check it is equal to "/Server Rules" else return PLUGIN_CONTINUE.
__________________
fysiks is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-18-2011 , 06:13   Re: Register Commands with Space
Reply With Quote #7

Wont this work ?
Code:
register_clcmd( "say ^"/Server Rules^"", "Rules" );
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
deadman909
Veteran Member
Join Date: Oct 2008
Old 07-18-2011 , 06:37   Re: Register Commands with Space
Reply With Quote #8

Quote:
Originally Posted by abdul-rehman View Post
Wont this work ?
Code:
register_clcmd( "say ^"/Server Rules^"", "Rules" );
It compiled but when I type the command still nothing happens.
__________________

deadman909 is offline
Send a message via MSN to deadman909 Send a message via Yahoo to deadman909
liinuus
Senior Member
Join Date: Apr 2010
Old 07-18-2011 , 07:44   Re: Register Commands with Space
Reply With Quote #9

Code:
/* Plugin generated by AMXX-Studio */ #include <amxmodx> #include <amxmisc> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "author" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("say", "HandleSay") }  public HandleSay(id)  {         static said[192], cow;     read_args(said,191);     remove_quotes(said);     //remove the / if it is there     if( equali(said,"/",1 ) ) cow = 1;     else cow = 0;         new first_message[21], dummy[2]     strbreak(said[cow], first_message, 20, dummy, 1)         if(equali(first_message, "Server")) {         new Left[151], Right[151]         strbreak(said[cow], Left, 150, Right, 150)         strbreak(Right, Left, 150, Right, 150)         if( equali(Left, "rules") || equali(Left, "Rules") )         {                         //ur code here         }     } }
liinuus is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-18-2011 , 09:04   Re: Register Commands with Space
Reply With Quote #10

Quote:
Originally Posted by liinuus View Post
Code:
        if( equali(Left, "rules") || equali(Left, "Rules") )
equali() is case-insensitive, so those 2 checks are the exact same.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply


Thread Tools
Display Modes

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 01:10.


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