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 SayText, MaxPlayers
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say", "message_saytext")
SayText = get_user_msgid("SayText")
MaxPlayers = get_maxplayers()
}
public message_saytext(id)
{
static szSay[195]
read_args(szSay, charsmax(szSay))
remove_quotes(szSay)
static szNombre[33]
get_user_name(id, szNombre, 32)
for(new i = 1; i < MaxPlayers; i++)
{
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", szNombre, szSay)
}
else
{
ChatColor(i, "!y(Terrorist) !t%s !y: %s", szNombre, szSay)
}
}
case CS_TEAM_CT:
{
if(!is_user_alive(i)) {
ChatColor(i, "!y*DEAD*(Counter-Terrorist) !t%s !y: %s", szNombre, szSay)
}
else
{
ChatColor(i, "!y(Counter-Terrorist) !t%s !y: %s", szNombre, szSay)
}
}
case CS_TEAM_SPECTATOR:
{
ChatColor(i, "!y(Spectator) !t%s !y: %s", szNombre, szSay)
}
}
}
return PLUGIN_HANDLED
}
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^x04")
replace_all(msg, 190, "!y", "^x01")
replace_all(msg, 190, "!t", "^x03")
if(id)
players[0] = id
else
get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
EDIT: Ive edit the code but its still doesnt work.
|