29.01.2015, 18:10
I am using these codes for my gas station
pawn Код:
NearestGasStation(playerid)
{
new gasid, Float:distance = 99999.0, Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 0; i <MAX_BIZ; i++)
{
new Float:tempdist;
tempdist = GetDistance(x, y, z, BizInfo[i][EXTX], BizInfo[i][EXTY], BizInfo[i][EXTZ]);
if(tempdist < distance)
{
distance = tempdist;
gasid= i;
}
}
return gasid;
}