Quote:
Originally Posted by iceeedr
Code:
ColorChat(0, "!x04%n%s!x01: %s", id, is_user_alive(id) ? "" : " !x01*(DEAD)*!x01", szText);
You forgot to redo %n to 1.8.2.
And replacing !x01
|
Thanks for pointing that out
@SHIFT0 Another try
- %n fix
#Update 1:
- Forgot to remove id in Color Chat
#Update 2:
- Adding a variable to check to not break any trigger.
#Update 3
- Making player name back to team color
PHP Code:
#include <amxmodx>
#define MAX_SAY_TEXT_LEN 128
#define MAX_KEYWORD_LEN 32
#define MAX_HIGHLIGHT_LEN 32
enum Match
{
Keyword[MAX_KEYWORD_LEN],
Highlight[MAX_HIGHLIGHT_LEN]
};
new g_ChatKeywords[][Match] =
{
{"gg", "!x04Good Game !"}, //!x01 is yellow color | !x03 is team color | !x04 is green color
{"slm", "!x04Slam Alikom"}
};
new g_msgSayText;
public plugin_init()
{
register_clcmd("say", "@OnCmd_Say");
g_msgSayText = get_user_msgid("SayText")
}
@OnCmd_Say(id)
{
new szText[MAX_SAY_TEXT_LEN];
new HasAcronym;
read_args(szText, charsmax(szText));
remove_quotes(szText);
trim(szText);
if (!szText[0])
return PLUGIN_CONTINUE;
for (new iPattern = 0, szHighlight[MAX_HIGHLIGHT_LEN], iPatterns = sizeof(g_ChatKeywords); iPattern < iPatterns; iPattern++)
{
if (containi(szText, g_ChatKeywords[iPattern][Keyword]) == -1)
continue;
if(!HasAcronym) HasAcronym = 1
format(szHighlight, charsmax(szHighlight), "%s^1", g_ChatKeywords[iPattern][Highlight]);
replace_all(szText, charsmax(szText), g_ChatKeywords[iPattern][Keyword], szHighlight);
}
if(!HasAcronym)
return PLUGIN_CONTINUE
// %n was added on 1.9, but it directly parses a certain client's name.
new szName[64]
get_user_name(id, szName, charsmax(szName))
ColorChat(0, "!x03%s%s!x01: %s", szName, is_user_alive(id) ? "" : " !x01*(DEAD)*!x01", szText);
return PLUGIN_HANDLED;
}
stock ColorChat(const id, const input[], any:...) {
new count = 1, players[32];
static msg[191];
vformat(msg, 190, input, 3);
replace_all(msg, 190, "!x04", "^4");
replace_all(msg, 190, "!x03", "^3");
replace_all(msg, 190, "!x01", "^1");
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, g_msgSayText, _, players[i]);
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}
__________________