im trying to add show nearest shop to player. i try this but not work
-- -- Create Blips
function CreateBlip(coords)
for k,v in pairs(Config.Zones) do
for i = 1, #v.Pos, 1 do
local blip = AddBlipForCoord(v.Pos[i].x, v.Pos[i].y, v.Pos[i].z)
SetBlipSprite (blip, 52)
SetBlipDisplay(blip, 4)
SetBlipScale (blip, 1.0)
SetBlipColour (blip, 2)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(_U('shops'))
EndTextCommandSetBlipName(blip)
end
end
end)
if Config.ShowNearestShopOnly then
Citizen.CreateThread(function()
local currentShopBlip = 0
while true do
Citizen.Wait(10000)
local coords = GetEntityCoords(PlayerPedId())
local closest = 1000
local closestCoords
for k,v in pairs(Config.Zones) do
local dstcheck = GetDistanceBetweenCoords(coords, v)
if dstcheck < closest then
closest = dstcheck
closestCoords = v
end
end
if DoesBlipExist(currentShopBlip) then
RemoveBlip(currentShopBlip)
end
currentShopBlip = CreateBlip(closestCoords)
end
end)
elseif Config.ShowAllShop then
Citizen.CreateThread(function()
for k,v in pairs(Config.Zones) do
CreateBlip(v)
end
end)
end
i use esx_shops