Function spams the same text
#1

Hello, i have a problem with this function, what i'm trying to do is loop through all created teleports and also get the distance, but it spam for examle, if i have only one spawn, and its like 1 meter from me it will display sth like


Spawn - 1 meters
2100.9 meters
2100.9 meters
2100.9 meters
2100.9 meters
2100.9 meters
2100.9 meters
2100.9 meters
2100.9 meters
2100.9 meters


Code:

pawn Код:
for(new i = 0; i < sizeof(Teleport); i++)
        {
            format(str, sizeof(str), "%s - %0.2f\n", Teleport[i][Naziv], GetPlayerDistanceFromPoint(playerid, Teleport[i][PozX], Teleport[i][PozY], Teleport[i][PozZ]));
            strcat(info, str, sizeof(info));
        }
Reply
#2

Check if the name of the teleport is not null before getting the distance.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)