10.06.2012, 03:48
Hey all.
I am learning how to make my own checkpoint streamer, yet ran into a problem with this function:
for some reason, ClosestCheckpoint is not returned (printf doesn't print anything). I can only assume that the function messes up before then for one reason or another.
I am learning how to make my own checkpoint streamer, yet ran into a problem with this function:
pawn Код:
stock GetPlayerClosestCheckpoint(playerid)
{
new ClosestCheckpoint;
new Float:ClosestDistance;
ClosestDistance=100000000;
for (new i = 1; i<=MAX_CHECKPOINTS; i++)
{
if(CP[i][Created]==1)
{
new Float:Distance;
Distance = GetPlayerDistanceFromPoint(playerid,CP[i][X],CP[i][Y],CP[i][Z]);
if(Distance<ClosestDistance)
{
ClosestDistance=Distance;
ClosestCheckpoint=i;
}
}
}
printf("%d",ClosestCheckpoint);
return ClosestCheckpoint;
}