Skip to content

Conversation

ZombieProtectionAgency
Copy link
Contributor

Remove ~25% of whitespace by leveraging guard clauses Remove or replace several boolean literals
DRY out a few blocks of code
Correct some name casing inconsistencies

Sorry for such a minor change! I was just fiddling with the script myself to see what I might add/change and I refactored as I was messing with it. Since there haven't been changes to this repository in awhile I wanted to push my cleanup. If this looks Ok I will add on a similar cleanup for the server script.

  • Have you personally loaded this code into an updated qbcore project and checked all it's functionality?
    • I did load and test the script though my testing was a little random.
  • Does your code fit the style guidelines?
    • All categories of changes were based on existing code in the same project.
  • Does your PR fit the contribution guidelines?
    • As far as I am aware my contribution does not violate any guidelines.

Remove ~25% of whitespace by leveraging guard clauses
Remove or replace several boolean literals
DRY out a few blocks of code
Correct some name casing inconsistencies
TriggerServerEvent('hud:server:GainStress', math.random(1, 4))
lastPickedVehicle = vehicle

if GetPedInVehicleSeat(vehicle, -1) == PlayerPedId() then
Copy link
Member

@Qwerty1Verified Qwerty1Verified Jul 14, 2025

Choose a reason for hiding this comment

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

One reason I can think for this to be PlayerPedId() is that the skillbar minigame returns a promise meaning there could be some fair time difference between the definition of ped and the logic utilising it running.

I feel as though in edge cases like the local ped handle changing in-between the minigame starting, and finishing, there could be unexpected behaviour. This is certainly just a negligible edge case though. Realistically, since this condition is solely for if the player is lockpicking from within the seat, their ped handle changing (new ped) should lead to them being kicked out of the vehicle anyways.

@Qwerty1Verified Qwerty1Verified merged commit d9a21de into qbcore-framework:main Jul 14, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants