So the code under will show a menu if player is close enough.
Problem is, if I open then menu, and the person runs away, I can still view the menu. Does not matter if he is on the other side of the map.
Anyone knows how to make this menu close if player walks away??
local player, distance = ESX.Game.GetClosestPlayer()
if distance ~= -1 and distance <= 3.0 then
if data2.current.value == 'body_search' then
TriggerServerEvent('esx_mafiajob:sendMsg', GetPlayerServerId(player), _U('being_searched'))
exports['progressBars']:startUI(10000, "Kollar igenom personen")
Citizen.Wait(10000)
OpenBodySearchMenu(player)
end