Developer's Guide

Developer's Guide

This guide is intended for those creating scripts using qbx_core. Following these principles will make it less likely for your script to break in future updates.

Do not access database tables owned by core

Doing this will break your script if the database schema changes in the future. If the data you need can't be read or written using a qbx_core/qbx_vehicles export, create a GitHub issue so we can rectify the problem for everyone.

Do not modify core code

Doing this will make it difficult for you to update in the future, and create confusion when debugging issues that may or may not be due to your custom changes.

We've attempted to design things with flexibility in mind.
However, if you really feel you need to modify core, file a GitHub issue first. We'll see if we can trigger an event for you, surface a config value, or re-design something for the flexibility you need.

Do not use deprecated functions/events

These are likely to be removed in future updates.

Set statebag when spawning an owned vehicle

When spawning a vehicle that is owned by a player, the vehicle's vehicleid statebag should be set to the id from the player_vehicles table. This allows other resources to look up info about the vehicle in the database using a stable identifier

To set vehicle properties when spawning a vehicle, pass the properties into the spawnVehicle function

Do not manually set the properties after the vehicle exists. This is an anti-pattern and may cause issues if the client is not the entity owner.

Do not rely on unversioned/unreleased resources

We make no guarantees about rapid breaking changes in these resources. They are not stable.