πGive Vehicle Functionality
This code is located in the server/functions.lua
file.
Warning
If you do not have programming experience, it is recommended not to modify this code to avoid breaking the system.
Overview
The function GiveVehicle(source, vehicleName, type)
grants a vehicle to a player and saves it in the database with a unique plate and default properties.
Key Components
GeneratePlate()
Creates a unique vehicle plate based on the configured framework. It checks the database to avoid duplicate plates.GetVehicleProperties(name, plate, helicopter)
Returns default vehicle settings, including colors, health, mods, and extras. Supports cars and helicopters.GiveVehicle(source, vehicleName, type)
Retrieves the player data.
Generates a unique plate.
Determines the appropriate garage based on the vehicle type (car, air, boat).
Gets vehicle properties.
Inserts vehicle data into the database, adapting to the framework used.
How to Modify
Adjust plate format in
GeneratePlate()
.Change vehicle stats or add mods in
GetVehicleProperties()
.Add support for other frameworks inside
GiveVehicle()
by extending the database logic.Customize garage assignment inside
GiveVehicle()
as needed.

Last updated