16.09.2016, 21:01
The closest location instead of random that it currently is?
pawn Code:
new closest_location, Float: tmp_cd, Float: closest_distance = GetPlayerDistanceFromPoint(playerid, ALocations[0][LocX], ALocations[0][LocY], ALocations[0][LocZ]);
for (new i = 1; i != sizeof ALocations; i++)
{
if ((tmp_cd = GetPlayerDistanceFromPoint(playerid, ALocations[i][LocX], ALocations[i][LocY], ALocations[i][LocZ])) < closest_distance)
{
closest_distance = tmp_cd;
closest_location = i;
}
}
// to set the position to the closest location use:
ALocations[closest_location][LocX], ALocations[closest_location][LocY], ALocations[closest_location][LocZ]