> For the complete documentation index, see [llms.txt](https://rickys-organization-6.gitbook.io/hwc-documentions/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rickys-organization-6.gitbook.io/hwc-documentions/hwc-admin-give-car.md).

# HWC Admin Give Car

## 🚗 HWC Admin Give Car

#### Advanced Admin Vehicle Management System

A powerful, optimized admin tool designed for **QBCore servers** to give vehicles instantly, securely, and efficiently — whether directly into garages or spawned live with keys.

***

### 📦 Installation Guide

Follow these steps to get **HWC Admin Give Car** running on your server:

#### 1. 📁 Add Resource

Place the folder into your resources directory:

```
resources/[standalone]/hwc_admin_givecar
```

***

#### 2. ⚙️ Add to server.cfg

Ensure the resource starts **after qb-core and dependencies**:

```
ensure qb-core
ensure oxmysql
ensure qb-vehiclekeys
ensure hwc_admin_givecar
```

***

#### 3. 🔧 Configure Script

Open:

```
hwc_admin_givecar/config.lua
```

Update key settings:

```
Config.AdminPermission = "admin"          -- Required QBCore permission
Config.DefaultGarage = "pillboxgarage"   -- Default garage
Config.SpawnDistance = 4.0               -- Spawn distance in front of player
Config.MaxPlateLength = 8                -- Plate length limit
Config.UseDiscordLogging = true          -- Enable Discord logs
Config.WebhookURL = ""                   -- Add your webhook here
Config.UsePlateCache = true              -- High performance mode (recommended)
Config.Debug = false                     -- Disable in production
```

***

#### 4. 🗄️ Database

No setup required ✅

This script uses:

```
player_vehicles
```

from standard **QBCore**

***

#### 5. 🔑 Permissions Setup

Make sure your admins have the correct QBCore permission:

Example (server-side or admin system):

```
Config.AdminPermission = "admin"
```

Only players with this permission can use commands.

***

### 📋 Commands

#### `/givecar`

Adds a vehicle directly to a player's garage.

```
/givecar [id] [model] [plate] [color]
```

***

#### `/givecarspawn`

Spawns the vehicle in front of the player with keys.

```
/givecarspawn [id] [model] [plate] [color]
```

***

#### 💡 Examples

```
/givecarspawn 1 panto
```

→ Random plate, default color

```
/givecarspawn 1 panto MYCAR
```

→ Custom plate

```
/givecarspawn 1 panto pink
```

→ Pink vehicle, auto plate

```
/givecar 1 adder VIP001 black
```

→ Stored in garage with custom plate + color

***

### 🎨 Supported Colors

You can use these directly in commands:

```
black, white, red, blue, lightblue,
yellow, orange, pink, purple
```

***

### ⚡ How It Works

#### 🚀 Performance Optimisation

* Loads all vehicle plates into memory on startup
* Zero database spam during usage
* Handles large servers (100k+ vehicles)

***

#### 🧠 Smart Input System

* Detects if input is a **plate or color automatically**
* Formats plates to **GTA standard (8 chars, uppercase)**

***

#### 🔑 Key System

* Automatically gives keys when spawning vehicles
* Uses `qb-vehiclekeys`
* Includes fallback system for reliability

***

#### 🔒 Logging & Security

* Discord webhook logging
* Tracks:
  * Admin
  * Target player
  * Vehicle model
  * Plate

***

### 🧩 Requirements

Make sure you have:

* **qb-core**
* **oxmysql**
* **qb-vehiclekeys**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://rickys-organization-6.gitbook.io/hwc-documentions/hwc-admin-give-car.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
