AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   getting team adn hook say (https://forums.alliedmods.net/showthread.php?t=195803)

COre^ 09-11-2012 16:03

getting team adn hook say
 
Hy everyone, i was working in this plugins, but it doesnt work. what i want is to hook say so as to only show it as if it was say_team. heres the code.

PHP Code:


#include <amxmodx>
#include <amxmisc>
#include <cstrike>

#define PLUGIN "Hook Say"
#define VERSION "1.0"
#define AUTHOR "AntiChupines"

new SayTextMaxPlayers


public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say""message_saytext")
    
    
SayText get_user_msgid("SayText")
    
MaxPlayers get_maxplayers()

}

public 
message_saytext(id)
{

    static 
szSay[195]

    
read_args(szSaycharsmax(szSay))
    
remove_quotes(szSay)
    
    static 
szNombre[33]
    
get_user_name(idszNombre32)
    
    for(new 
1MaxPlayersi++)
    {
        new 
iTeam cs_get_user_team(i)
    
        switch(
iTeam)
        {
            case 
CS_TEAM_T:
            {
                if(!
is_user_alive(i)) {
                    
ChatColor(i"!y*DEAD*(Terrorist) !t%s !y: %s"szNombreszSay)
                }
                else
                {
                    
ChatColor(i"!y(Terrorist) !t%s !y: %s"szNombreszSay)
                }
            }
    
            case 
CS_TEAM_CT:
            {
                if(!
is_user_alive(i)) {
                    
ChatColor(i"!y*DEAD*(Counter-Terrorist) !t%s !y: %s"szNombreszSay)
                }
                else
                {
                    
ChatColor(i"!y(Counter-Terrorist) !t%s !y: %s"szNombreszSay)
                }
            }
    
            case 
CS_TEAM_SPECTATOR:
            {
                    
ChatColor(i"!y(Spectator) !t%s !y: %s"szNombreszSay)

            }
        }
    }
        
    return 
PLUGIN_HANDLED

}

stock ChatColor(const id, const input[], any:...) 
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^x04")
    
replace_all(msg190"!y""^x01")
    
replace_all(msg190"!t""^x03")
    
    if(
id)
        
players[0] = id
    
else
    
get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLESayText_players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }


EDIT: Ive edit the code but its still doesnt work.

fysiks 09-11-2012 19:55

Re: getting team adn hook say
 
It's much simpler than that to make all "say" chat go through "say_team" chat.

PHP Code:

#include <amxmodx>

public plugin_init()
{
    
register_plugin("No Public chat""0.1""Ford Prefect")
    
register_clcmd("say""cmdSay")
}

public 
cmdSay(id)
{
    static 
szSaid[128]
    
read_args(szSaidcharsmax(szSaid))
    
engclient_cmd(id"say_team"szSaid)
    return 
PLUGIN_HANDLED




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

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