Installation
Last updated
Last updated
Before starting, you must log in to the CFX portal to download the asset. You will be able to download it as many times as you want on the official CFX page. Just as you download it the first time, you will also download it multiple times in the future to get updates.
First, log in to the official CFX portal by clicking here.
Remember, if you encounter any issues or errors when starting the asset, you can check here to see if the problem is related.
Understanding CFX AuthThe dependencies for this asset are mandatory, so please follow the dependency guide completely and use all required files.
When downloading a dependency, ensure the file is properly unzipped and does not include "-main" at the end of its name. If it does, please remove it.
Updating to the latest artifacts and gamebuild is essential to avoid common server issues. Here's how to do it properly:
Completely replace your current artifacts with the latest version. Download the appropriate artifacts for your operating system from the official links:
Windows: Windows Artifacts.
Linux: Linux Artifacts.
You can see the complete guide to update your server here:
How to update my serverThis asset must always be started below your framework and inventory but above any vehicle-related scripts. Failure to follow this order may result in functionality issues or critical errors. To ensure smooth operation and proper initialization, it is highly recommended to start the entire download folder using "ensure [vehiclekeys]" in your server.cfg while maintaining the correct order.
Debugging is an essential part of creating and modifying scripts, especially when working with vehicle-related assets. Using tools like print()
statements, you can inspect the values of variables, test logic, and identify errors in your code. Below are some practical tips and examples to help you debug and improve your scripts.
You can use print() statements to display the values of variables in the console. This is particularly useful when you’re unsure of the data being returned or when you need to verify the behavior of your code. Here are two examples:
This approach helps identify whether specific variables are returning the expected values.
In complex scripts, such as when purchasing a vehicle, you might want to validate the data being processed. Using print() statements inside callbacks can reveal any unexpected issues.
By adding debugging prints, you can determine if the vehicle data (e.g., vehicleData.model, generatedPlate) is correct before proceeding with the rest of the logic.
If you need to get the model name or plate of a vehicle, you can use the following native functions. These are simple yet powerful tools for obtaining vehicle information directly:
These functions can be integrated into your scripts to quickly fetch the necessary details about a vehicle.
Place print()
Strategically: Add print() statements before and after key operations to understand the flow of your code.
Label Debug Outputs: Use descriptive text in print() to make debugging outputs easier to read.
Test Incrementally: Test small portions of your script to isolate errors and verify logic step by step.
By following these practices, you’ll streamline your debugging process and ensure that your vehicle scripts operate as intended. Debugging effectively not only saves time but also enhances the reliability and performance of your code.
Vehicle Keys provides an export system to grant or revoke keys for vehicles in external assets. This guide demonstrates how to integrate the GiveKeys export with a third-party asset, such as esx_vehicleshop, to seamlessly handle vehicle key assignments.
Dynamic Plate and Model Retrieval:
Use natives like GetDisplayNameFromVehicleModel
and GetVehicleNumberPlateText
to dynamically fetch the vehicle's model and plate.
Export Usage:
Call GiveKeys
with the retrieved plate
and model
values, and set bypassKeyCheck
as true
if necessary.
Custom Implementation:
While this example uses esx_vehicleshop
, the logic can be adapted for any third-party asset where key assignment is needed.
By integrating the GiveKeys
export in your scripts, you can enhance the gameplay experience by automatically assigning keys upon vehicle purchase or spawn.
Learn more about exports by viewing the following link:
Exports and commandsAll Quasar Store assets use the same process for modifying Key Binds to ensure consistency and optimized performance across all resources.
Below is a clear and detailed guide on how to adjust them to your preferences.
How to change key bindings