Hi again,
When I tried to get the nearest unlocked house, it shows unknown command but when I closed the house, it does work but it was opposite of what I want.
Command I make to test the system
COMMAND:testhouse(playerid, params[])
{
? ? //GetClosestHouse
? ? new iClosest = GetClosestHouse(playerid);
SetPlayerCheckpoint(playerid, House, House, House, 3.0);
SendClientInfo(playerid, "Marker set to the closest house.");
return 1;
}
Function
stock GetClosestHouse(playerid)
{
new
? ? cl_ID = -1,
Float:cl_DIST = 9999.0;
for(new i=1, l=MAX_HOUSES; i != l; i)
{
? ? if(House != 1) continue;
if( GetPlayerDistanceToPointEx(playerid, House,? House, House) < cl_DIST )
{
? ? cl_ID = i;
? ? cl_DIST = GetPlayerDistanceToPointEx(playerid, House,House,House);
}
}
return cl_ID;
}