Wdev Vehicle State
Designed to provide a comprehensive framework for handling and preserving vehicle states in its server environment, this script caters to servers using QB-Core or easily adaptable to frameworks. While it doesn’t track bodily damage, it records and saves damages incurred to windows, ignition, body, fuel status, and doors.
–
–
Guide
- Requires access to a MySQL/MariaDB database. Integration is automatically performed if the configuration is correct. The script has integration with oxmysql already configured, but you can adapt it
- The script comes with a pre-configuration for the QB-Core framework. Simply specify the value “QB” in the Framework configuration field within the script.
- It is essential to adapt the
Config.getOwnerVehiclePlatefunction to retrieve the owner of the vehicle. This server-side function takes the entity ID and the plate as parameters. Incorrect configuration of this function will result in the script’s features not functioning correctly.
The script operates through exports. Integrate it into your scripts using the provided exports.
There are various server-side and client-side exports, but two main exports exist.
- Client-Side Export: applyDamagedVehicle
- Parameters:
vehicle: NUMBER(Vehicle entity id)
- Description:
- Processes damage to the specified vehicle.
- Use this export to apply the saved state of the vehicle.
- Whenever a player enters the vehicle and the vehicle subsequently sustains damage, it will be updated in the database.
Export:
exports['wdev_vehicle_state']:applyDamagedVehicle(vehicle)
- Client-Side Export: updateVehicleState
- Parameters:
vehicle: NUMBER(Vehicle entity id)
- Description:
- This export is used to save the vehicle data. It is not mandatory for regular use but can be useful if you want to force the save of the vehicle damage, such as when storing it in your garage system.
Export:
exports['wdev_vehicle_state']:updateVehicleState(vehicle)
| Code is accessible | No |
| Subscription-based | No |
| Lines (approximately) | 600+ |
| Requirements | Standalone |
| Support | Yes |
