I`m trying to write a plugin to my friend, A basic chat format in cs.
He say he want to change sth.
But when I finish it, I found some problems.
The plugin can not hide what player say.
This is already in the order plugin to hide player say, but it`s not work. > return PLUGIN_HANDLED
So I decided to post my code in here and want some helps.
Please correct my code if these is sth wrong.
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN_NAME "Basic Chat Format"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "NoName"
new players[33][32]
new num[33]
public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_clcmd("say", "hook_say")
register_clcmd("say_team", "hook_team_say")
}
public hook_say(id)
{
new chat[192]
read_args(chat, 191)
remove_quotes(chat)
new name[32], message[256]
get_user_name(id, name, 31)
new CsTeams:userteam =cs_get_user_team(id)
if(equal(chat, ""))
return PLUGIN_HANDLED_MAIN
if (is_user_alive(id))
{
format(message, 255, "^x03%s ^x01: %s", name, chat)
color_chat(0, id, message)
}
else if (!is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
{
format(message, 255, "^x01*DEAD* ^x03%s ^x01: %s", name, chat)
color_chat(0, id, message)
}
else
{
format(message, 255, "^x01*SPEC* ^x03%s ^x01: %s", name, chat)
color_chat(0, id, message)
}
return PLUGIN_CONTINUE
}
public hook_team_say(id)
{
new chat[192]
read_args(chat, 191)
remove_quotes(chat)
new name[32], message[256], team[32]
get_user_name(id, name, 31)
if(equal(chat, ""))
return PLUGIN_HANDLED_MAIN
new CsTeams:userteam =cs_get_user_team(id)
if (userteam == CS_TEAM_T)
{
get_players(players[id], num[id], _, "TERRORIST")
team = "(TR)"
}
else if (userteam == CS_TEAM_CT)
{
get_players(players[id], num[id], _, "CT")
team = "(CT)"
}
else
{
get_players(players[id], num[id], _, "SPECTATOR")
team = "(SPEC)"
}
for (new a = 0; a < num[id]; ++a)
{
new i = players[id][a]
if (is_user_alive(id))
{
format(message, 255, "^x03%s %s ^x01: %s", team, name, chat)
color_chat(i, id, message)
}
else if (!is_user_alive(id) && userteam != CS_TEAM_SPECTATOR)
{
format(message, 255, "^x01*DEAD*^x03%s %s ^x01: %s", team, name, chat)
color_chat(i, id, message)
}
else
{
format(message, 255, "^x03%s %s ^x01: %s", team, name, chat)
color_chat(i, id, message)
}
}
return PLUGIN_CONTINUE
}
public color_chat(playerid, colorid, message[])
{
message_begin(playerid?MSG_ONE:MSG_ALL, get_user_msgid("SayText"), {0, 0, 0}, playerid)
write_byte(colorid)
write_string(message)
message_end()
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ ansicpg936\\ deff0{\\ fonttbl{\\ f0\\ fnil\\ fcharset134 Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2052\\ f0\\ fs16 \n\\ par }
*/
__________________
You can be a SUPER coder but you Haven't to say such as "stupid, etc." words to the others