Help creat shop


#1

Hello i need help for my script,
I want to open a menu only if i am to a position

I am not stupid i creat menu but i don’t write everithing

I have add value for x, y, z pos



local changeYourSkin = {
{name="magasin", colour=15, id=73, x=1864.44, y=3747.34, z=33.0318},
{name="magasin", colour=15, id=73, x=1693.26, y=4822.27, z=42.0630},
{name="magasin", colour=15, id=73, x=125.83, y=-223.16, z=54.5578},
{name="magasin", colour=15, id=73, x=-710.16, y=-153.26, z=37.4151},
{name="magasin", colour=15, id=73, x=-821.69, y=-1073.90, z=11.3280},
{name="magasin", colour=15, id=73, x=-1192.81, y=-768.24, z=17.3193},
{name="magasin", colour=15, id=73, x=4.25, y=6512.88, z=31.8778},
}



After i have add this
Citizen.CreateThread(function()
for _, item in pairs(changeYourSkin) do
item.blip = AddBlipForCoord(item.x, item.y, item.z)
SetBlipSprite(item.blip, item.id)
SetBlipAsShortRange(item.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(item.name)
EndTextCommandSetBlipName(item.blip)
end
end)

(this is working) 


After

function IsNearStore()
local ply = GetPlayerPed(-1)
local plyCoords = GetEntityCoords(ply, 0)
for _, item in pairs(changeYourSkin) do
local distance = GetDistanceBetweenCoords(item.x, item.y, item.z, plyCoords["x"], plyCoords["y"], plyCoords["z"], true)
if(distance <= 10) then
return true
end
end
end

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if (IsNearStore() == true) then
drawTxt('Appuyer sur ~g~H~s~ pour accéder au menu des métiers',0,1,0.5,0.8,0.6,255,255,255,255)
if (IsControlJustPressed(1,Keys["H"]) and IsNearStore() == true) then
InitMenu()
Menu.hidden = not Menu.hidden 
end
end
Menu.renderGUI()
end
end)

This is not working


#2

Up please help me. I need help