Ко всем forward:
Code: Select all
forward SendLeaderMessage(color, string[]);
Где нибудь создаёте паблик:
Code: Select all
public SendLeaderMessage(color, string[])
{
for(new i = 0; i < GetMaxPlayers(); i++)
{
if(!IsPlayerConnected(i)) continue;
if(PlayerInfo[i][pLeader] == 0) continue;
SendClientMessage(i, color, string);
}
return true;
}
Ко всем командам:
Code: Select all
if(strcmp(cmd, "/tleaders", true) == 0 || strcmp(cmd, "/tl", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMute] > 0) return SendClientMessage(playerid, COLOR_Cvet_8, "[Ошибка] {FFFFFF}У вас мут.");
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; }
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GRAD2, "GTAMania: (/tl)eaders [text]");
switch(PlayerInfo[playerid][pLeader])
{
case 1:
{
format(string, sizeof(string), "Лидер LSPD %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 2:
{
format(string, sizeof(string), "Лидер FBI %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 3:
{
format(string, sizeof(string), "Лидер Армии %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 4:
{
format(string, sizeof(string), "Лидер МЧС %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 5:
{
format(string, sizeof(string), "Лидер LCN %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 6:
{
format(string, sizeof(string), "Лидер Yakuza %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 7:
{
format(string, sizeof(string), "Лидер Такси %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 8:
{
format(string, sizeof(string), "Лидер Хитманов %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 9:
{
format(string, sizeof(string), "Лидер Репортёров %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 10:
{
format(string, sizeof(string), "Лидер StreetDogs %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 11:
{
format(string, sizeof(string), "Лидер Ballas %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 12:
{
format(string, sizeof(string), "Лидер Grove %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 13:
{
format(string, sizeof(string), "Лидер Vagos %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 14:
{
format(string, sizeof(string), "Лидер Coronos %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 15:
{
format(string, sizeof(string), "Лидер Rifa %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
case 16:
{
format(string, sizeof(string), "Лидер РМ %s[%d]: %s", sendername,playerid,result);
return SendLeaderMessage(TEAM_BLUE_COLOR, string);
}
default:
{
return SendClientMessage(playerid, COLOR_Cvet_8, "[Ошибка]{ffffff} Вам не доступен /tl чат.");
}
}
return 1;
}
}
Вырезано с gtamania rpg