# Player Owned Yachts

## Introduction

This script adds the ability for your players to have the chance to buy their very own private yacht

{% hint style="danger" %}
**This script is written to work with** [**QBCore**](https://qbcore-framework.github.io/qb-docs/) **and** [**ESX Legacy**](https://github.com/zaphosting/esx_12)

**This resource requires** [**ox\_lib**](https://github.com/overextended/ox_lib) **and** [**cfx-gabz-yachts**](https://github.com/overextended/ox_lib)
{% endhint %}

#### Features of Player Owned Yachts:

* Ability to Change The Livery on Yacht.
* Ability to Change the Light Color on the Yacht.
* Ability for Players to share keys with friends .
* Ability for Players to Sell their yacht to a friend.
* Each Yacht has a boat and helicopter garage (this simply saves and retrieves the vehicle stored)
* Each Yacht has its own outfit section for players to change outfits (requires supported clothing resource).
* Each Yacht has its own storage space which can be configured in config (requires supported inventory resource).

{% hint style="info" %}
**This is compatible with the following inventory systems:**

* [qb-inventory](https://github.com/qbcore-framework/qb-inventory/)
* [lj-inventory](https://github.com/loljoshie/lj-inventory)
* [ox\_inventory](https://github.com/overextended/ox_inventory)
* [chezza-inventory](https://forum.cfx.re/t/paid-release-chezzas-inventory-esx/2040417)
  {% endhint %}

{% hint style="info" %}
**This is compatible with the following clothing systems:**

* [rcore\_clothes](https://store.rcore.cz/package/4337820)
* [illenium\_appearance](https://github.com/iLLeniumStudios/illenium-appearance)
* [qb-clothing](https://github.com/qbcore-framework/qb-clothing)
  {% endhint %}

***

## Installation

You must have cfx-gabz-yachts resource already purchased and installed

{% hint style="warning" %}
You must edit the client.lua inside the cfx-gabz-yachts resource folder, enabling all yachts by changing all yachts from enabled = false to enabled = true.
{% endhint %}

* Download the power\_yachts from Keymaster
* Run the .sql file in your database.
* Add the files to your resources folder
* Ensure that the resource file will start (either ensure your resource in the server.cfg or inside a folder which is started on server start)
* Edit the config file to your needs
* Restart your server

***

## Configuration

Select the tab below for your framework to see the configuration options available.

{% tabs %}
{% tab title="Basic configuration options" %}

```lua
-- QBCore Support 
enableQBCore = true

-- ESX Support
enableESX = false

-- Purchase Price of Yacht
purchasePrice = 5000000

-- Target Support 
-- Supported Resources: ox_target, qb-target
enableTarget = true

-- Resource Used for Inventories
-- Supported Resources: ox_inventory, qb-inventory, qs-inventory, chezza-inventory
inventoryResource = 'qb-inventory'

-- Max Storage In The Yacht Stash
storageAmount = 1000000

-- config to toggleProps for Renewed-Weaponscarry on enter and exit.
renewedWeapons = false

-- Enable Yacht Bartender
enableBartender = true
-- The list of items the bartender will sell
bartenderInventory = {
 {name = 'Bottle Of Beer', item = 'beer', price = 10},
}

-- Resource Used for Clothing
-- Supported Resources: rcore_clothes, illenium_appearance, qb-clothing
clothingResource = 'illenium_appearance'

-- How many days should the yacht be left before it is removed if no one has entered it?
-- Example if set to 14, the yacht will be removed if no one has entered it in 14 days
enableExpiry = true
expireDays = 14

-- This enables support for JG-Garages (not working atm)
useJGGarages = false

-- Enable JG-TextUI for Garages
useJGTextUI = true
```

{% endtab %}

{% tab title="Language" %}
In this section, you can edit the language if you need to translate to another language or edit the wording.

```lua
-- Language Settings
Lang = {
 ['enter_yacht'] = 'Press ~g~E~w~ To Enter Yacht\nPress ~g~H~w~ To Invite In Friends',
 ['heli_garage'] = 'Press ~g~E~w~ To Access Garage\nPress ~g~G~w~ To Store Helicopter',
 ['boat_garage'] = 'Press ~g~E~w~ To Access Garage\nPress ~g~G~w~ To Store Boat',
 ['exit_yacht'] = 'Press ~g~E~w~ To Exit Yacht',
 ['storage'] = '~w~Press ~g~E~w~ To Access Storage',
 ['management'] = '~w~Press ~g~E ~w~To Manage Yacht',
 ['clothing'] = '~w~Press ~g~E~w~ To Access Clothing',
 ['bartender'] = '~w~Press ~g~E~w~ To Access Bar',
 ['jg_garage_load'] = '[E] Open Garage',
 ['jg_garage_store'] = '[E] Store Vehicle',
}
```

{% endtab %}
{% endtabs %}

***

## Editable files

### functions.lua

#### Inventory Compatibility

If you would like to edit the inventory functions, you can edit them in the functions.lua file. Default functions are as follows:

```lua
function openStorage(stashId)
 if inventoryResource == 'ox_inventory' then 
  exports.ox_inventory:openInventory('stash', {id = stashId, owner = false})
 end 

 if inventoryResource == 'chezza-inventory' then 
  TriggerEvent('inventory:openStorage', "Stash", stashId, storageAmount, 1000)
 end 

 if inventoryResource == 'quasar-inventory' then 
  local other = {}
  other.maxweight = storageAmount
  other.slots = 50 
  TriggerServerEvent("inventory:server:OpenInventory", "stash", stashId, other)
  TriggerEvent("inventory:client:SetCurrentStash", stashId)
 end

 if inventoryResource == 'qb-inventory' then 
  TriggerServerEvent("inventory:server:OpenInventory", "stash", stashId, {maxweight = storageAmount, slots = 250})
  TriggerEvent("inventory:client:SetCurrentStash", stashId)
 end
end
```

#### Clothing compatibility

If you would like to edit the clothing functions, you can edit them in the functions.lua file. Default functions are as follows:

```lua
function openClothingOutfits()
 if clothingResource == 'rcore_clothes' then
  TriggerEvent("rcore_clothes:openOutfits") 
 end

 if clothingResource == 'illenium_appearance' then
  TriggerEvent('illenium-appearance:client:openOutfitMenu')
 end
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://docs.power-scripts.com/yachts.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.
