29.11.2010, 10:31
You want their distance to a vehicle? Well all you need is getdistance then 
Example of using it like you want to:
Hope that helps!

pawn Код:
Float:GetDistance(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2)
{
return Float:floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
pawn Код:
new Float:x[2],Float:y[2],Float:z[2],distance;
GetVehiclePos(vehicleid,x[0],y[0],z[0]);
GetPlayerPos(playerid,x[1],y[1],z[1]);
distance = floatround(GetDistance(x[0],y[0],z[0],x[1],y[1],z[1]));
printf("Distance to car: %d",distance);
if(distance < 5000) // He's less than 5000 from the car!