22.04.2016, 18:38
Hi, i have a problem, this function should go through all players online and get a random ID that is not Admin or Member id 9, and now me and my friend are testing this but its always giving me error that there is currently no active targets, and my friend is not admin or member with id 9
pawn Код:
foreach(Player, i)
{
new count, target[MAX_PLAYERS], id;
if(PI[i][Member] != 9 && PI[i][Admin] < 1)
{
count++;
}
if(count == 0) return SCM(playerid, ERRORCOLOR, "There is currently no active targets.");
id = target[random(count)];
new level = PI[id][Level];
PI[id][Contract] = level*225;
new str[128];
format(str, sizeof(str), "HQ: New target - name %s - price $%d.", GetName(id), PI[id][Contract]);
SCM(playerid, YELLOW, str);
break;
}