Server
ItemCarKeys
Parameter | Type | Description |
---|---|---|
source | number | |
action | string | 'delete' or 'add' |
plate | string |
- Code
- Example
-- import fxManifext | shared_scripts { '@mVehicle/import.lua' }
Vehicles.ItemCarKeys(source, action, plate)
-- or
exports.mVehicle:ItemCarKeys(source, action, plate)
-- import fxManifext | shared_scripts { '@mVehicle/import.lua' }
Vehicles.ItemCarKeys(1, 'add', 'MONO 420')
-- or
exports.mVehicle:ItemCarKeys(1, 'add', 'MONO 420')
CreateVehicle
Parameter | Type | Description |
---|---|---|
CreateVehicleData | table | Vehicle creation data |
callback | function | Callback function |
- Code
- Example
Vehicles.CreateVehicle(CreateVehicleData, callback)
local CreateVehicleData = {
temporary = false, -- if vehicle temporary | date format 'YYYYMMDD HH:MM' example '20240422 03:00' or false
job = nil, -- string or false, nil ...
setOwner = true, -- Set vehicle Owner? if Temporary date set true
owner = 'char:12asd76asd5asdas', -- player identifier
coords = vector4(1.0, 1.0, 1.0, 1.0), --vector4 or table with xyzw
plate = Vehicles.GeneratePlate(), -- required
model = 'sulta', -- required
vehicle = { -- same ass mods in qbox | set Properties
fuelLevel = 100, -- required
},
}
Vehicles.CreateVehicle(CreateVehicleData, function(data, Vehicle)
-- Set Metadata
Vehicle.SetMetadata('mono', {
smoke = 'seems to be very smoked',
hungry = 'the subject is very hungry'
})
Wait(1000)
-- Get Metadata
local metadata = Vehicle.GetMetadata('mono',)
print(('%s, %s'):format(metadata.smoke, metadata.hungry))
Wait(1000)
-- delete specific Metadata
Vehicle.DeleteMetadata('mono', 'smoke')
Wait(1000)
-- Get new metadata
local metadataNew = Vehicle.GetMetadata('mono')
print(('%s'):format(metadataNew.hungry))
Wait(1000)
-- delete all metadata from 'mono' return nil
Vehicle.DeleteMetadata('mono')
--GarageActions
-- Store/Retry
Vehicle.StoreVehicle('Pillbox Hill')
Vehicle.RetryVehicle(CreateVehicleData.coords)
-- impound | name , price, note, endDate
Vehicle.ImpoundVehicle('Impound Car', 100, 'god bye', '2024/05/2 15:43')
-- Retry Impound and set Garage
Vehicle.RetryImpound('Pillbox Hill')
-- Set multiple Metadata
Vehicle.SetMetadata({
stolen = true,
lastZone = 'Little Seoul'
})
end)
CreateVehicleId
Parameter | Type | Description |
---|---|---|
CreateVehicleData | table | Vehicle creation data |
callback | function | Callback function |
- Code
- Example
Vehicles.CreateVehicleId(CreateVehicleData, callback)
Vehicles.CreateVehicleId({id = 1, coords = vector4(1.0, 1.0, 1.0, 1.0)}, function(data, Vehicle)
print(json.encode(data, { indent = true} ))
-- Set Metadata
Vehicle.SetMetadata('mono', {
smoke = 'seems to be very smoked',
hungry = 'the subject is very hungry'
})
Wait(1000)
-- Get Metadata
local metadata = Vehicle.GetMetadata('mono',)
print(('%s, %s'):format(metadata.smoke, metadata.hungry))
Wait(1000)
-- delete specific Metadata
Vehicle.DeleteMetadata('mono', 'smoke')
Wait(1000)
-- Get new metadata
local metadataNew = Vehicle.GetMetadata('mono')
print(('%s'):format(metadataNew.hungry))
Wait(1000)
-- delete all metadata from 'mono' return nil
Vehicle.DeleteMetadata('mono')
--GarageActions
-- Store/Retry
Vehicle.StoreVehicle('Pillbox Hill')
Vehicle.RetryVehicle(SpawnID.coords)
-- impound | name , price, note, endDate
Vehicle.ImpoundVehicle('Impound Car', 100, 'god bye', '2024/05/2 15:43')
-- Retry Impound and set Garage
Vehicle.RetryImpound('Pillbox Hill')
-- Set multiple Metadata
Vehicle.SetMetadata({
stolen = true,
lastZone = 'Little Seoul'
})
end)
HasKeys
Checks if the player has the keys / also checks if he has access to the vehicle.
Parameter | Type | Description |
---|---|---|
source | numer | |
entity | numer |
- Code
Vehicles.HasKey(source, entity)
AddTemporalVehicle
Sets the entity under mVehicle control, allowing the player to open/close the doors or turn on/off the engine.
Parameter | Type | Description |
---|---|---|
entity | numer |
- Code
Vehicles.AddTemporalVehicle(src,entity)
-- export
exports.mVehicle.AddTemporalVehicle(src, entity)
ControlVehicle
Parameter | Type | Description |
---|---|---|
entity | number |
- Code
Vehicles.ControlVehicle(entity)
DeleteFromTable
Parameter | Type | Description |
---|---|---|
entity | number | |
deleteVehicle? | boolean | Despawn vehicle |
- Deletes the entity from the mVehicles table,
- Code
Vehicles.DeleteFromTable(entity, deleteVehicle)
GetClientProps
Parameter | Type | Description |
---|---|---|
SourceID | number | Source ID |
VehicleNetworkID | number | Vehicle Network ID |
- Code
- Example
local vehicleProps = Vehicles.GetClientProps(SourceID, VehicleNetworkID)
or
local vehicleProps = exports.mVehicle.GetClientProps(SourceID, VehicleNetworkID)
local vehicleProps = Vehicles.GetClientProps(1, 12345)
GetVehicle
Parameter | Type | Description |
---|---|---|
entity | number | Entity ID |
- Code
- Example
local Vehicle = Vehicles.GetVehicle(entity)
local Vehicle = Vehicles.GetVehicle(123)
GetVehicleByPlate
Parameter | Type | Description |
---|---|---|
plate | string | Vehicle plate |
- Code
- Example
local vehicle = Vehicles.GetVehicleByPlate(plate)
local vehicle = Vehicles.GetVehicleByPlate('MONO 420')
GetVehicleId
Parameter | Type | Description |
---|---|---|
id | number | Vehicle ID |
- Code
- Example
local vehicle = Vehicles.GetVehicleByID(id)
local vehicle = Vehicles.GetVehicleByID(1)
GetAllPlayerVehicles
Parameter | Type | Description |
---|---|---|
source | number | Player source |
VehicleTable | boolean | True for vehicles from table, false for DB |
haveKeys | boolean | Check if player has keys |
- Code
- Example
local AllVechiles = Vehicles.GetAllPlayerVehicles(source, VehicleTable, haveKeys)
local AllVechiles = Vehicles.GetAllPlayerVehicles(1, true, true) -- return table with all vehicles
SetVehicleOwner
Parameter | Type | Description |
---|---|---|
data | table | Vehicle owner data |
- Code
- Example
Vehicles.SetVehicleOwner(table)
Vehicles.SetVehicleOwner({
job = 'police',
owner = 'char:12345',
parking = 'Pillbox Hill',
plate = 'MONO 420',
type = 'car',
vehicle = {model = 'sultan', color = 'red'},
})
SetCurrentVehicleOwner
Parameter | Type | Description |
---|---|---|
source | number | Source ID |
- Code
Vehicles.SetCurrentVehicleOwner(source)
SaveAllVehicles
Parameter | Type | Description |
---|---|---|
delete | boolean | True to delete vehicles |
- Code
Vehicles.SaveAllVehicles(delete)
PlateExist
Parameter | Type | Description |
---|---|---|
plate | string | Vehicle plate |
- Code
return Vehicles.PlateExist(plate)
GeneratePlate
- Code
return Vehicles.GeneratePlate()
SpawnVehicles
- Code
return Vehicles.SpawnVehicles() -- SpawnAllVehicles with coords
DelAllVehicles
- Code
Vehicles.DelAllVehicles()
Vehicles.save
- Code
local save = Vehicles.save() -- true|false
GetVehicleCount
- Code
local count = Vehicles.GetVehicleCount() -- return cound vehicle spawned by mVehicle