Citizen.CreateThread(function()
while true do
local InRange = false
local PlayerPed = PlayerPedId()
local PlayerPos = GetEntityCoords(PlayerPed)
local wait = 2000
if PlayerData.job then
for shop, _ in pairs(Config.Locations) do
if Config.Locations[shop]["job"] == "all" or Config.Locations[shop]["job"] == PlayerData.job.name then
local position = Config.Locations[shop]["coords"]
for _, loc in pairs(position) do
local dist = #(vector3(PlayerPos) - vector3(loc["x"], loc["y"], loc["z"]))
if dist < 3 then
DrawMarker(2, loc["x"], loc["y"], loc["z"], 0, 0, 0, 0, 0, 0, 0.2, 0.2, 0.2, 32, 236, 54, 100, 0, 0, 0, 1, 0, 0, 0)
text = Config.Locations[shop]["label"]
wait = 1
InRange = true
-- DrawMarker(2, loc["x"], loc["y"], loc["z"], 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.25, 0.2, 0.1, 255, 255, 255, 155, 0, 0, 0, 1, 0, 0, 0)
if dist < 1 then
text = '[E] - '..text
if IsControlJustPressed(0, Config.Keys["E"]) then
if Config.Locations[shop]["label"] == "Silahçı" then
if not exports["tq-level"]:checkLevel(3) then
exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Silahçı seni tanımıyor.', 'top-center', 5000)
break
end
end
if Config.Locations[shop]["label"] == "Blackmarket" then
if not exports["tq-level"]:checkLevel(3) then
exports['h-notif']:send('fas fa-exclamation-circle', 'error', 'Satıcı seni tanımıyor.', 'top-center', 5000)
break
end
end
local ShopItems = {}
ShopItems.label = Config.Locations[shop]["label"]
ShopItems.items = Config.Locations[shop]["products"]
ShopItems.slots = 30
TriggerServerEvent("inventory:server:OpenInventory", "shop", "Itemshop_"..shop, ShopItems)
end
end
-- DrawText3D(loc["x"], loc["y"], loc["z"] , text)
end
end
end
end
end
Citizen.Wait(wait)
end
end)