Пользователь
- Сообщения
- 2
- Реакции
- -1
Неверный раздел форума
Hello everyone! Can someone help me to make this English chat by default, because when I type something in server, it shows in Russian...
#include <amxmodx>
#include <fakemeta>
native zp_level(index);
#pragma semicolon 1
#define MAX_PLAYERS 32
#define MsgId_SayText 76
#define MsgId_TeamInfo 86
enum _:DATA
{
TYPE[2],
AUTH[32],
PREFIX[64]
};
new Array:g_aData, g_aDataSize, g_szPrefix[MAX_PLAYERS + 1][64];
new Array:g_aDataBlockMess, g_aDataBlockMessSize;
new g_iMaxPlayers, g_iUserTranslit[MAX_PLAYERS + 1], Float:g_iUserTimeMes[MAX_PLAYERS + 1], Float:g_iTimeFlood[MAX_PLAYERS + 1];
new const g_chConvert[94 * 2 char] =
{
0x2100D0AD, 0x2300D0B6, 0x25003F00, 0xD18D2800, 0x29002A00, 0x2B00D0B1, 0x2D00D18E, 0x2E003000,
0x31003200, 0x33003400, 0x35003600, 0x37003800, 0x3900D096, 0xD0B6D091, 0x3D00D0AE, 0x2C002200,
0xD0A4D098, 0xD0A1D092, 0xD0A3D090, 0xD09FD0A0, 0xD0A8D09E, 0xD09BD094, 0xD0ACD0A2, 0xD0A9D097,
0xD099D09A, 0xD0ABD095, 0xD093D09C, 0xD0A6D0A7, 0xD09DD0AF, 0xD1855C00, 0xD18A3A00, 0x5F00D191,
0xD184D0B8, 0xD181D0B2, 0xD183D0B0, 0xD0BFD180, 0xD188D0BE, 0xD0BBD0B4, 0xD18CD182, 0xD189D0B7,
0xD0B9D0BA, 0xD18BD0B5, 0xD0B3D0BC, 0xD186D187, 0xD0BDD18F, 0xD0A52F00, 0xD0AAD081
};
public plugin_init()
{
register_plugin("[FS] Chat", "1.1", "Docaner");
register_clcmd("say /rus", "Chat_Russian");
register_clcmd("say /eng", "Chat_English");
register_clcmd("say", "Chat_Say");
register_clcmd("say_team", "Chat_SayTeam");
g_iMaxPlayers = get_maxplayers();
}
public client_disconnect(id)
{
g_iUserTranslit[id] = 0;
g_iUserTimeMes[id] = 0.0;
g_iTimeFlood[id] = 0.0;
g_szPrefix[id] = "";
}
public plugin_cfg()
{
new szCfgDir[64], szCfgFile[128];
get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir));
formatex(szCfgFile, charsmax(szCfgFile), "%s/fs_chatsettings.ini", szCfgDir);
if(file_exists(szCfgFile))
{
new aData[DATA], aDataBlocked[190], szBuffer[128],
iLine, iLen, section;
g_aData = ArrayCreate(DATA);
g_aDataBlockMess = ArrayCreate(190, 1);
while(read_file(szCfgFile, iLine++, szBuffer, charsmax(szBuffer), iLen))
{
if(!iLen || szBuffer[0] == ';') continue;
if(szBuffer[0] == '[')
{
section++;
continue;
}
switch(section)
{
case 1:
{
parse(szBuffer, aData[TYPE], charsmax(aData[TYPE]), aData[AUTH], charsmax(aData[AUTH]), aData[PREFIX], charsmax(aData[PREFIX]));
ArrayPushArray(g_aData, aData);
}
case 2:
{
formatex(aDataBlocked, charsmax(aDataBlocked), szBuffer);
ArrayPushString(g_aDataBlockMess, aDataBlocked);
}
}
}
g_aDataSize = ArraySize(g_aData);
g_aDataBlockMessSize = ArraySize(g_aDataBlockMess);
}
}
public Chat_Russian(id) if(!g_iUserTranslit[id]) UTIL_SayText(id, "!y|!gFS CHAT!y| Ваш язык уже был переключен на !gрусский!y."); else g_iUserTranslit[id] = 0,
UTIL_SayText(id, "!y|!gFS CHAT!y| Вы успешно переключили язык на !gрусский!y."), client_cmd(id, "spk buttons/blip1.wav");
public Chat_English(id) if(g_iUserTranslit[id]) UTIL_SayText(id, "!y|!gFS CHAT!y| Ваш язык уже был переключен на !gанглийский!y."); else g_iUserTranslit[id] = 1,
UTIL_SayText(id, "!y|!gFS CHAT!y| Вы успешно переключили язык на !gанглийский!y."), client_cmd(id, "spk buttons/blip1.wav");
public Chat_Say(id) return Chat_Think(id, 0);
public Chat_SayTeam(id) return Chat_Think(id, 1);
Chat_Think(id, iTeam)
{
new iBuffer[190], iMessage[190], iName[33], iNameColor[35], szTeam[10], IdTeam, iConvertMessage[charsmax(iMessage) * 2 + 1], iMessageControl[190], iPrefix[65];
read_args(iMessage, charsmax(iMessage));
remove_quotes(iMessage);
if(equal(iMessage, "") || iMessage[0] == ' ' || iMessage[0] == '#') return PLUGIN_HANDLED;
if(iMessage[0] == '@') return PLUGIN_HANDLED_MAIN;
if(g_iUserTimeMes[id] + 1.0 > get_gametime() || g_iTimeFlood[id] > get_gametime())
{
UTIL_SayText(id, "!y|!gFS CHAT!y| Прекратите флудить в чат!");
g_iTimeFlood[id] = get_gametime() + 2.0;
return PLUGIN_HANDLED;
}
if(!is_user_alive(id)) add(iBuffer, charsmax(iBuffer), "!y~Мертв~");
IdTeam = get_user_team(id, szTeam, charsmax(szTeam));
if(iTeam)
{
switch(IdTeam)
{
case 1: add(iBuffer, charsmax(iBuffer), equal(iBuffer, "") ? "!y(TT)" : " !y(TT)");
case 2: add(iBuffer, charsmax(iBuffer), equal(iBuffer, "") ? "!y(CT)" : " !y(CT)");
default: add(iBuffer, charsmax(iBuffer), equal(iBuffer, "") ? "!y(SPECT)": " !y(SPECT)");
}
}
new iszLevelPrefix[64];
if(zp_level(id) < 60)
formatex(iszLevelPrefix, charsmax(iszLevelPrefix), equal(iBuffer, "") ? "!y[!g%d LVL!y]" : " !y[!g%d LVL!y]", zp_level(id));
else
formatex(iszLevelPrefix, charsmax(iszLevelPrefix), equal(iBuffer, "") ? "!y[!gМаксимальный LVL!y]" : " !y[!gМаксимальный LVL!y]");
add(iBuffer, charsmax(iBuffer), iszLevelPrefix);
SAY_GetPrefix(id);
if(!equal(g_szPrefix[id], ""))
{
formatex(iPrefix, charsmax(iPrefix), equal(iBuffer, "") ? "%s" : " %s", g_szPrefix[id]);
add(iBuffer, charsmax(iBuffer), iPrefix);
}
get_user_name(id, iName, charsmax(iName));
formatex(iNameColor, charsmax(iNameColor), equal(iBuffer, "") ? "!t%s" : " !t%s" , iName);
add(iBuffer, charsmax(iBuffer), iNameColor);
add(iBuffer, charsmax(iBuffer), get_user_flags(id) & ADMIN_BAN ? " !y: !g" : " !y: ");
if(!g_iUserTranslit[id] && iMessage[0] != '/')
{
new nLen;
for(new n; iMessage[n] != EOS; n++)
{
if(iMessage[n] < '!' || iMessage[n] > '~') iConvertMessage[nLen++] = iMessage[n];
else
{
iConvertMessage[nLen++] = g_chConvert{(iMessage[n] - '!') * 2};
if(g_chConvert{(iMessage[n] - '!') * 2 + 1} != EOS) iConvertMessage[nLen++] = g_chConvert{(iMessage[n] - '!') * 2 + 1};
}
}
iConvertMessage[nLen] = EOS;
}
else iConvertMessage = iMessage;
for(new i; i < g_aDataBlockMessSize; i++)
{
ArrayGetString(g_aDataBlockMess, i, iMessageControl, charsmax(iMessageControl));
if(containi(iConvertMessage, iMessageControl) == -1) continue;
UTIL_SayText(id, "!y|!gFS CHAT!y| Обнаружена !gспам атака!y/!gреклама");
g_iTimeFlood[id] = get_gametime() + 2.0;
return PLUGIN_HANDLED;
}
if(iTeam)
{
new iTeami;
for(new i = 1; i <= g_iMaxPlayers; i++)
{
iTeami = get_user_team(i, szTeam, charsmax(szTeam));
if(IdTeam != iTeami) continue;
SAY_ChatPrint(i, iBuffer, iConvertMessage, szTeam);
}
}
else SAY_ChatPrint(0, iBuffer, iConvertMessage, szTeam);
g_iUserTimeMes[id] = get_gametime();
log_message("%s <%s> %s : %s", is_user_alive(id) ? "" : "<Мертв>", iName, iTeam ? "say_team" : "say", iConvertMessage);
return PLUGIN_HANDLED_MAIN;
}
stock SAY_GetPrefix(id)
{
new aData[DATA];
for(new i; i < g_aDataSize; i++)
{
ArrayGetArray(g_aData, i, aData);
switch(aData[TYPE])
{
case 'e':
{
static sName[33]; get_user_name(id, sName, charsmax(sName));
if(!strcmp(aData[AUTH], sName))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
case 'f':
{
if(get_user_flags(id) & read_flags(aData[AUTH]))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
case 'i':
{
static sIP[16]; get_user_ip(id, sIP, charsmax(sIP), 1);
if(!strcmp(aData[AUTH], sIP))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
case 's':
{
static sAuthid[25]; get_user_authid(id, sAuthid, charsmax(sAuthid));
if(!strcmp(aData[AUTH], sAuthid))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
}
}
return g_szPrefix[id] = "";
}
stock SAY_ChatPrint(pPlayer, const szTags[], const szMessage[], const szTeamColor[])
{
new szBuffer[190], iPlayerTeamColor[10];
if(numargs() > 2) vformat(szBuffer, charsmax(szBuffer), szTags, 3);
else copy(szBuffer, charsmax(szBuffer), szTags);
while(replace(szBuffer, charsmax(szBuffer), "!y", "^1")) {}
while(replace(szBuffer, charsmax(szBuffer), "!t", "^3")) {}
while(replace(szBuffer, charsmax(szBuffer), "!g", "^4")) {}
add(szBuffer, charsmax(szBuffer), szMessage);
switch(pPlayer)
{
case 0:
{
for(new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
{
if(!is_user_connected(iPlayer)) continue;
get_user_team(iPlayer, iPlayerTeamColor, charsmax(iPlayerTeamColor));
UTIL_MsgTeamInfo(iPlayer, szTeamColor);
UTIL_MsgSayText(iPlayer, szBuffer, 1);
UTIL_MsgTeamInfo(iPlayer, iPlayerTeamColor);
}
}
default:
{
get_user_team(pPlayer, iPlayerTeamColor, charsmax(iPlayerTeamColor));
UTIL_MsgTeamInfo(pPlayer, szTeamColor);
UTIL_MsgSayText(pPlayer, szBuffer, 1);
UTIL_MsgTeamInfo(pPlayer, iPlayerTeamColor);
}
}
}
stock UTIL_SayText(pPlayer, const szMessage[], any:...)
{
new szBuffer[190];
if(numargs() > 2) vformat(szBuffer, charsmax(szBuffer), szMessage, 3);
else copy(szBuffer, charsmax(szBuffer), szMessage);
while(replace(szBuffer, charsmax(szBuffer), "!y", "^1")) {}
while(replace(szBuffer, charsmax(szBuffer), "!t", "^3")) {}
while(replace(szBuffer, charsmax(szBuffer), "!g", "^4")) {}
switch(pPlayer)
{
case 0:
{
for(new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
{
if(!is_user_connected(iPlayer)) continue;
UTIL_MsgSayText(iPlayer, szBuffer);
}
}
default: UTIL_MsgSayText(pPlayer, szBuffer);
}
}
stock UTIL_MsgSayText(iPlayer, const szMessage[], iReliable = 0)
{
engfunc(EngFunc_MessageBegin, iReliable ? MSG_ONE : MSG_ONE_UNRELIABLE, MsgId_SayText, {0.0, 0.0, 0.0}, iPlayer);
write_byte(iPlayer);
write_string(szMessage);
message_end();
}
stock UTIL_MsgTeamInfo(iPlayer, const iTeam[])
{
engfunc(EngFunc_MessageBegin, MSG_ONE, MsgId_TeamInfo, {0.0, 0.0, 0.0}, iPlayer);
write_byte(iPlayer);
write_string(iTeam);
message_end();
}
#include <amxmodx>
#include <fakemeta>
native zp_level(index);
#pragma semicolon 1
#define MAX_PLAYERS 32
#define MsgId_SayText 76
#define MsgId_TeamInfo 86
enum _:DATA
{
TYPE[2],
AUTH[32],
PREFIX[64]
};
new Array:g_aData, g_aDataSize, g_szPrefix[MAX_PLAYERS + 1][64];
new Array:g_aDataBlockMess, g_aDataBlockMessSize;
new g_iMaxPlayers, g_iUserTranslit[MAX_PLAYERS + 1], Float:g_iUserTimeMes[MAX_PLAYERS + 1], Float:g_iTimeFlood[MAX_PLAYERS + 1];
new const g_chConvert[94 * 2 char] =
{
0x2100D0AD, 0x2300D0B6, 0x25003F00, 0xD18D2800, 0x29002A00, 0x2B00D0B1, 0x2D00D18E, 0x2E003000,
0x31003200, 0x33003400, 0x35003600, 0x37003800, 0x3900D096, 0xD0B6D091, 0x3D00D0AE, 0x2C002200,
0xD0A4D098, 0xD0A1D092, 0xD0A3D090, 0xD09FD0A0, 0xD0A8D09E, 0xD09BD094, 0xD0ACD0A2, 0xD0A9D097,
0xD099D09A, 0xD0ABD095, 0xD093D09C, 0xD0A6D0A7, 0xD09DD0AF, 0xD1855C00, 0xD18A3A00, 0x5F00D191,
0xD184D0B8, 0xD181D0B2, 0xD183D0B0, 0xD0BFD180, 0xD188D0BE, 0xD0BBD0B4, 0xD18CD182, 0xD189D0B7,
0xD0B9D0BA, 0xD18BD0B5, 0xD0B3D0BC, 0xD186D187, 0xD0BDD18F, 0xD0A52F00, 0xD0AAD081
};
public plugin_init()
{
register_plugin("[FS] Chat", "1.1", "Docaner");
register_clcmd("say /rus", "Chat_Russian");
register_clcmd("say /eng", "Chat_English");
register_clcmd("say", "Chat_Say");
register_clcmd("say_team", "Chat_SayTeam");
g_iMaxPlayers = get_maxplayers();
}
public client_disconnect(id)
{
g_iUserTranslit[id] = 0;
g_iUserTimeMes[id] = 0.0;
g_iTimeFlood[id] = 0.0;
g_szPrefix[id] = "";
}
public plugin_cfg()
{
new szCfgDir[64], szCfgFile[128];
get_localinfo("amxx_configsdir", szCfgDir, charsmax(szCfgDir));
formatex(szCfgFile, charsmax(szCfgFile), "%s/fs_chatsettings.ini", szCfgDir);
if(file_exists(szCfgFile))
{
new aData[DATA], aDataBlocked[190], szBuffer[128],
iLine, iLen, section;
g_aData = ArrayCreate(DATA);
g_aDataBlockMess = ArrayCreate(190, 1);
while(read_file(szCfgFile, iLine++, szBuffer, charsmax(szBuffer), iLen))
{
if(!iLen || szBuffer[0] == ';') continue;
if(szBuffer[0] == '[')
{
section++;
continue;
}
switch(section)
{
case 1:
{
parse(szBuffer, aData[TYPE], charsmax(aData[TYPE]), aData[AUTH], charsmax(aData[AUTH]), aData[PREFIX], charsmax(aData[PREFIX]));
ArrayPushArray(g_aData, aData);
}
case 2:
{
formatex(aDataBlocked, charsmax(aDataBlocked), szBuffer);
ArrayPushString(g_aDataBlockMess, aDataBlocked);
}
}
}
g_aDataSize = ArraySize(g_aData);
g_aDataBlockMessSize = ArraySize(g_aDataBlockMess);
}
}
public Chat_Russian(id) if(!g_iUserTranslit[id]) UTIL_SayText(id, "!y|!gFS CHAT!y| Ваш язык уже был переключен на !gрусский!y."); else g_iUserTranslit[id] = 0,
UTIL_SayText(id, "!y|!gFS CHAT!y| Вы успешно переключили язык на !gрусский!y."), client_cmd(id, "spk buttons/blip1.wav");
public Chat_English(id) if(g_iUserTranslit[id]) UTIL_SayText(id, "!y|!gFS CHAT!y| Ваш язык уже был переключен на !gанглийский!y."); else g_iUserTranslit[id] = 1,
UTIL_SayText(id, "!y|!gFS CHAT!y| Вы успешно переключили язык на !gанглийский!y."), client_cmd(id, "spk buttons/blip1.wav");
public Chat_Say(id) return Chat_Think(id, 0);
public Chat_SayTeam(id) return Chat_Think(id, 1);
Chat_Think(id, iTeam)
{
new iBuffer[190], iMessage[190], iName[33], iNameColor[35], szTeam[10], IdTeam, iConvertMessage[charsmax(iMessage) * 2 + 1], iMessageControl[190], iPrefix[65];
read_args(iMessage, charsmax(iMessage));
remove_quotes(iMessage);
if(equal(iMessage, "") || iMessage[0] == ' ' || iMessage[0] == '#') return PLUGIN_HANDLED;
if(iMessage[0] == '@') return PLUGIN_HANDLED_MAIN;
if(g_iUserTimeMes[id] + 1.0 > get_gametime() || g_iTimeFlood[id] > get_gametime())
{
UTIL_SayText(id, "!y|!gFS CHAT!y| Прекратите флудить в чат!");
g_iTimeFlood[id] = get_gametime() + 2.0;
return PLUGIN_HANDLED;
}
if(!is_user_alive(id)) add(iBuffer, charsmax(iBuffer), "!y~Мертв~");
IdTeam = get_user_team(id, szTeam, charsmax(szTeam));
if(iTeam)
{
switch(IdTeam)
{
case 1: add(iBuffer, charsmax(iBuffer), equal(iBuffer, "") ? "!y(TT)" : " !y(TT)");
case 2: add(iBuffer, charsmax(iBuffer), equal(iBuffer, "") ? "!y(CT)" : " !y(CT)");
default: add(iBuffer, charsmax(iBuffer), equal(iBuffer, "") ? "!y(SPECT)": " !y(SPECT)");
}
}
new iszLevelPrefix[64];
if(zp_level(id) < 60)
formatex(iszLevelPrefix, charsmax(iszLevelPrefix), equal(iBuffer, "") ? "!y[!g%d LVL!y]" : " !y[!g%d LVL!y]", zp_level(id));
else
formatex(iszLevelPrefix, charsmax(iszLevelPrefix), equal(iBuffer, "") ? "!y[!gМаксимальный LVL!y]" : " !y[!gМаксимальный LVL!y]");
add(iBuffer, charsmax(iBuffer), iszLevelPrefix);
SAY_GetPrefix(id);
if(!equal(g_szPrefix[id], ""))
{
formatex(iPrefix, charsmax(iPrefix), equal(iBuffer, "") ? "%s" : " %s", g_szPrefix[id]);
add(iBuffer, charsmax(iBuffer), iPrefix);
}
get_user_name(id, iName, charsmax(iName));
formatex(iNameColor, charsmax(iNameColor), equal(iBuffer, "") ? "!t%s" : " !t%s" , iName);
add(iBuffer, charsmax(iBuffer), iNameColor);
add(iBuffer, charsmax(iBuffer), get_user_flags(id) & ADMIN_BAN ? " !y: !g" : " !y: ");
if(!g_iUserTranslit[id] && iMessage[0] != '/')
{
new nLen;
for(new n; iMessage[n] != EOS; n++)
{
if(iMessage[n] < '!' || iMessage[n] > '~') iConvertMessage[nLen++] = iMessage[n];
else
{
iConvertMessage[nLen++] = g_chConvert{(iMessage[n] - '!') * 2};
if(g_chConvert{(iMessage[n] - '!') * 2 + 1} != EOS) iConvertMessage[nLen++] = g_chConvert{(iMessage[n] - '!') * 2 + 1};
}
}
iConvertMessage[nLen] = EOS;
}
else iConvertMessage = iMessage;
for(new i; i < g_aDataBlockMessSize; i++)
{
ArrayGetString(g_aDataBlockMess, i, iMessageControl, charsmax(iMessageControl));
if(containi(iConvertMessage, iMessageControl) == -1) continue;
UTIL_SayText(id, "!y|!gFS CHAT!y| Обнаружена !gспам атака!y/!gреклама");
g_iTimeFlood[id] = get_gametime() + 2.0;
return PLUGIN_HANDLED;
}
if(iTeam)
{
new iTeami;
for(new i = 1; i <= g_iMaxPlayers; i++)
{
iTeami = get_user_team(i, szTeam, charsmax(szTeam));
if(IdTeam != iTeami) continue;
SAY_ChatPrint(i, iBuffer, iConvertMessage, szTeam);
}
}
else SAY_ChatPrint(0, iBuffer, iConvertMessage, szTeam);
g_iUserTimeMes[id] = get_gametime();
log_message("%s <%s> %s : %s", is_user_alive(id) ? "" : "<Мертв>", iName, iTeam ? "say_team" : "say", iConvertMessage);
return PLUGIN_HANDLED_MAIN;
}
stock SAY_GetPrefix(id)
{
new aData[DATA];
for(new i; i < g_aDataSize; i++)
{
ArrayGetArray(g_aData, i, aData);
switch(aData[TYPE])
{
case 'e':
{
static sName[33]; get_user_name(id, sName, charsmax(sName));
if(!strcmp(aData[AUTH], sName))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
case 'f':
{
if(get_user_flags(id) & read_flags(aData[AUTH]))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
case 'i':
{
static sIP[16]; get_user_ip(id, sIP, charsmax(sIP), 1);
if(!strcmp(aData[AUTH], sIP))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
case 's':
{
static sAuthid[25]; get_user_authid(id, sAuthid, charsmax(sAuthid));
if(!strcmp(aData[AUTH], sAuthid))
return copy(g_szPrefix[id], charsmax(g_szPrefix[]), aData[PREFIX]);
}
}
}
return g_szPrefix[id] = "";
}
stock SAY_ChatPrint(pPlayer, const szTags[], const szMessage[], const szTeamColor[])
{
new szBuffer[190], iPlayerTeamColor[10];
if(numargs() > 2) vformat(szBuffer, charsmax(szBuffer), szTags, 3);
else copy(szBuffer, charsmax(szBuffer), szTags);
while(replace(szBuffer, charsmax(szBuffer), "!y", "^1")) {}
while(replace(szBuffer, charsmax(szBuffer), "!t", "^3")) {}
while(replace(szBuffer, charsmax(szBuffer), "!g", "^4")) {}
add(szBuffer, charsmax(szBuffer), szMessage);
switch(pPlayer)
{
case 0:
{
for(new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
{
if(!is_user_connected(iPlayer)) continue;
get_user_team(iPlayer, iPlayerTeamColor, charsmax(iPlayerTeamColor));
UTIL_MsgTeamInfo(iPlayer, szTeamColor);
UTIL_MsgSayText(iPlayer, szBuffer, 1);
UTIL_MsgTeamInfo(iPlayer, iPlayerTeamColor);
}
}
default:
{
get_user_team(pPlayer, iPlayerTeamColor, charsmax(iPlayerTeamColor));
UTIL_MsgTeamInfo(pPlayer, szTeamColor);
UTIL_MsgSayText(pPlayer, szBuffer, 1);
UTIL_MsgTeamInfo(pPlayer, iPlayerTeamColor);
}
}
}
stock UTIL_SayText(pPlayer, const szMessage[], any:...)
{
new szBuffer[190];
if(numargs() > 2) vformat(szBuffer, charsmax(szBuffer), szMessage, 3);
else copy(szBuffer, charsmax(szBuffer), szMessage);
while(replace(szBuffer, charsmax(szBuffer), "!y", "^1")) {}
while(replace(szBuffer, charsmax(szBuffer), "!t", "^3")) {}
while(replace(szBuffer, charsmax(szBuffer), "!g", "^4")) {}
switch(pPlayer)
{
case 0:
{
for(new iPlayer = 1; iPlayer <= g_iMaxPlayers; iPlayer++)
{
if(!is_user_connected(iPlayer)) continue;
UTIL_MsgSayText(iPlayer, szBuffer);
}
}
default: UTIL_MsgSayText(pPlayer, szBuffer);
}
}
stock UTIL_MsgSayText(iPlayer, const szMessage[], iReliable = 0)
{
engfunc(EngFunc_MessageBegin, iReliable ? MSG_ONE : MSG_ONE_UNRELIABLE, MsgId_SayText, {0.0, 0.0, 0.0}, iPlayer);
write_byte(iPlayer);
write_string(szMessage);
message_end();
}
stock UTIL_MsgTeamInfo(iPlayer, const iTeam[])
{
engfunc(EngFunc_MessageBegin, MSG_ONE, MsgId_TeamInfo, {0.0, 0.0, 0.0}, iPlayer);
write_byte(iPlayer);
write_string(iTeam);
message_end();
}