Hello, I did this code to set green color in say messages, it works well only if player is dead, if alive just outputs a yellow message as default with a extra "space" at the beginning of the message (probably due of the color code). Does anyone know how to fix?
Code:
public CmdSay(this)
{
if (!(get_user_flags(this) & (VIP_VIP|VIP_SUPER)))
return PLUGIN_CONTINUE;
new szFormat[32], szText[192];
new bool:bIsAlive;
read_args(szText, charsmax(szText));
remove_quotes(szText);
//server_print("szBuffer = %s", szBuffer)
//trim(szBuffer);
//szBuffer[190] = 0;
if (!szText[0] || szText[0] == '/')
return PLUGIN_CONTINUE;
bIsAlive = bool:is_user_alive(this);
if (!bIsAlive)
{
if (!(CS_TEAM_T <= cs_get_user_team(this) <= CS_TEAM_CT))
copy(szFormat, charsmax(szFormat), "#Cstrike_Chat_AllSpec");
else
copy(szFormat, charsmax(szFormat), "#Cstrike_Chat_AllDead");
}
else
{
copy(szFormat, charsmax(szFormat), "#Cstrike_Chat_All");
}
format(szText, charsmax(szText), "^x04%s", szText);
//server_print("szText = %s", szText);
new Players[MAX_PLAYERS];
new iPlayerCount, i;
new pPlayer;
get_players(Players, iPlayerCount, "ch");
for (i = 0; i < iPlayerCount; i++)
{
pPlayer = Players[i];
if (!bIsAlive && is_user_alive(pPlayer) || bIsAlive && !is_user_alive(pPlayer))
continue;
message_begin(MSG_ONE, g_msgSayText, .player = pPlayer)
{
write_byte(this);
write_string(szFormat);
write_string("");
write_string(szText);
}
message_end();
}
return PLUGIN_HANDLED;
}
__________________