AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook events "say" and "say_team" (https://forums.alliedmods.net/showthread.php?t=112892)

lucas_7_94 12-21-2009 22:39

Hook events "say" and "say_team"
 
Today I was looking at this code starsailor.

PHP Code:

#include <amxmodx> 

new MsgSayText 

public plugin_init() 

    
MsgSayText get_user_msgid("SayText"
    
register_clcmd("say""hook_sayteam")
    
register_clcmd("say_team""hook_sayteam"



public 
hook_sayteam(id

    new 
Players[32], iPnumiIndexiTeam 
    get_players
(PlayersiPnum
     
    for (new 
0iPnumi++) 
    { 
        
iIndex Players[i
         
        new 
Said[200
         
        
read_args(Said,199
        
remove_quotes(Said
        
trim(Said
         
        new 
szName[32
        
get_user_name(idszName31
         
        
iTeam get_user_team(iIndex
         
        if(
iIndex && get_user_team(id) == iTeam
        { 
            
chat_color(iIndex"!y(%d) !t%s !y: %s",iTeam == 2,szName,Said
        } 
    } 
     
    return 
PLUGIN_HANDLED


stock chat_color(const id, const string[], { FloatSqlResul}:...) 

    new 
msg[191], players[32], count 1
    
vformat(msgsizeof msg 1string3); 
     
    
replace_all(msgsizeof msg 1"!g""^4"
    
replace_all(msgsizeof msg 1"!y""^1"
    
replace_all(msgsizeof msg 1"!t""^3"
     
    if(
id
    { 
        
players[0] = id
    } 
    else 
    { 
        
get_players(playerscount"ch"
    } 
    for (new 
count i++) 
    { 
        new 
index players[i
        
message_begin(MSG_ONE_UNRELIABLEMsgSayText_index
        
write_byte(index
        
write_string(msg
        
message_end() 
    } 


Now, a problem if I try to talk to admin (@ @), the Tsay csay or not present, someone can help me?

AntiBots 12-21-2009 23:38

Re: Hook events "say" and "say_team"
 
Why you post this on all seccion.

You Fail!!

PD: I answered in "Others" SubForum.,

ConnorMcLeod 12-22-2009 01:10

Re: Hook events "say" and "say_team"
 
Instead of return PLUGIN_HANDLED, return PLUGIN_HANDLED_MAIN

lucas_7_94 12-22-2009 06:34

Re: Hook events "say" and "say_team"
 
Quote:

Originally Posted by AntiBots (Post 1026382)
Why you post this on all seccion.

You Fail!!

PD: I answered in "Others" SubForum.,

[ES] Porque yo habia posteado , pero no me habian contestado .

#ConnorMcLeod:

Hey! work perfect! Thanks ^^

lucas_7_94 12-22-2009 13:17

Re: Hook events "say" and "say_team"
 
Sorry for the double post.
I have another problem -.-. The living can read the dead and the living dead read, you can avoid this?

laziboi72 12-22-2009 13:34

Re: Hook events "say" and "say_team"
 
Quote:

Originally Posted by ConnorMcLeod (Post 1026461)
Instead of return PLUGIN_HANDLED, return PLUGIN_HANDLED_MAIN

im a novice, could you explain whats the difference between just handle versus handled_main?

(edited)
thanks arkshine XD

Arkshine 12-22-2009 13:40

Re: Hook events "say" and "say_team"
 
PLUGIN_HANDLED will block all the chat for plugins declared below this one. PLUGIN_HANDLED_MAIN will block only for your plugin.

lucas_7_94 12-22-2009 13:58

Re: Hook events "say" and "say_team"
 
Can Any help me with my problem ?


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

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