09.04.2015, 10:13
problem is whenever im near to a property pickup shows perfect! but icon isnt showing on map idk why can any body check please
PHP код:
function IsPlayerNearProperty(playerid)
{
new Float:Distancex;
for(new prop; prop<PropertiesAmount; prop++)
{
Distancex = GetDistanceToProperty(playerid, prop);
if(Distancex < 999999.0)
{
return prop;
}
}
return -1;
}
function Float:GetDistanceToProperty(playerid, Property)
{
new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
GetPlayerPos(playerid,x1,y1,z1);
x2 = PropInfo[Property][PropX];
y2 = PropInfo[Property][PropY];
z2 = PropInfo[Property][PropZ];
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),6)+floatpower(floatabs(floatsub(y2,y1)),6)+floatpower(floatabs(floatsub(z2,z1)),6));
}
function MapIconStreamer()
{
new Float:SmallestDistance = 999999999.9;
new CP, Float:OldDistance;
for(new propid; propid<PropertiesAmount; propid++)
{
OldDistance = GetDistanceToProperty(i, propid);
if(OldDistance < SmallestDistance)
{
SmallestDistance = OldDistance;
CP = propid;
}
}
DestroyDynamicMapIcon(31);
if(PropInfo[CP][PropIsBought] == 1)
{
CreateDynamicMapIcon(PropInfo[CP][PropX], PropInfo[CP][PropY], PropInfo[CP][PropZ], 31, 0,-1,-1, -1, 65.0);
}
else
{
CreateDynamicMapIcon(PropInfo[CP][PropX], PropInfo[CP][PropY], PropInfo[CP][PropZ], 31, 0,-1,-1, -1, 65.0);
}
return true;
}