Skip to content

Commit be1f43c

Browse files
Merge pull request #501 from Mustachedom/main
- `refactor` Quality of life changes
2 parents c5da72c + 2f0a4f3 commit be1f43c

21 files changed

Lines changed: 80 additions & 57 deletions

client/afk.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
22
local isLoggedIn = LocalPlayer.state.isLoggedIn
33
local checkUser = true
44
local prevPos, time = nil, nil

client/carwash.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
22
local washingVeh, listen = false, false
33
local washPoly = {}
44

client/consumables.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
-- Variables
22

3-
local QBCore = exports['qb-core']:GetCoreObject()
43
local alcoholCount = 0
54
local healing, parachuteEquipped = false, false
65
local currVest, currVestTexture = nil, nil

client/cruise.lua

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
22
local vehicleClasses = {
33
[0] = true,
44
[1] = true,
@@ -31,9 +31,20 @@ local function triggerCruiseControl(veh)
3131
if speed > 0 and GetVehicleCurrentGear(veh) > 0 then
3232
speed = GetEntitySpeed(veh)
3333
local isTurningOrHandbraking = IsControlPressed(2, 76) or IsControlPressed(2, 63) or IsControlPressed(2, 64)
34+
if GetResourceState('qb-fuel') == 'started' then
35+
if exports['qb-fuel']:GetFuel(veh) <= 10 then
36+
QBCore.Functions.Notify(Lang:t('cruise.not_Enough_Fuel'), 'error')
37+
return
38+
end
39+
end
40+
if GetResourceState('LegacyFuel') == 'started' then
41+
if exports['LegacyFuel']:GetFuel(veh) <= 10 then
42+
QBCore.Functions.Notify(Lang:t('cruise.not_Enough_Fuel'), 'error')
43+
return
44+
end
45+
end
3446
TriggerEvent('seatbelt:client:ToggleCruise', true)
3547
QBCore.Functions.Notify(Lang:t('cruise.activated'))
36-
3748
CreateThread(function()
3849
while speed > 0 and GetPedInVehicleSeat(veh, -1) == ped do
3950
Wait(0)
@@ -76,4 +87,4 @@ RegisterCommand('togglecruise', function()
7687
end
7788
end, false)
7889

79-
RegisterKeyMapping('togglecruise', 'Toggle Cruise Control', 'keyboard', 'Y')
90+
RegisterKeyMapping('togglecruise', 'Toggle Cruise Control', 'keyboard', 'Y')

client/discord.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
21

32
CreateThread(function()
43
while Config.Discord.isEnabled do

client/fireworks.lua

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
22
local fireworkTime = 0
33
local fireworkLoc = nil
44
local fireworkList = {
@@ -35,42 +35,20 @@ local fireworkList = {
3535
}
3636
}
3737

38-
local function DrawText3D(x, y, z, text)
39-
SetTextScale(0.35, 0.35)
40-
SetTextFont(4)
41-
SetTextProportional(true)
42-
SetTextColour(255, 255, 255, 215)
43-
BeginTextCommandDisplayText('STRING')
44-
SetTextCentre(true)
45-
AddTextComponentSubstringPlayerName(text)
46-
SetDrawOrigin(x, y, z, 0)
47-
EndTextCommandDisplayText(0.0, 0.0)
48-
local factor = (string.len(text)) / 370
49-
DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
50-
ClearDrawOrigin()
51-
end
52-
53-
local function fireworkText()
54-
CreateThread(function()
55-
while true do
56-
Wait(0)
57-
if fireworkTime > 0 and fireworkLoc then
58-
DrawText3D(fireworkLoc.x, fireworkLoc.y, fireworkLoc.z, Lang:t('firework.time_left') .. fireworkTime)
59-
end
60-
if fireworkTime <= 0 then break end
61-
end
62-
end)
63-
end
6438

6539
local function startFirework(asset, coords)
6640
fireworkTime = Config.Fireworks.delay
6741
fireworkLoc = { x = coords.x, y = coords.y, z = coords.z }
42+
local pedCoords = GetEntityCoords(PlayerPedId())
6843
CreateThread(function()
69-
fireworkText()
7044
while fireworkTime > 0 do
45+
if #(pedCoords - vector3(coords.x, coords.y, coords.z)) < 50.0 then
46+
exports['qb-core']:DrawText(Lang:t('firework.time_left') .. ' ' .. fireworkTime)
47+
end
7148
Wait(1000)
7249
fireworkTime -= 1
7350
end
51+
exports['qb-core']:HideText()
7452
UseParticleFxAssetNextCall('scr_indep_fireworks')
7553
for _ = 1, math.random(5, 10), 1 do
7654
local firework = fireworkList[asset][math.random(1, #fireworkList[asset])]

client/seatbelt.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
22
local seatbeltOn = false
33
local harnessOn = false
44
local harnessHp = Config.HarnessUses

client/tackle.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
22

33
local function tackleAnim()
44
local ped = PlayerPedId()

client/vehiclepush.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ CreateThread(function()
6666
icon = 'fas fa-wrench',
6767
label = 'Push Vehicle',
6868
action = function(entity)
69+
if GetEntityHealth(entity) > Config.DamageNeeded then
70+
QBCore.Functions.Notify(Lang:t('pushcar.notDamaged'), 'error')
71+
return
72+
end
6973
TriggerEvent('vehiclepush:client:push', entity)
7074
end,
7175
distance = 1.3

client/vehicletext.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local QBCore = exports['qb-core']:GetCoreObject()
1+
22

33
CreateThread(function()
44
for _, v in pairs(QBCore.Shared.Vehicles) do

0 commit comments

Comments
 (0)