⛓️Functions

Client

Vehicke Keys Menu

--  all player vehicles
Vehicles.VehickeKeysMenu()

--  Specific plate, 
Vehicles.VehickeKeysMenu('MONO 420', function()
  print('On Close menu or Set/remove key player')
end)

Item Car Keys Client

  • action = 'delete' or 'add' | string

  • plate = vehicle plate | string

  Vehicles.ItemCarKeysClient(action, plate)

Server

Give Item Key

  • source = player source | number

  • action = 'delete' or 'add' | string

  • plate = vehicle plate | string

  Vehicles.ItemCarKeys(source, action, plate)
  -- or ox_inventory export 
  -- add
  exports.ox_inventory:AddItem(source, 'carkey', 1, { plate = plate })
  --remove 
  -- via ox_inventory export 
  exports.ox_inventory:RemoveItem(source, 'carkey', 1, { plate = plate })

Create Vehicle

Vehicles.CreateVehicle(VehicleData, CallBack)

local CreateVehicleData = {
    -- if vehicle temporary | date format 'YYYYMMDD HH:MM'     example '20240422 03:00'   - or false
    temporary = ?, 
     -- string or false, nil ...
    job = ?,
    -- Set vehicle Owner? if Temporary date set true
    setOwner = ?,  
    -- player identifier
    owner = ?,    
    -- same to owner  
    identifier = ?, 

    coords = vector4(1.0, 1.0, 1.0, 1.0),  -- Coords spawn table or vector 4

    -- Vehicle Data
    -- can set your custom props here or use lib.GetVehicleProps() table...
    vehicle = {                            
        model = 'sulta',                  
        plate = Vehicles.GeneratePlate(), 
        fuelLevel = 100,                  
        color1 = [0,0,0],
        color2 = [0,0,0],               
        
    },


Vehicles.CreateVehicle(CreateVehicleData, function(data, action)
   print(json.encode(data, { indent = true} ))
end)
}

Get Vehicle

local Vehicle = Vehicles.GetVehicle(entity) 

Vehicle.SetMetadata(key, value)
-- Example
-- Vehicle.SetMetadata('stolen', { stolenBy = 'Mono Garage'})

Vehicle.DeleteMetadata(key) 
-- Example
-- Vehicle.DeleteMetadata('stolen')

Vehicle.GetMetadata(key)     
-- Example
-- by key Vehicle.GetMetadata('stolen')  or  Vehicles.GetMetadata() return all
-- local metadata = Vehicle.GetMetadata('stolen')
-- print(metadata.stolenBy)   
--- or client/server State 
-- local metadata = Entity(data.entity).state.metadata
-- print(metadata.stolenBy)  

Vehicle.AddKey(source) 
Vehicle.RemoveKey(source)
Vehicle.SaveProps(props)

-- To use in garage script
Vehicle.StoreVehicle(parking, props, license)
Vehicle.RetryVehicle(coords)
Vehicle.ImpoundVehicle(parking, price, note, date)
Vehicle.RetryImpound(ToGarage, coords)

-- Set Fake Plate to vehicle
Vehicle.SetFakePlate('FAKETAXI')
-- To remove 
Vehicle.SetFakePlate(false)

-- Delete DataBase vehicle
Vehicle.DeleteVehicleDB()

Get Vehicle By Plate

  • retunr Vehicles.GetVehicle()

 local Vehicles.GetVehicleByPlate(plate)

Get Vehicle Id

  • retunrvehicle from database

local vehicle = Vehicles.GetVehicleId(id) 

Get Vehicles from Identifier

local AllVechiles = Vehicles.GetAllVehicles(identifier)

Set Vehicle Owner Server

Vehicles.SetVehicleOwner({
    job = ?,
    owner = ?,
    parking = ?,
    plate = ?,
    type = ?,
    vehicle = ?,
})

Set CarOwner Server

Vehicles.SetCarOwner(src)

Vehicles.DelAllVehicles() Server

Vehicles.DelAllVehicles() 

Vehicles.SaveAllVehicles() Server

  • true/false to delete vehicles

Vehicles.SaveAllVehicles(delete)

Vehicles.PlateExist() Server

  • return boolean

Vehicles.PlateExist(plate) 

## Vehicles.GeneratePlate() Server

  • return plate string

Vehicles.GeneratePlate()

Last updated