Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak: adjust to new core changes #14

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ local function loadSettings(settings)
SendNUIMessage({ test = true, event = k, toggle = v })
end
end
QBCore.Functions.Notify(Lang:t("notify.hud_settings_loaded"), 'success')
QBX.Functions.Notify(Lang:t("notify.hud_settings_loaded"), 'success')
Wait(1000)
TriggerEvent("hud:client:LoadMap")
end
Expand Down Expand Up @@ -91,10 +91,10 @@ RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function()
Wait(2000)
local hudSettings = GetResourceKvpString('hudSettings')
if hudSettings then loadSettings(json.decode(hudSettings)) end
stress = PlayerData.metadata.stress
hunger = PlayerData.metadata.hunger
thirst = PlayerData.metadata.thirst
hp = PlayerData.metadata.health
stress = QBX.PlayerData.metadata.stress
hunger = QBX.PlayerData.metadata.hunger
thirst = QBX.PlayerData.metadata.thirst
hp = QBX.PlayerData.metadata.health
end)

AddEventHandler('onResourceStart', function(resourceName)
Expand Down Expand Up @@ -127,7 +127,7 @@ RegisterKeyMapping('menu', Lang:t('info.open_menu'), 'keyboard', Config.OpenMenu
-- Reset hud
local function restartHud()
TriggerEvent("hud:client:playResetHudSounds")
QBCore.Functions.Notify(Lang:t("notify.hud_restart"), 'error')
QBX.Functions.Notify(Lang:t("notify.hud_restart"), 'error')
if cache.vehicle then
Wait(2600)
SendNUIMessage({ action = 'car', show = false })
Expand All @@ -137,7 +137,7 @@ local function restartHud()
SendNUIMessage({ action = 'hudtick', show = false })
SendNUIMessage({ action = 'hudtick', show = true })
Wait(2600)
QBCore.Functions.Notify(Lang:t("notify.hud_start"), 'success')
QBX.Functions.Notify(Lang:t("notify.hud_start"), 'success')
end

RegisterNUICallback('restartHud', function(_, cb)
Expand Down Expand Up @@ -358,7 +358,7 @@ RegisterNetEvent("hud:client:LoadMap", function()
Wait(150)
end
if Menu.isMapNotifChecked then
QBCore.Functions.Notify(Lang:t("notify.load_square_map"), 'inform')
QBX.Functions.Notify(Lang:t("notify.load_square_map"), 'inform')
end
SetMinimapClipType(0)
AddReplaceTexture("platform:/textures/graphics", "radarmasksm", "squaremap", "radarmasksm")
Expand Down Expand Up @@ -387,15 +387,15 @@ RegisterNetEvent("hud:client:LoadMap", function()
end
Wait(1200)
if Menu.isMapNotifChecked then
QBCore.Functions.Notify(Lang:t("notify.loaded_square_map"), 'success')
QBX.Functions.Notify(Lang:t("notify.loaded_square_map"), 'success')
end
elseif Menu.isToggleMapShapeChecked == "circle" then
RequestStreamedTextureDict("circlemap", false)
if not HasStreamedTextureDictLoaded("circlemap") then
Wait(150)
end
if Menu.isMapNotifChecked then
QBCore.Functions.Notify(Lang:t("notify.load_circle_map"), 'inform')
QBX.Functions.Notify(Lang:t("notify.load_circle_map"), 'inform')
end
SetMinimapClipType(1)
AddReplaceTexture("platform:/textures/graphics", "radarmasksm", "circlemap", "radarmasksm")
Expand Down Expand Up @@ -424,7 +424,7 @@ RegisterNetEvent("hud:client:LoadMap", function()
end
Wait(1200)
if Menu.isMapNotifChecked then
QBCore.Functions.Notify(Lang:t("notify.loaded_circle_map"), 'success')
QBX.Functions.Notify(Lang:t("notify.loaded_circle_map"), 'success')
end
end
end)
Expand Down Expand Up @@ -522,14 +522,14 @@ RegisterNUICallback('cinematicMode', function(_, cb)
CinematicShow(false)
Menu.isCineamticModeChecked = false
if Menu.isCinematicNotifChecked then
QBCore.Functions.Notify(Lang:t("notify.cinematic_off"), 'error')
QBX.Functions.Notify(Lang:t("notify.cinematic_off"), 'error')
end
DisplayRadar(true)
else
CinematicShow(true)
Menu.isCineamticModeChecked = true
if Menu.isCinematicNotifChecked then
QBCore.Functions.Notify(Lang:t("notify.cinematic_on"), 'success')
QBX.Functions.Notify(Lang:t("notify.cinematic_on"), 'success')
end
end
TriggerEvent("hud:client:playHudChecklistSound")
Expand Down Expand Up @@ -695,7 +695,7 @@ CreateThread(function()
armed = false
end
end
playerDead = IsEntityDead(player) or PlayerData.metadata.inlaststand or PlayerData.metadata.isdead
playerDead = IsEntityDead(player) or QBX.PlayerData.metadata.inlaststand or QBX.PlayerData.metadata.isdead
parachute = GetPedParachuteState(player)
-- Stamina
if not IsEntityInWater(player) then
Expand Down Expand Up @@ -838,7 +838,7 @@ CreateThread(function()
if getFuelLevel(vehicle) <= 20 then -- At 20% Fuel Left
if Menu.isLowFuelChecked then
TriggerServerEvent("InteractSound_SV:PlayOnSource", "pager", 0.10)
QBCore.Functions.Notify(Lang:t("notify.low_fuel"), 'error')
QBX.Functions.Notify(Lang:t("notify.low_fuel"), 'error')
Wait(60000) -- repeats every 1 min until empty
end
end
Expand Down Expand Up @@ -867,8 +867,8 @@ RegisterNetEvent('hud:client:ShowAccounts', function(type, amount)
end)

RegisterNetEvent('hud:client:OnMoneyChange', function(type, amount, isMinus)
cashAmount = PlayerData.money.cash
bankAmount = PlayerData.money.bank
cashAmount = QBX.PlayerData.money.cash
bankAmount = QBX.PlayerData.money.bank
SendNUIMessage({
action = 'updatemoney',
cash = cashAmount,
Expand All @@ -885,7 +885,7 @@ CreateThread(function()
while true do
Wait(1000)
if cache.vehicle then
hasHarness(PlayerData.items)
hasHarness(QBX.PlayerData.items)
end
end
end)
Expand Down
8 changes: 4 additions & 4 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ repository 'https://github.com/Qbox-project/qbx-hud'
description 'HUD for Qbox'

shared_scripts {
'@qbx-core/shared/locale.lua',
'@qbx_core/shared/locale.lua',
'locales/en.lua',
'locales/*.lua',
'config.lua',
'@ox_lib/init.lua',
'@qbx-core/import.lua',
'@qbx_core/import.lua',
}

modules {
'qbx-core:core',
'qbx-core:playerdata',
'qbx_core:core',
'qbx_core:playerdata',
}

server_script 'server.lua'
Expand Down
8 changes: 4 additions & 4 deletions server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ end)

RegisterNetEvent('hud:server:GainStress', function(amount)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local Player = QBX.Functions.GetPlayer(src)
local newStress
if not Player or (Config.DisablePoliceStress and Player.PlayerData.job.type == 'leo') then return end
if not resetStress then
Expand All @@ -42,7 +42,7 @@ end)

RegisterNetEvent('hud:server:RelieveStress', function(amount)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local Player = QBX.Functions.GetPlayer(src)
local newStress
if not Player then return end
if not resetStress then
Expand All @@ -68,15 +68,15 @@ lib.addCommand(Lang:t('commands.cash'), {
help = Lang:t('commands.help.cash'),
restricted = 'group.admin'
}, function(source)
local player = QBCore.Functions.GetPlayer(source)
local player = QBX.Functions.GetPlayer(source)
local cashAmount = player.PlayerData.money.cash
TriggerClientEvent('hud:client:ShowAccounts', source, 'cash', cashAmount)
end)

lib.addCommand(Lang:t('commands.bank'), {
help = Lang:t('commands.help.bank'),
}, function(source)
local player = QBCore.Functions.GetPlayer(source)
local player = QBX.Functions.GetPlayer(source)
local bankAmount = player.PlayerData.money.bank
TriggerClientEvent('hud:client:ShowAccounts', source, 'bank', bankAmount)
end)
Expand Down