25.12.2011, 21:40
Can you check this command for me. The issue I have is when two players is online and in a different team I can stil lsee him or her in the command.
pawn Код:
if(strcmp(cmd, "/faction", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gPlayerLogged[playerid] == 0)
{
SendClientMessage(playerid, COLOR_DARKGREY, " You are not logged in yet.");
return 1;
}
if(PlayerInfo[playerid][pTeam] == 2)
{
SendClientMessage(playerid, COLOR_DARKGREY, "Members Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, sendername, sizeof(sendername));
if(PlayerInfo[i][pRank] == 12) { format(string, sizeof(string), " Chief of Police %s", sendername); }
else if(PlayerInfo[i][pRank] == 11) { format(string, sizeof(string), " Deputy Chief %s", sendername); }
else if(PlayerInfo[i][pRank] == 10) { format(string, sizeof(string), " Commander %s", sendername); }
else if(PlayerInfo[i][pRank] == 9) { format(string, sizeof(string), " Captain %s", sendername); }
else if(PlayerInfo[i][pRank] == 8) { format(string, sizeof(string), " Lieutenant %s", sendername); }
else if(PlayerInfo[i][pRank] == 7) { format(string, sizeof(string), " CIT Staff Sergeant %s", sendername); }
else if(PlayerInfo[i][pRank] == 6) { format(string, sizeof(string), " Staff Sergeant %s", sendername); }
else if(PlayerInfo[i][pRank] == 5) { format(string, sizeof(string), " Sergeant %s", sendername); }
else if(PlayerInfo[i][pRank] == 4) { format(string, sizeof(string), " Senior Lead Officer %s", sendername); }
else if(PlayerInfo[i][pRank] == 3) { format(string, sizeof(string), " Lead Officer %s", sendername); }
else if(PlayerInfo[i][pRank] == 2) { format(string, sizeof(string), " Police Officer II %s", sendername); }
else if(PlayerInfo[i][pRank] == 1) { format(string, sizeof(string), " Police Officer I %s", sendername); }
SendClientMessage(playerid, COLOR_DARKGREY, string);
}
}
}
else if(PlayerInfo[playerid][pTeam] == 3)
{
SendClientMessage(playerid, COLOR_DARKGREY, "Members Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, sendername, sizeof(sendername));
if(PlayerInfo[i][pRank] == 10) { format(string, sizeof(string), " Sheriff %s", sendername); }
else if(PlayerInfo[i][pRank] == 9) { format(string, sizeof(string), " Undersheriff %s", sendername); }
else if(PlayerInfo[i][pRank] == 8) { format(string, sizeof(string), " Assistant Sheriff %s", sendername); }
else if(PlayerInfo[i][pRank] == 7) { format(string, sizeof(string), " Captain %s", sendername); }
else if(PlayerInfo[i][pRank] == 6) { format(string, sizeof(string), " Lieutenant %s", sendername); }
else if(PlayerInfo[i][pRank] == 5) { format(string, sizeof(string), " Sergeant %s", sendername); }
else if(PlayerInfo[i][pRank] == 4) { format(string, sizeof(string), " Corporal %s", sendername); }
else if(PlayerInfo[i][pRank] == 3) { format(string, sizeof(string), " Deputy Sheriff II %s", sendername); }
else if(PlayerInfo[i][pRank] == 2) { format(string, sizeof(string), " Deputy Sheriff I %s", sendername); }
else if(PlayerInfo[i][pRank] == 1) { format(string, sizeof(string), " Deputy Sheriff Generalist %s", sendername); }
SendClientMessage(playerid, COLOR_DARKGREY, string);
}
}
}
else if(PlayerInfo[playerid][pTeam] == 4)
{
SendClientMessage(playerid, COLOR_DARKGREY, "Members Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, sendername, sizeof(sendername));
if(PlayerInfo[i][pRank] == 10) { format(string, sizeof(string), " Commissioner %s", sendername); }
else if(PlayerInfo[i][pRank] == 9) { format(string, sizeof(string), " Bureau Chief %s", sendername); }
else if(PlayerInfo[i][pRank] == 8) { format(string, sizeof(string), " Battalion Chief %s", sendername); }
else if(PlayerInfo[i][pRank] == 7) { format(string, sizeof(string), " Attending Physician %s", sendername); }
else if(PlayerInfo[i][pRank] == 6) { format(string, sizeof(string), " Lieutenant %s", sendername); }
else if(PlayerInfo[i][pRank] == 5) { format(string, sizeof(string), " Medical Student %s", sendername); }
else if(PlayerInfo[i][pRank] == 4) { format(string, sizeof(string), " Engineer %s", sendername); }
else if(PlayerInfo[i][pRank] == 3) { format(string, sizeof(string), " Firefighter II %s", sendername); }
else if(PlayerInfo[i][pRank] == 2) { format(string, sizeof(string), " Firefighter I %s", sendername); }
else if(PlayerInfo[i][pRank] == 1) { format(string, sizeof(string), " Probationary Firefighter %s", sendername); }
SendClientMessage(playerid, COLOR_DARKGREY, string);
}
}
}
else if(PlayerInfo[playerid][pTeam] == 5)
{
SendClientMessage(playerid, COLOR_DARKGREY, "Members Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, sendername, sizeof(sendername));
if(PlayerInfo[i][pRank] == 9) { format(string, sizeof(string), " Mayor %s", sendername); }
else if(PlayerInfo[i][pRank] == 8) { format(string, sizeof(string), " Deputy Mayor %s", sendername); }
else if(PlayerInfo[i][pRank] == 7) { format(string, sizeof(string), " Council Member %s", sendername); }
else if(PlayerInfo[i][pRank] == 6) { format(string, sizeof(string), " Director %s", sendername); }
else if(PlayerInfo[i][pRank] == 5) { format(string, sizeof(string), " Public Defender %s", sendername); }
else if(PlayerInfo[i][pRank] == 4) { format(string, sizeof(string), " Protection Agent %s", sendername); }
else if(PlayerInfo[i][pRank] == 3) { format(string, sizeof(string), " Secretary %s", sendername); }
else if(PlayerInfo[i][pRank] == 2) { format(string, sizeof(string), " Lawyer %s", sendername); }
else if(PlayerInfo[i][pRank] == 1) { format(string, sizeof(string), " Associate %s", sendername); }
SendClientMessage(playerid, COLOR_DARKGREY, string);
}
}
}
else if(PlayerInfo[playerid][pTeam] == 6)
{
SendClientMessage(playerid, COLOR_DARKGREY, "Members Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, sendername, sizeof(sendername));
if(PlayerInfo[i][pRank] == 6) { format(string, sizeof(string), " Executive Director %s", sendername); }
else if(PlayerInfo[i][pRank] == 5) { format(string, sizeof(string), " General Director %s", sendername); }
else if(PlayerInfo[i][pRank] == 4) { format(string, sizeof(string), " Network Executive %s", sendername); }
else if(PlayerInfo[i][pRank] == 3) { format(string, sizeof(string), " Network Anchor %s", sendername); }
else if(PlayerInfo[i][pRank] == 2) { format(string, sizeof(string), " Reporter %s", sendername); }
else if(PlayerInfo[i][pRank] == 1) { format(string, sizeof(string), " Media Student %s", sendername); }
SendClientMessage(playerid, COLOR_DARKGREY, string);
}
}
}
else if(PlayerInfo[playerid][pTeam] == 7)
{
SendClientMessage(playerid, COLOR_DARKGREY, "Members Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
GetPlayerName(i, sendername, sizeof(sendername));
if(PlayerInfo[i][pRank] == 7) { format(string, sizeof(string), " Commissioner %s", sendername); }
else if(PlayerInfo[i][pRank] == 6) { format(string, sizeof(string), " Deputy Commissioner %s", sendername); }
else if(PlayerInfo[i][pRank] == 5) { format(string, sizeof(string), " Assistant Commissioner %s", sendername); }
else if(PlayerInfo[i][pRank] == 4) { format(string, sizeof(string), " Captain %s", sendername); }
else if(PlayerInfo[i][pRank] == 3) { format(string, sizeof(string), " Lieutenant %s", sendername); }
else if(PlayerInfo[i][pRank] == 2) { format(string, sizeof(string), " Sergeant %s", sendername); }
else if(PlayerInfo[i][pRank] == 1) { format(string, sizeof(string), " Trooper %s", sendername); }
SendClientMessage(playerid, COLOR_DARKGREY, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_DARKGREY, " You are not authorized to use that command.");
}
}
return 1;
}