The best way to do this is take two vectors (1. world coordinate 2. vehicle position coordinate) and find the Euclidean distance.
In C# this would look like:
Vector3 worldCoordinate = new Vector3(0,0,0);
Vector3 vehiclePosition = Game.PlayerPed.CurrentVehicle.Position;
float distance = worldCoordinate.DistanceSquared(vehiclePosition);
then you can use this distance as the radius.
if(distance < 3f)
// do something
In Lua, I’m not sure. I know that there are natives like
GetDistanceBetweenCoords() but doing it without a native is faster. Something like:
if (Vdist2(posX, posY, posZ, carX, carY, carZ) < 3) then
-- do something
but faster (from the natives documentation https://runtime.fivem.net/doc/natives/#_0xF1B760881820C952)
dist = #(vector3(0.0, 0.0, 0.0) - vector3(5.0, 5.0, 5.0))