AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   problem with reading arguments... (https://forums.alliedmods.net/showthread.php?t=153453)

kotinha 03-23-2011 16:36

problem with reading arguments...
 
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?

fysiks 03-23-2011 20:17

Re: problem with reading arguments...
 
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).


All times are GMT -4. The time now is 14:30.

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