Skip to content

Conversation

@S33G
Copy link

@S33G S33G commented Oct 10, 2025

Description

Add check for resource state before accessing vehicle keys.

If I remove/stop qbx_vehiclekeys, I see an error everytime I enter a vehicle.

This code prevents the constant errors.

Checklist

  • I have personally loaded this code into an updated Qbox project and checked all of its functionality.
  • My pull request fits the contribution guidelines & code conventions.

Add check for resource state before accessing vehicle keys.

If I remove/stop `qbx_vehiclekeys`, I see an error everytime I enter a vehicle.

This code prevents the constant errors.
Comment on lines +82 to +86
if GetResourceState('qbx-vehiclekeys') == 'started' then
return exports.qbx_vehiclekeys:HasKeys(vehicle)
else
return true
end
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
if GetResourceState('qbx-vehiclekeys') == 'started' then
return exports.qbx_vehiclekeys:HasKeys(vehicle)
else
return true
end
return GetResourceState('qbx-vehiclekeys') ~= 'started' or exports.qbx_vehiclekeys:HasKeys(vehicle)

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