05.02.2015, 21:48
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:
//@ OnGameModeInit
//@ OnPlayerConnect:
//Command:
It works as it should, It shows a checkpoint at the nearest 'house'.
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];
pawn Код:
for(new i; i<90; i++)
{
Houses[i][EHouseX] = (random(6000)-3000);
Houses[i][EHouseY] = (random(6000)-3000);
Houses[i][EHouseZ] = (random(30));
}
pawn Код:
for(new i; i<90; i++)
{
SetPlayerMapIcon(playerid, i, Houses[i][EHouseX], Houses[i][EHouseY], Houses[i][EHouseZ], 31, 0, MAPICON_GLOBAL);
}
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;
}

