Hello ,
I have a problem I create a menu but I would like that when the distance between the player and the coordinates that I defined are greater than 2 the menu closes. Currently I realize this small code but the menu closes instantly because it is at two different coordinates.
if IsPlayerWantedLevelGreater(GetPlayerIndex(),0) == false and IsPedInAnyVehicle(LocalPed(), true) == false and GetDistanceBetweenCoords(coffeeshopcatalogue[1], coffeeshopcatalogue[2], coffeeshopcatalogue[3],GetEntityCoords(LocalPed())) < 2 then
drawTxt('Press E to buy',0,1,0.5,0.8,0.6,255,255,255,255)
if(IsControlPressed(1, 38)) then
Citizen.Wait(100)
coffeeshop.currentmenu = "main"
coffeeshop.opened = true
coffeeshop.selectedbutton = 0
end
elseif GetDistanceBetweenCoords(coffeeshopcatalogue[1], coffeeshopcatalogue[2], coffeeshopcatalogue[3],GetEntityCoords(LocalPed())) > 2 then
CloseMenu()
end
If you know how to fix this problem it would be super nice to help me
Regards,
Proxene