else if ( cmd == "CarNear" )
{
PrivMessage("IDs Near you: " + VehicleNear(player), player);
}
function VehicleNear(Player, Radius)
{
local IDs = null;
local Pos1 = Player.Pos;
for ( local a = 1; FindVehicle( a ); a++ )
{
local Pos2 = FindVehicle(a).Pos;
if ( GetDistance(Pos1.x, Pos2.x, Pos1.y, Pos2.y, Pos1.z, Pos2.z) < 20 ) IDs += FindVehicle(a).ID;
}
return IDs;
}
function GetDistance(X1, X2, Y1, Y2, Z1, Z2)
{
local a = X1 - X2
local b = Y1 - Y2
local c = Z1 - Z2
local x = math.abs(a)
local y = math.abs(b)
local z = math.abs(c)
return math.sqrt((x * x + y * y + z * z))
}