ConVar t_name, ct_name;
public void OnPluginStart(){
t_name = FindConVar("se_scoreboard_teamname_t");
ct_name = FindConVar("se_scoreboard_teamname_ct");
HookEvent("round_start", OnRound);
}
public void OnRound(Event event, const char[] name, bool db){
int t = -1, ct = -1, temp_t = -1, temp_ct = -1;
for(int client = 1, frags; client <= MaxClients; client++){
if(!IsClientInGame(client))
continue;
switch(GetClientTeam(client)){
case 2:{
if(temp_t < (frags = GetClientFrags(client))){
temp_t = frags;
t = client;
}
}
case 3:{
if(temp_ct < (frags = GetClientFrags(client))){
temp_ct = frags;
ct = client;
}
}
}
}
char nick[64];
if(t > 0){
GetClientName(t, nick, sizeof(nick));
ReplaceString(nick, sizeof(nick), " ", "_");
ReplaceRuSymb(nick, sizeof(nick));
SetConVarString(t_name, nick, true, false);
}
else
SetConVarString(t_name, "Террористы", true, false);
if(ct > 0){
GetClientName(ct, nick, sizeof(nick));
ReplaceString(nick, sizeof(nick), " ", "_");
ReplaceRuSymb(nick, sizeof(nick));
SetConVarString(ct_name, nick, true, false);
}
else
SetConVarString(ct_name, "Контр-Террористы", true, false);
}
void ReplaceRuSymb(char[] text, int size){
static const char cReplaceSymb[][][] = {{"а", "А", "с", "С", "о", "О", "р", "Р", "е", "Е", "Т", "М", "Н", "Ь", "В", "у", "К", "х", "Х", "З"},
{"a", "A", "c", "C", "o", "O", "p", "P", "e", "E", "T", "M", "H", "b", "B", "y", "K", "x", "X", "3"}};
for(int x; x < sizeof(cReplaceSymb[]); x++)
ReplaceString(text, size, cReplaceSymb[0][x], cReplaceSymb[1][x]);
}