Skip to content
26 changes: 24 additions & 2 deletions client/handsup.lua
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
local handsUp = false

local function isDeadOrDown(ped)

if LocalPlayer and LocalPlayer.state then
if LocalPlayer.state.dead == true or LocalPlayer.state.down == true then
return true
end
end

return IsEntityDead(ped) or IsPedRagdoll(ped)
end

RegisterCommand(Config.HandsUp.command, function()
local ped = PlayerPedId()

if not HasAnimDictLoaded('missminuteman_1ig_2') then
RequestAnimDict('missminuteman_1ig_2')
while not HasAnimDictLoaded('missminuteman_1ig_2') do
Wait(10)
end
end
handsUp = not handsUp
if exports['qb-policejob']:IsHandcuffed() then return end

local wantRaise = not handsUp

if wantRaise then
if GetResourceState('qb-policejob') == 'started' or GetResourceState('qb-policejob') == 'starting' then
local ok, cuffed = pcall(function() return exports['qb-policejob']:IsHandcuffed() end)
if ok and cuffed then return end
end
if isDeadOrDown(ped) then return end
end

handsUp = wantRaise
if handsUp then
TaskPlayAnim(ped, 'missminuteman_1ig_2', 'handsup_base', 8.0, 8.0, -1, 50, 0, false, false, false)
exports['qb-smallresources']:addDisableControls(Config.HandsUp.controls)
Expand Down
37 changes: 37 additions & 0 deletions client/seatbelt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ local damageDone = false
local modifierDensity = true
local lastVeh = nil
local veloc
local seatbeltAlarmRunning = false

local function seatbeltShouldBeep()
local ped = PlayerPedId()
if not IsPedInAnyVehicle(ped, false) then return false end
if seatbeltOn or harnessOn then return false end
return true -- біпаємо завжди, коли не пристебнутий і в авто
end

local function seatbeltAlarmStop()
seatbeltAlarmRunning = false
end

local function seatbeltAlarmStart(delayMs)
if seatbeltAlarmRunning then return end
seatbeltAlarmRunning = true
CreateThread(function()
if delayMs and delayMs > 0 then Wait(delayMs) end
while seatbeltAlarmRunning do
if not seatbeltShouldBeep() then break end
TriggerServerEvent('InteractSound_SV:PlayOnSource', 'beltalarm', 0.2)
Wait(2500)
end
seatbeltAlarmRunning = false
end)
end

-- Functions

Expand All @@ -40,8 +66,15 @@ local function toggleSeatbelt()
SeatBeltLoop()
TriggerEvent("seatbelt:client:ToggleSeatbelt", seatbeltOn)
TriggerServerEvent("InteractSound_SV:PlayWithinDistance", 5.0, seatbeltOn and "carbuckle" or "carunbuckle", 0.25)

if seatbeltOn or harnessOn then
seatbeltAlarmStop()
else
seatbeltAlarmStart(1200)
end
end


local function toggleHarness()
harnessOn = not harnessOn
if not harnessOn then return end
Expand All @@ -64,6 +97,7 @@ function SeatBeltLoop()
if not IsPedInAnyVehicle(PlayerPedId(), false) then
seatbeltOn = false
harnessOn = false
seatbeltAlarmStop()
TriggerEvent("seatbelt:client:ToggleSeatbelt", seatbeltOn)
break
end
Expand Down Expand Up @@ -227,6 +261,9 @@ RegisterNetEvent('QBCore:Client:EnteredVehicle', function()
Wait(2000)
break
end
if not seatbeltOn and not harnessOn then
seatbeltAlarmStart()
end
end
end)

Expand Down
67 changes: 67 additions & 0 deletions locales/ua
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
local Translations = {
afk = {
will_kick = "Ви AFK і будете кікнуті через ",
time_seconds = " секунд!",
time_minutes = " хвилину(и)!",
kick_message = "Вас було кікнуто за бездіяльність (AFK)"
},
wash = {
in_progress = "Авто миється...",
wash_vehicle = "[E] Помити авто",
wash_vehicle_target = "Помити авто",
dirty = "Авто не забруднене",
cancel = "Миття скасовано..."
},
consumables = {
eat_progress = "Їсте...",
drink_progress = "П'єте...",
liqour_progress = "Вживаєте алкоголь...",
coke_progress = "Швидке вдихання...",
crack_progress = "Курите крек...",
ecstasy_progress = "Ковтаєте пігулки...",
healing_progress = "Зцілення...",
meth_progress = "Курите жорсткий мет...",
joint_progress = "Підпалюєте косяк...",
use_parachute_progress = "Надягаєте парашут...",
pack_parachute_progress = "Пакуєте парашут...",
no_parachute = "У вас немає парашута!",
armor_full = "У вас вже достатньо броні!",
armor_empty = "На вас немає бронежилета...",
armor_progress = "Надягаєте бронежилет...",
heavy_armor_progress = "Надягаєте важкий бронежилет...",
remove_armor_progress = "Знімаєте бронежилет...",
canceled = "Скасовано..."
},
cruise = {
unavailable = "Круїз-контроль недоступний",
activated = "Круїз-контроль активовано",
deactivated = "Круїз-контроль вимкнено"
},
editor = {
started = "Запис розпочато!",
save = "Запис збережено!",
delete = "Запис видалено!",
editor = "До зустрічі, алігаторе!"
},
firework = {
place_progress = "Встановлення феєрверку...",
canceled = "Скасовано...",
time_left = "Запуск феєрверку через ~r~"
},
seatbelt = {
use_harness_progress = "Пристібання гоночного ременя",
remove_harness_progress = "Зняття гоночного ременя",
no_car = "Ви не в автомобілі."
},
teleport = {
teleport_default = "Скористатись ліфтом"
},
pushcar = {
stop_push = "[E] Зупинити штовхання"
}
}

Lang = Lang or Locale:new({
phrases = Translations,
warnOnMissing = true
})
Comment on lines +1 to +67
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in a different PR, this is not what this PR aims to do (supposedly)?
And fix the issues with it ofcourse, as it currently lacks the .lua extension.

16 changes: 12 additions & 4 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,26 @@ RegisterNetEvent('equip:harness', function(item)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
if not Player then return end
if not Player.PlayerData.items[item.slot].info.uses then
Player.PlayerData.items[item.slot].info.uses = Config.HarnessUses - 1

local slot = item and item.slot
local itemData = slot and Player.PlayerData.items[slot]
local info = itemData and itemData.info
local uses = info and info.uses

if not uses then
-- if there was no uses at all, set the initial value
Player.PlayerData.items[slot].info.uses = Config.HarnessUses - 1
Player.Functions.SetInventory(Player.PlayerData.items)
elseif Player.PlayerData.items[item.slot].info.uses == 1 then
elseif uses == 1 then
exports['qb-inventory']:RemoveItem(src, 'harness', 1, false, 'equip:harness')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
exports['qb-inventory']:RemoveItem(src, 'harness', 1, false, 'equip:harness')
exports['qb-inventory']:RemoveItem(src, 'harness', 1, slot, 'equip:harness')

We need to define the slot here, so another harness with full usage doesnt get removed forexample.

TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items['harness'], 'remove')
else
Player.PlayerData.items[item.slot].info.uses -= 1
Player.PlayerData.items[slot].info.uses -= 1
Player.Functions.SetInventory(Player.PlayerData.items)
end
end)


RegisterNetEvent('seatbelt:DoHarnessDamage', function(hp, data)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
Expand Down