# Vehicle Rentals

<figure><img src="/files/n89EXQFqPdRkPrUdTds5" alt=""><figcaption></figcaption></figure>

### <mark style="color:blue;">Sql</mark>

There are 2 sql files included, the file named Sql is just the entire qb/qbx-garages sql updated with my additions.The other is the sql that would alter the current database table to include my additions. (just felt to include both for whatever reason).

<div align="center" data-full-width="true"><figure><img src="/files/OoPsx2YM3M3wiKUNcfAP" alt=""><figcaption></figcaption></figure></div>

## <mark style="color:orange;">Ox Inventory</mark>

Add the following in **ox\_inventory > data > items.lua**

```lua
["rental_paper"] = {
	label = "Rental Paper",
	weight = 0,
	stack = false,
	close = true,
	description = 'Proof of rental agreement',
},
```

#### <mark style="color:orange;">Item Images</mark>

* Copy the image/s within kevin-rentals > images
* Paste the image/s in ox\_inventory > web > images

## <mark style="color:red;">QB Inventory</mark>

Add the following to **qb-core > shared > items.lua**

{% code overflow="wrap" %}

```lua
rental_paper                     = { name = 'rental_paper', label = 'Rental Paper', weight = 0, type = 'item', image = 'rental_paper.png', unique = true, useable = true, shouldClose = true, description = 'Proof of rental agreement' },

```

{% endcode %}

## <mark style="color:yellow;">PS Inventory</mark>

If using ps inventory add the following snippet in ps-inventory > js > app.js around line 449

```lua
} else if (itemData.name == "rental_paper") {
    $(".item-info-title").html("<p>" + itemData.label + "</p>");
    $(".item-info-description").html(
        "<p><strong>Owner: </strong><span>" +
        (itemData.info.owner || "Unknown") +
        "</span></p><p><strong>Plate: </strong><span>" +
        (itemData.info.plate || "N/A") +
        "</span></p><p><strong>Vehicle: </strong><span>" +
        (itemData.info.vehicle || "N/A") +
        "</span></p><p><strong>Rental Date: </strong><span>" +
        (itemData.info.date || "N/A") +
        "</span></p><p><strong>Duration: </strong><span>" +
        (itemData.info.duration || "N/A") +
        "</span></p>"
    );
```

#### <mark style="color:red;">Item Images</mark>

* Copy the image/s within kevin-rentals > images
* Paste the images in qb inventory > html > images

***

## Creating new locations

```lua
        -- Example of a rental location created for mechanics
        {
            job = {
                 type = 'mechanic',
                 grade = 1
            },
            blip = {
                use = true,
                sprite = 560,
                color = 83,
                scale = 0.8,
                label = 'LS Mechanic Rentals',
            },
            icon = 'fa-solid fa-tools',
            ped = {
                model = `s_m_y_xmech_01`,
                coords = vector4(420.9, -1632.64, 29.25, 108.42),
                scenario = 'WORLD_HUMAN_CLIPBOARD',
            },
            vehicles = {
                {
                    hash = `towtruck`,
                    rentalCost = 120,
                    minRentalDays = 1,
                    maxRentalDays = 7,
                    fuelLevel = 100.0,
                    image = 'https://r2.fivemanage.com/CikOOzU9PmR8OMM0GvFLL/image/towtruck.png' -- The image of the vehicle
                },
            },
            coords = {
                vector4(419.17, -1629.9, 29.26, 320.22),
                vector4(416.74, -1628.19, 29.26, 319.72),
            }
        },
```

* gang: `array`
  * name: `string` The name of the gang
  * grade: `number` The grade of the gang
* job: `table`
  * type: `string` The type of the job (e.g., 'mechanic')
  * grade: `number` The grade of the job
* blip: `table`
  * use: `boolean` Whether to use the blip (true/false)
  * sprite: `number` The sprite ID for the blip
  * color: `number` The color ID for the blip
  * scale: `number` The scale of the blip
  * label: `number` The label for the blip
* warpPlayer: `boolean` Warps the player into the vehicle
* icon: `string` The icon for the rental location (FontAwesome icon class)
* ped: `table`
  * model: `hash` The model hash for the NPC
  * coords: `vector4` The coordinates and heading for the NPC (vector4)
  * scenario: `string` The scenario the NPC will perform
* vehicles: `table`
  * hash: `hash` The vehicle hash
  * rentalCost: `number` The price of the vehicle rental
  * minRentalDays: `number` The minimum rental days
  * maxRentalDays: `number` The maximum rental days
  * fuelLevel: `number` The fuel level of the vehicle
  * image: `string` The image URL of the vehicle
* coords: `table` List of coordinates for vehicle spawn points (vector4)

## Exports

Checks if a vehicle is a rental vehicle and returns a boolean

<pre class="language-lua"><code class="lang-lua"><strong>exports['kevin-rentals']:isRentalVehicle(plate, hash)
</strong></code></pre>

### Useage

```lua
-- Export Useage [client/server]
local isRental = exports['kevin-rentals']:isRentalVehicle('45IRT635', `75131841`)
if isRental then
    print('This vehicle is a rental and cant be sold')
    return
end
```


---

# Agent Instructions: 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:

```
GET https://kevingirardx.gitbook.io/kevin-scripts/vehicle-rentals.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
