Skip to content

Commit

Permalink
Merge pull request #4 from Sh0rtyyy/main
Browse files Browse the repository at this point in the history
Add text ui, locale to the blips
  • Loading branch information
DevX32 authored Aug 12, 2024
2 parents c2ce35f + d7780f8 commit a474283
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 22 deletions.
2 changes: 1 addition & 1 deletion data/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
75 changes: 54 additions & 21 deletions data/zones.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand All @@ -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
Expand Down Expand Up @@ -190,20 +221,22 @@ 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()
if not currentZone then return end
TriggerEvent('bl_appearance:client:useZone', currentZone.type)
end, false)

RegisterKeyMapping('+openAppearance', 'Open Appearance', 'keyboard', key)
RegisterKeyMapping('+openAppearance', 'Open Appearance', 'keyboard', key)

0 comments on commit a474283

Please sign in to comment.