Raised This Month: $ Target: $400
 0% 

problem with reading arguments...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kotinha
Senior Member
Join Date: Jun 2009
Location: Alentejo, Portugal :)
Old 03-23-2011 , 16:36   problem with reading arguments...
Reply With Quote #1

Hey
I have this code:
PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("say .startwar""hook_startwar")
}
public 
hook_startwar(idlevelcid)
{
        new 
wartype[6]
        
read_argv(2wartype5)
        
client_print(idprint_chat"you chosed a %s match"wartype)

When I type .startwar it prints
Code:
you chosed a  match
But when I type .startwar blabla it doesn't print anything...

If I type in console say .startwar blabla it will print:
Code:
you chosed a blabla match
Why does this happen?
__________________
"If God exists, I hope he has a good excuse." - Woody Allen
kotinha is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-23-2011 , 20:17   Re: problem with reading arguments...
Reply With Quote #2

When you register a say message it must be exactly that. If you do register_clcmd("say hello", ...) then it will only be called when you "say hello" and not when you "say hello how are you". It must be exact.

To provide arguments you must register only "say" then read_args() and parse it into the parts that you need (the first part being the .startwar which you need to check to continue then the remaining is your argument).
__________________

Last edited by fysiks; 03-23-2011 at 20:27.
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 14:30.


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