AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   hook_say arg2 (https://forums.alliedmods.net/showthread.php?t=133430)

Ex3cuTioN 07-25-2010 10:02

hook_say arg2
 
PHP Code:

public hook_say(id) {
    static 
chat[192];
    
read_argv(1chat,sizeof(chat) - 1); 
    
remove_quotes(chat); 
    
    if(
equal(chat[2],"")) {
        
client_print(id,print_chat,"No arguments given");
        return 
PLUGIN_CONTINUE;
    }
    
    if(
equal(chat"/raport"7)) {
        
//code
    
}


How can i see if after /raport is text or not ?

ConnorMcLeod 07-25-2010 10:19

Re: hook_say arg2
 
1st you don't need remove_quotes if you retrieve arg 1, you would need it if you would use read_args, but read_argv(1 is just fine because arg 1 is the whole text passed after say and say_team.
Well, if something is written after /command, this is the next characters to /command, you have few ways to check it.

If your command is /raport, if nothing is written later length of arg 1 is 7.

You can do :

PHP Code:

    static chat[192], len;
    
len read_argv(1chatcharsmax(chat)); 

Then if len is < 7 you know that some text is following the chat command.


All times are GMT -4. The time now is 00:18.

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