#ox_inventory show near blip
1 messages · Page 1 of 1 (latest)
-- Function to calculate distance between two points
local function getDistanceBetweenCoords(pos1, pos2)
return #(pos1 - pos2)
end
-- Function to find the closest car wash location
local function getClosestCarWash(playerPos)
local closestDistance = -1
local closestCoords = nil
for i = 1, #config.locations do
local coords = config.locations[i]
local distance = getDistanceBetweenCoords(playerPos, coords)
if closestDistance == -1 or distance < closestDistance then
closestDistance = distance
closestCoords = coords
end
end
return closestCoords
end
-- Function to create a blip for the closest car wash
local function createCarWashBlip(coords)
if carWashBlip ~= nil then
RemoveBlip(carWashBlip)
end
carWashBlip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(carWashBlip, 100)
SetBlipDisplay(carWashBlip, 4)
SetBlipScale(carWashBlip, 0.75)
SetBlipAsShortRange(carWashBlip, true)
SetBlipColour(carWashBlip, 37)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName(locale('label'))
EndTextCommandSetBlipName(carWashBlip)
end
-- Thread to refresh the nearest car wash blip regularly
Citizen.CreateThread(function()
while true do
Citizen.Wait(10000) -- Update every 5 seconds
local playerPed = PlayerPedId()
local playerPos = GetEntityCoords(playerPed)
local closestCoords = getClosestCarWash(playerPos)
if closestCoords then
createCarWashBlip(closestCoords)
end
end
end)
this is for like car wash
I already answered this same question from you in #🙋〡general-support even sent you a code for that @tall linden 