CMD:cops(playerid, params[])
{
new string[200];
SendClientMessage(playerid, pink, " - - - - - <<<<<< Cop's Online on --- >>>>>> - - - - - ");
for(new i; i<MAX_PLAYERS; i++)
{
if(GetPVarInt(i, "cophidden") == 0)
{
if(cop[i][level] == 8)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
if(cop[i][level] == 7)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
if(cop[i][level] == 6)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
if(cop[i][level] == 5)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
if(cop[i][level] == 4)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
if(cop[i][level] == 3)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
if(cop[i][level] == 2)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
if(cop[i][level] == 1)
{
format(string, sizeof(string), "%s %s [ID: %d] Rank: %d", CopRank(i), PlayerName(i), GetPlayerID(PlayerName(i)), cop[i][level]);
SendClientMessage(playerid, blue, string);
}
else if(cop[i][level] == 0 || GetPVarInt(i, "cophidden") == 1)
return SendClientMessage(playerid, pink, ">>>>> No Cops Found Online! <<<<<");
}
}
return 1;
}
Thanks for reply, i thought so too. But is this because the string is used once per player ?
|
GetPlayerID(PlayerName(i))
Question for you: why do you have 9 if-statements, while the output will always be the same, regardless of the player's level? Also this is retarded:
pawn Код:
![]() |
This works fine because samp is single threaded. Nothing else than what is currently running can change the string. |
In that case you still need 8 separate loops, because this won't work as you'd expect.
|