if((newkeys == KEY_SUBMISSION) && isLEO(playerid)) { foreach(new i : Player) { new msg[100]; if(GetDistanceBetweenPlayers(playerid, i) < 7.0 && Player[i][playerWanted] < 6 && Player[i][playerWanted] != 0) { format(msg, 100, "/ticket %d", i); return OnPlayerCommandReceived(playerid, msg); } if(GetDistanceBetweenPlayers(playerid, i) < 7.0 && Player[i][playerWanted] > 5) { format(msg, 100, "/arrest %d", i); return OnPlayerCommandReceived(playerid, msg); } else { SendClientMessage(playerid, COLOR_RED, "No supects in range."); return 1; } } }
Player[i][playerWanted] < 6 Player[i][playerWanted] > 5
If it's more than 5 and less than 6 what's it's gonna be then?
Code:
Player[i][playerWanted] < 6 Player[i][playerWanted] > 5 |
Player[i][playerWanted] < 6 && Player[i][playerWanted] != 0
is:
Code:
Player[i][playerWanted] < 6 && Player[i][playerWanted] != 0 |
if((newkeys & KEY_SUBMISSION) /*&& isLEO(playerid)*/) // You don't check for a key using == but &, also you should have posted your IsLEO code as well
{
foreach(new i : Player)
{
new msg[16], Float: Distance; // msg[100], you allocate 100 cells for a command of less than 12 cells
Distance = GetDistanceBetweenPlayers(playerid, i); // should have posted this function's code too, maybe there is something wrong there?
// Are you sure the players who were you talking about had playerWanted > 0?
printf("Playerid %d has playerWanted variable to %d", i, Player[i][playerWanted]); // Debug to check for it
if(Distance < 7.0 && Player[i][playerWanted] <= 5 && Player[i][playerWanted] != 0)
{
format(msg, 100, "/ticket %d", i);
// DEBUG
printf("Trying to ticket playerid %d", i);
return OnPlayerCommandReceived(playerid, msg); // I don't really know if this correctly sends a command to zcmd
}
if(Distance < 7.0 && Player[i][playerWanted] > 5)
{
format(msg, 100, "/arrest %d", i);
// DEBUG
printf("Trying to arrest playerid %d", i);
return OnPlayerCommandReceived(playerid, msg);
}
else
{
SendClientMessage(playerid, COLOR_RED, "No supects in range.");
return 1;
}
}
}