15.01.2013, 21:03
How do I detect if a playerid is in range (55.0) of vehicleid?
Thanks in advance!
Thanks in advance!
RespawnNearbyVehicles(playerid, Float:radi)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i=1; i<MAX_VEHICLES; i++)
{
if(GetVehicleModel(i))
{
new Float:posx, Float:posy, Float:posz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetVehiclePos(i, posx, posy, posz);
tempposx = (posx - x);
tempposy = (posy - y);
tempposz = (posz - z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
SetVehicleToRespawn(i);
}
}
}
}
RespawnNearbyVehicles(playerid, radius);
new Float:X,Float:Y,Float:Z;
GetVehiclePos(vehicleid, X, Y, Z);
if(IsPlayerInRangeOfPoint(playerid, 55.0, X, Y, Z))
{
...
}