- 
                Notifications
    You must be signed in to change notification settings 
- Fork 340
fix harness #500
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
base: main
Are you sure you want to change the base?
fix harness #500
Conversation
using main en.lua was translated to Ukrainian language.
using main en.lua was translated to Ukrainian language. I have personally loaded this code into an updated qbcore project and checked all it's functionality This code fit the style guidelines This PR fit the contribution guidelines
Description of Changes Added full validation to the equip:harness server event to prevent runtime errors caused by missing or undefined item slot data. Introduced local variables for safer access to nested fields such as Player.PlayerData.items[slot].info.uses. Applied default value (Config.HarnessUses - 1) when uses data is not present, ensuring stability and continuity of harness logic. Prevented the script from crashing with attempt to index a nil value by checking all required fields before accessing them. Testing Changes were tested in-game in multiple scenarios: Harness item with no info.uses field: correctly initializes the value and does not crash. Harness item with uses = 1: removes the item as expected. Harness item with uses > 1: decreases the use count and updates inventory properly. No errors or crashes occurred during testing.
fixed error when use harness
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though I do not personally love the idea of having the equip:harness event, as it is a bit questionable. That is not really this PR's fault.
Have a look at my feedback and I'd say this is good to merge after that.
| 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 | ||
| }) | 
There was a problem hiding this comment.
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.
| 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') | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
This PR updates the handsup.lua script in qb-smallresources to improve realism and prevent abuse: Added validation to block raising hands when the player is incapacitated (dead or downed). Preserves the original toggle logic: Press once → hands up. Press again → hands down. Still allows lowering hands even when incapacitated, avoiding animation lock. Integrates with LocalPlayer.state.dead and LocalPlayer.state.down from medical systems. Keeps compatibility with existing handcuff checks from qb-policejob. Why? Previously, players could raise their hands while knocked out or dead, which caused immersion and exploit issues. Now the system respects player state while keeping the toggle behavior intact. Testing Verified raising/lowering hands works normally when alive. Verified hands cannot be raised while dead/knocked out. Verified hands automatically lower on death/knockout. Verified compatibility with police handcuffs.
add incapacitated state check to handsup.lua
This PR introduces a new seatbelt alarm feature that plays the beltalarm.ogg sound (from interact-sound/client/html/sounds) in a loop whenever a player is inside a vehicle without a fastened seatbelt or harness. Key changes: Added seatbeltAlarmStart/Stop logic with thread-safe guard to prevent duplicate loops. Alarm starts automatically when: Player enters a vehicle unbuckled. Player unbuckles the seatbelt inside a vehicle. Alarm stops when: Seatbelt or harness is fastened. Player leaves the vehicle. Delay of 1200ms after unbuckling ensures the carunbuckle sound can finish before the loop starts. Integrated seamlessly with existing carbuckle / carunbuckle sounds. Benefits: Improves immersion and roleplay realism (mimics real car warning systems). Provides clear audio feedback for unbuckled players. Fully backward-compatible; does not break existing harness/seatbelt logic.
Add seatbelt alarm loop when unbuckled
Description of Changes
Added full validation to the equip:harness server event to prevent runtime errors caused by missing or undefined item slot data. Introduced local variables for safer access to nested fields such as Player.PlayerData.items[slot].info.uses. Applied default value (Config.HarnessUses - 1) when uses data is not present, ensuring stability and continuity of harness logic. Prevented the script from crashing with attempt to index a nil value by checking all required fields before accessing them.
Testing
Changes were tested in-game in multiple scenarios: Harness item with no info.uses field: correctly initializes the value and does not crash. Harness item with uses = 1: removes the item as expected. Harness item with uses > 1: decreases the use count and updates inventory properly. No errors or crashes occurred during testing.