Quote:
Originally Posted by Schneider
I just tested it with some random generated coordinates.and the function works good as it should...
Are you sure the house-coordinates are stored correctly and are you using the function correctly? Can you show us the command where you use this function?
Edit: This is the code I used to test it:
//Top of script:
pawn Код:
enum hinfo { Float:EHouseX, Float:EHouseY, Float:EHouseZ }; new Houses[90][hinfo];
//@ OnGameModeInit
pawn Код:
for(new i; i<90; i++) { Houses[i][EHouseX] = (random(6000)-3000); Houses[i][EHouseY] = (random(6000)-3000); Houses[i][EHouseZ] = (random(30)); }
//@ OnPlayerConnect:
pawn Код:
for(new i; i<90; i++) { SetPlayerMapIcon(playerid, i, Houses[i][EHouseX], Houses[i][EHouseY], Houses[i][EHouseZ], 31, 0, MAPICON_GLOBAL); }
//Command:
pawn Код:
COMMAND:getnearesthouse(playerid, params[]) { new house = getClosestPizzaDelivery(playerid); if(house != -1) { SetPlayerCheckpoint(playerid, Houses[house][EHouseX], Houses[house][EHouseY], Houses[house][EHouseZ], 6.0); } return 1; }
It works as it should, It shows a checkpoint at the nearest 'house'.
|
That's just selecting the closest house to your current location...
Also, My information saves via SQL, An selects all houses on loading an saves the info.;
How I need it = IT selects a random house >> GREATER than 500 distance an then returns it..