04.11.2012, 09:01
I need to ignore certain id's in a loop, I thought maybe 'continue' would escape the id's that do not meet the criteria, however it escapes the whole process.
Here is the code i tested with:
So to clarify, I need to ignore id's that are not connected, that are the playerid and that are the killerid, then process all the remaining id's and check if they are in range of the killerid.
I can tell before I post this I probably havn't explained this very well, but any help is appreciated.
Here is the code i tested with:
pawn Код:
// Under OnPlayerDeath
new Float:x, Float:y, Float:z;
GetPlayerPos(killerid, x, y, z);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(!IsPlayerConnected(i) || i != killerid || i != playerid) continue; // Here is where I am trying to ignore id's that don't meet the criteria.
if(IsPlayerInRangeOfPoint(i, 100.0, x, y, z)) // checking if the players that are connected and are not the killer or the victim but still within 100 meters of the killerid.
{
print("Kill witnessed"); // someone witnessed the kill
}
else // this always gets called atm as the check to ignore id's is wrong
{
print("Kill not witnessed");
}
}
I can tell before I post this I probably havn't explained this very well, but any help is appreciated.