Module sv_vehicles
Vehicles System
Functions
| CreateVehicle (id, modelHash, x, y, z, heading, netMissionEntity, props, freeze) | CreateVehicle function. |
| CreateClientVehicle (src, id, modelHash, x, y, z, heading, netMissionEntity, props, freeze, interaction, zone, displayText) | CreateClientVehicle function. |
| FreezeVehicle (id, boolean) | FreezeVehicle function. |
| FreezeClientVehicle (src, id, boolean) | FreezeClientVehicle function. |
| DeleteVehicle (id) | DeleteVehicle function. |
| DeleteClientVehicle (src, id) | DeleteClientVehicle function. |
| CategoriseCars (carList) | CategoriseCars function. |
| ChooseRandomCar (vehicles, category) | ChooseRandomCar function. |
| ChooseRandomCategory (cars) | ChooseRandomCategory function. |
| GetVehiclesFromShop (vehicles, shops, types) | GetVehiclesFromShop function. |
| GeneratePlate (length) | GeneratePlate function. |
| IsSpawnAreaClear (src, coords) | IsSpawnAreaClear function. |
| DeleteAllVehicles () | DeleteAllVehicles function. |
Tables
| Interaction | Interaction Table. |
| CarList | CarList Table. |
Functions
- CreateVehicle (id, modelHash, x, y, z, heading, netMissionEntity, props, freeze)
-
CreateVehicle function.
This function creates a server sided vehicle.
Parameters:
- id The vehicle's id.
- modelHash The vehicle's model hash.
- x The vehicle's x coordinate.
- y The vehicle's y coordinate.
- z The vehicle's z coordinate.
- heading The vehicle's heading.
- netMissionEntity The vehicle's net mission entity.
- props The vehicle's properties.
- freeze The vehicle's freeze state.
Returns:
-
number
Usage:
local vehicleId = exports.jones_util:CreateVehicle("vehicle", "adder", 0, 0, 0, 0, false, false, false)
- CreateClientVehicle (src, id, modelHash, x, y, z, heading, netMissionEntity, props, freeze, interaction, zone, displayText)
-
CreateClientVehicle function.
This function creates a client sided vehicle.
Parameters:
- src The player's server id.
- id The vehicle's id.
- modelHash The vehicle's model hash.
- x The vehicle's x coordinate.
- y The vehicle's y coordinate.
- z The vehicle's z coordinate.
- heading The vehicle's heading.
- netMissionEntity The vehicle's net mission entity.
- props The vehicle's properties.
- freeze The vehicle's freeze state.
- interaction The vehicle's interaction.
- zone The vehicle's zone.
- displayText The vehicle's display text.
Returns:
-
number
See also:
Usage:
local vehicleId = exports.jones_util:CreateClientVehicle(1, "vehicle", "adder", 0, 0, 0, 0, false, false, false, false, false, false)
- FreezeVehicle (id, boolean)
-
FreezeVehicle function.
This function freezes a vehicle server side.
Parameters:
- id The vehicle's id.
- boolean The vehicle's freeze state.
Usage:
exports.jones_util:FreezeVehicle(1, true)
- FreezeClientVehicle (src, id, boolean)
-
FreezeClientVehicle function.
This function freezes a vehicle client side.
Parameters:
- src The player's server id.
- id The vehicle's id.
- boolean The vehicle's freeze state.
Usage:
exports.jones_util:FreezeClientVehicle(1, 1, true)
- DeleteVehicle (id)
-
DeleteVehicle function.
This function deletes a vehicle server side.
Parameters:
- id The vehicle's id.
Usage:
exports.jones_util:DeleteVehicle(1)
- DeleteClientVehicle (src, id)
-
DeleteClientVehicle function.
This function deletes a vehicle client side.
Parameters:
- src The player's server id.
- id The vehicle's id.
Usage:
exports.jones_util:DeleteClientVehicle(1, 1)
- CategoriseCars (carList)
-
CategoriseCars function.
This function categorises cars.
Parameters:
- carList The car list.
Returns:
-
table
See also:
Usage:
local cars = exports.jones_util:CategoriseCars({ ["adder"] = { category = "sports", shop = "car", type = "car", model = "adder", price = 100000 } })
- ChooseRandomCar (vehicles, category)
-
ChooseRandomCar function.
This function chooses a random car from a category.
Parameters:
- vehicles The car list.
- category The car's category.
Returns:
-
string
Usage:
local car = exports.jones_util:ChooseRandomCar(cars, "sports")
- ChooseRandomCategory (cars)
-
ChooseRandomCategory function.
This function chooses a random category from a car list.
Parameters:
- cars The car list.
Returns:
-
string
Usage:
local category = exports.jones_util:ChooseRandomCategory(cars)
- GetVehiclesFromShop (vehicles, shops, types)
-
GetVehiclesFromShop function.
This function gets vehicles from a shop.
Parameters:
- vehicles The car list.
- shops The car's shop.
- types The car's type.
Returns:
-
table
Usage:
local cars = exports.jones_util:GetVehiclesFromShop(cars, "PDM", "car")
- GeneratePlate (length)
-
GeneratePlate function.
This function generates a random plate.
Parameters:
- length The plate's length.
Returns:
-
string
Usage:
local plate = exports.jones_util:GeneratePlate()
- IsSpawnAreaClear (src, coords)
-
IsSpawnAreaClear function.
This function checks if the spawn area is clear.
Parameters:
- src The player's server id.
- coords The spawn area's coordinates.
Returns:
-
boolean
Usage:
local isClear = exports.jones_util:IsSpawnAreaClear(1, {x = 0, y = 0, z = 0})
- DeleteAllVehicles ()
-
DeleteAllVehicles function.
This function deletes all vehicles.
Usage:
exports.jones_util:DeleteAllVehicles()
Tables
- Interaction
-
Interaction Table.
This table contains all the interactions in the zone or circle. This table needs to have a key for each interaction id.
Fields:
- name The interaction's name
- icon The interaction's icon
- id The interaction's id
- condition The interaction's condition function
Usage:
local interactions = { ["interaction_id"] = { name = "Interaction Name", icon = "fa-regular fa-icon", id = "interaction_id", condition = function(src) return true end } }
- CarList
-
CarList Table.
This table contains all the cars in the server.
Fields:
- category The car's category.
- shop The car's shop.
- type The car's type.
- model The car's model.