> For the complete documentation index, see [llms.txt](https://mono-scripts.gitbook.io/mono-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mono-scripts.gitbook.io/mono-docs/mono-documents/mvehicle/functions.md).

# Functions

## **Client**

### **Vehicke Keys Menu**

```lua
--  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

```lua
  Vehicles.ItemCarKeysClient(action, plate)
```

## **Server**

### **Give Item Key**&#x20;

* source = player source | number
* action = 'delete' or 'add' | string
* plate = vehicle plate | string

```lua
  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**&#x20;

```lua
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**

```lua
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()

```lua
 local Vehicles.GetVehicleByPlate(plate)
```

### **Get Vehicle Id**

* retunrvehicle from database

```lua
local vehicle = Vehicles.GetVehicleId(id) 
```

### **Get Vehicles from Identifier**

```lua
local AllVechiles = Vehicles.GetAllVehicles(identifier)
```

### **Set Vehicle Owner** *Server*

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

### **Set CarOwner** *Server*

```lua
Vehicles.SetCarOwner(src)
```

### **Vehicles.DelAllVehicles()** *Server*

```lua
Vehicles.DelAllVehicles() 
```

### **Vehicles.SaveAllVehicles()** *Server*&#x20;

* true/false to delete vehicles

```lua
Vehicles.SaveAllVehicles(delete)
```

### **Vehicles.PlateExist()** *Server*&#x20;

* return boolean

```lua
Vehicles.PlateExist(plate) 
```

### **## Vehicles.GeneratePlate()** *Server*&#x20;

* &#x20;return plate string

```lua
Vehicles.GeneratePlate()
```
