-- ============================================================ -- ox_inventory | Market Hologram Text -- Tüm market lokasyonlarında [E] hologram yazısı gösterir. -- ============================================================ -- ─── 3D Metin Çizme Fonksiyonu ─────────────────────────────── local function DrawText3D(x, y, z, text) local onScreen, sx, sy = World3dToScreen2d(x, y, z) if not onScreen then return end local cam = GetGameplayCamCoords() local dist = #(cam - vector3(x, y, z)) if dist > 25.0 then return end local scale = (1.0 / dist) * 1.8 * ((1.0 / GetGameplayCamFov()) * 100.0) if scale < 0.3 then scale = 0.3 end if scale > 0.6 then scale = 0.6 end SetTextScale(0.0, scale) SetTextFont(4) SetTextProportional(true) SetTextColour(255, 255, 255, 240) SetTextDropShadow(1, 0, 0, 0, 255) SetTextEdge(2, 0, 0, 0, 150) SetTextOutline() SetTextEntry('STRING') SetTextCentre(true) AddTextComponentString(text) DrawText(sx, sy) end -- ─── Market İkonu Çizme ────────────────────────────────────── local function DrawShopMarker(x, y, z) -- Yerdeki şık çember marker (Type 27) DrawMarker( 27, x, y, z - 0.98, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.75, 0.75, 0.75, 30, 144, 255, 120, false, false, 2, false, nil, nil, false ) end -- ─── Shops Verisini Yükle ───────────────────────────────────── local rawShops = load(LoadResourceFile(GetCurrentResourceName(), 'data/shops.lua')) if not rawShops then print('[ox_inventory] HATA: data/shops.lua yüklenemedi!') return end local shopsData = rawShops() if type(shopsData) ~= 'table' then print('[ox_inventory] HATA: shops.lua geçerli tablo döndürmedi!') return end -- ─── Tüm Lokasyonları Düzleştir ────────────────────────────── -- Her market için: { coords = vec3, name = string, icon = string } local shopLocations = {} -- Market tipine göre ikon eşleştirme local shopIcons = { ['Market'] = '🛒', ['Megamall'] = '🏪', ['Eczane'] = '💊', ['EMS Teçhizat'] = '🏥', ['weedshop'] = '🌿', ['İllegal Mekanik Marketi'] = '🔧', ['Vending Machine'] = '🥤', } for shopKey, shopData in pairs(shopsData) do if shopData.locations and type(shopData.locations) == 'table' then local displayName = shopData.name or shopKey local icon = shopIcons[displayName] or '🛍' for _, loc in ipairs(shopData.locations) do if loc and loc.x then table.insert(shopLocations, { coords = vector3(loc.x, loc.y, loc.z), name = displayName, icon = icon, -- Kısıtlı market mi? (groups varsa evet) restricted = (shopData.groups ~= nil), }) end end end end print(('[ox_inventory] Hologram text: %d market lokasyonu yüklendi.'):format(#shopLocations)) -- ─── Ana Loop ───────────────────────────────────────────────── CreateThread(function() while true do local sleep = 1000 local ped = PlayerPedId() local playerPos = GetEntityCoords(ped) for _, shop in ipairs(shopLocations) do local dist = #(playerPos - shop.coords) if dist < 8.0 then sleep = 0 local cx, cy, cz = shop.coords.x, shop.coords.y, shop.coords.z -- Marker DrawShopMarker(cx, cy, cz) -- İsim satırı (üstte) local nameText = shop.icon .. ' ~y~' .. shop.name DrawText3D(cx, cy, cz + 1.35, nameText) -- Etkileşim ipucu (altta) local hintText if shop.restricted then hintText = '~w~[~g~E~w~] Açmak İçin Bas ~r~(Yetkili)' else hintText = '~w~[~g~E~w~] Marketi Açmak İçin Bas' end DrawText3D(cx, cy, cz + 1.05, hintText) elseif dist < 25.0 then -- Uzaktan sadece isim göster (performans için daha az sıklıkta) sleep = math.min(sleep, 0) local cx, cy, cz = shop.coords.x, shop.coords.y, shop.coords.z DrawText3D(cx, cy, cz + 1.35, shop.icon .. ' ~y~' .. shop.name) end end Wait(sleep) end end)