Raised This Month: $ Target: $400
 0% 

Problem with hook_say


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Ex3cuTioN
Member
Join Date: May 2010
Old 07-10-2010 , 04:41   Problem with hook_say
Reply With Quote #1

LOL

Every word i say in chat, me or a random player takes like command in console.

If i write in chat "slay player" it will write in my console "amx_slay player" and works for any random player.
If i write in chat "lol_why_is_not_working" it will write in my console "amx_lol_why_is_not_working"

But i have the "if" in my hook_say, i want only to check if he says /goto or /go

PHP Code:
public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say","hook_say");
    
register_clcmd("amx_goto","cmdGOTO");
    
register_clcmd("amx_go","cmdGOTO");
}

public 
hook_say(id) {
    new 
s_Args[192];
    
    
read_args(s_Argssizeof(s_Args) - 1);
    
remove_quotes(s_Args);
    
    if(
equal(s_Args"/goto"5) || (s_Args,"/go",3)) {
        
replace(s_Argssizeof(s_Args) - 1"/""");
        
client_cmd(id"amx_%s"s_Args);
    }
    
    return 
PLUGIN_CONTINUE;

LATER EDIT :

I solved the problem, but i have a question.

Q : How could i make only 1 if ?

PHP Code:
public hook_say(id) {
    static 
s_Args[192];
    
    
read_args(s_Argssizeof(s_Args) - 1);
    
remove_quotes(s_Args);
    
    if(
equal(s_Args"/goto"5)) {
        
replace(s_Argssizeof(s_Args) - 1"/""");
        
client_cmd(id"amx_%s"s_Args);
    }
    else if(
equal(s_Args,"/go",3)) {
        
replace(s_Argssizeof(s_Args) - 1"/""");
        
client_cmd(id"amx_%s"s_Args);
    }
    
    return 
PLUGIN_CONTINUE;


Last edited by Ex3cuTioN; 07-10-2010 at 04:46.
Ex3cuTioN is offline
 



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 07:06.


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