diff --git a/data/config.lua b/data/config.lua index 8ce7913..099ebef 100644 --- a/data/config.lua +++ b/data/config.lua @@ -2,7 +2,7 @@ Config = { locale = 'en', openControl = 'E', previousClothing = 'qb', -- 'illenium' | 'qb' | 'esx' | 'fivem-appearance' - + textUi = true -- if true, uses textUI | if false, uses sprite outfitItem = 'clothes', -- Item given to the player when they want to make outfit an item to use } diff --git a/data/zones.lua b/data/zones.lua index b0799b0..feb2a54 100644 --- a/data/zones.lua +++ b/data/zones.lua @@ -126,29 +126,60 @@ local stores = { } } -local currentZone = nil local key = Config.openControl +local textUi = Config.textUi +local control = Config.openControl +local textui = exports.bl_bridge:textui() +local currentZone = nil local sprites = {} local function setupZones() - if GetResourceState('bl_sprites') == 'missing' then return end for _, v in pairs(stores) do - sprites[#sprites+1] = exports.bl_sprites:sprite({ - coords = v.coords, - shape = 'hex', - key = key, - distance = 3.0, - onEnter = function() + + if textUi then + local point = lib.points.new({ + coords = v.coords, + distance = 3.0, + }) + + function point:onEnter() currentZone = v - end, - onExit = function() + local prefix = "[" .. control .. "] - " + if currentZone.type == 'barber' then + textui.showTextUI(prefix .. "Barber Shop", 'left') + elseif currentZone.type == 'tattoos' then + textui.showTextUI(prefix .. "Tattoo Parlor", 'left') + elseif currentZone.type == 'clothing' then + textui.showTextUI(prefix .. "Clothing Store", 'left') + elseif currentZone.type == 'surgeon' then + textui.showTextUI(prefix .. "Surgeon", 'left') + end + end + + function point:onExit() currentZone = nil + textui.hideTextUI() + end + else + if GetResourceState('bl_sprites') == 'missing' then return end + for _, v in pairs(stores) do + sprites[#sprites+1] = exports.bl_sprites:sprite({ + coords = v.coords, + shape = 'hex', + key = key, + distance = 3.0, + onEnter = function() + currentZone = v + end, + onExit = function() + currentZone = nil + end + }) end - }) + end end end - setupZones() local blips = {} @@ -160,7 +191,7 @@ local function createBlips() if v.type == 'barber' then spriteId = 71 blipColor = 0 - blipname = 'Barber' + blipname = 'Barber Shop' elseif v.type == 'clothing' then spriteId = 73 blipColor = 0 @@ -190,15 +221,17 @@ createBlips() AddEventHandler('onResourceStop', function(resource) if resource == GetCurrentResourceName() then - for _, blip in pairs(blips) do - RemoveBlip(blip) - end + for _, blip in pairs(blips) do + RemoveBlip(blip) + end - for _, sprite in pairs(sprites) do - sprite:removeSprite() - end + if not textUi then + for _, sprite in pairs(sprites) do + sprite:removeSprite() + end + end end - end) +end) RegisterCommand('+openAppearance', function() @@ -206,4 +239,4 @@ RegisterCommand('+openAppearance', function() TriggerEvent('bl_appearance:client:useZone', currentZone.type) end, false) -RegisterKeyMapping('+openAppearance', 'Open Appearance', 'keyboard', key) \ No newline at end of file +RegisterKeyMapping('+openAppearance', 'Open Appearance', 'keyboard', key)