Hello, I would like when I press “e” the menu appears and when I press “e” the menu closes again. Another thing: I also wanted to, if possible, when the menu appears, the text (draw3DText) underneath hide and then appear again.
Citizen.CreateThread(function()
SetNuiFocus(false,false)
while true do
Citizen.Wait(5)
for _,mark in pairs(marcacoes) do
local x,y,z = table.unpack(mark)
local distance = GetDistanceBetweenCoords(GetEntityCoords(PlayerPedId()),x,y,z,true)
if distance <= 0.5 then
--DrawMarker(21,x,y,z-0.6,0,0,0,0.0,0,0,0.5,0.5,0.4,0,0,255,50,0,0,0,1)
draw3DText(x, y, z, "PRESSIONE ~g~E~w~ PARA ACESSAR À ~y~MERCEARIA")
--drawTxt("PRESSIONE ~b~E~w~ PARA EMPACOTAR ENCOMENDA",4,0.5,0.93,0.50,255,255,255,180)
if IsControlJustPressed(0,38) then
ToggleActionMenu()
end
end
end
end
end)
function draw3DText(x,y,z, text)
local onScreen,_x,_y=World3dToScreen2d(x,y,z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 255)
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
local factor = (string.len(text)) / 370
DrawRect(_x,_y+0.0125, 0.01+ factor, 0.03, 0, 0, 0, 80)
end