Raised This Month: $ Target: $400
 0% 

hook_say arg2


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ex3cuTioN
Member
Join Date: May 2010
Old 07-25-2010 , 10:02   hook_say arg2
Reply With Quote #1

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 ?
Ex3cuTioN is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-25-2010 , 10:19   Re: hook_say arg2
Reply With Quote #2

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.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 00:18.


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