# INSTALLATION

## 1. **DOWNLOAD**

The first step is to download the product we have just purchased. To do this we will go to our [KEYMASTER](https://keymaster.fivem.net/asset-grants) account and search for **"Buty-WaterActivities"**.

## 2. DEPENDENCIES AND INSTALLATION

To install it add the resource to your **scripts folder** and put the following in your **SERVER.CFG**:

```lua
ensure Banana_boat
ensure windsurf
ensure Buty-WaterActivities
```

This script brings with it **two voluntary dependencies**, as the dependencies are the vehicles/activities to be rented to the player. Actually you can set the vehicles/activities you want, easily editable in the CONFIG.&#x20;

* **VOLUNTARY free dependency:** [Banana Boat](https://es.gta5-mods.com/vehicles/banana-boat-jet-ski)
* **VOLUNTARY paid dependency:** [Windsurf Boat](https://forum.cfx.re/t/fivem-windsurf-boat-addon-with-template-paid/2434850)

## 3. CONFIG

#### The following will explain all the settings, one of the most important things that I recommend you spend a few minutes to understand in order to offer your users the best possible experience.

{% hint style="info" %}
To make it easier for you to configure, this script comes with several configuration files, each one for one thing. You can see it explained below:
{% endhint %}

{% tabs %}
{% tab title="CONFIG" %}
{% hint style="info" %}
Here you will only have to configure your **framework**, your **database** and some extra settings.
{% endhint %}

{% code lineNumbers="true" %}

```lua
Buty = {}

Configuration = {
    [1] = {framework = "esx", ESXtrigger = 'es_extended', QBtrigger = 'qb-core'}, -- esx or qbcore
    [2] = {UseFuel = false, UseKeys = false}, --Do you use a different system for Fuel? Activate it and put the export in function.lua
    [3] = {BattlePass = false, XP = 100}, --Do you use a BattlePass and want this script to give points? Activate it and add the export in function.lua
}

Activities = {
    {
    --Sets the coordinate where the NPC will appear with the UI
        NPC = {x = -1599.2, y = -1179.0, z = 1.56, h = 263.04},
    --Here the vehicle will spawn
        SpawnVehicle = vector3(-1737.08, -1146.64, 0.44),
    --This is where the vehicle driven by an NPC will go.
        VehicleGo = vector3(-1625.21, -1182.27, -0.23),
    --This is where you can eliminate the vehicle before the time is up.
        DeleteVehicle = {x = -1619.08, y = -1175.36, z = -0.24},
        Returned = {x = -1616.75, y = -1187.27, z = -0.04},
        ReturnedVehicle = vector3(-1628.04, -1167.28, -0.44),
        deleteped = vector3(-1620.0, -1088.28, 4.48),
    --The area where you can use the vehicle. If you leave this area, it will return you to the place you put in the coordinates above.
        zone = {x = -1643.68, y = -1212.68, z = 1.4},
        SizeZone = 200.0,   

    },
}

--------------------------------------------------

Buty.NameBlip = 'Water Activities'

Buty.NPCS = {
    ['home'] = {
        model = 's_m_y_baywatch_01', --npc model (https://docs.fivem.net/docs/game-references/ped-models/)
        anim = 'WORLD_HUMAN_CLIPBOARD' --npc animation (https://wiki.rage.mp/index.php?title=Scenarios)
    },
    ['driver'] = {
        model = 'a_m_y_surfer_01',
    }

}

Buty.Vehicles = {
--If you have all the dependencies correctly installed, leave it as it is. If you have changed any vehicle you will have to put its spawn id here.
    [1] = {
        model = 'seashark', -- vehicle
        price = 1000,       -- price rent
        time = 1800,       -- 30min

    },

    [2] = {
        model = 'seashark3',
        price = 1000,
        time = 1800,
    },

    [3] = {
        model = 'windsurf',
        price = 1000,
        time = 1800,
    },

    [4] = {
        model = 'suntrap',
        price = 1000,
        time = 1800,
    }
}

Buty.Translations = {

    ['language'] = "EN", --You can choose which language the notifications will be in. (EN, ES, FR)

    ['EN'] = {
        [1] = "Press ~b~E~w~ for rent",
        [2] = "Your time is up, the vehicle is being returned automatically.",
        [3] = "You don't have enough money.",
        [4] = "~g~[E]~s~ - Park your vehicle",
        [5] = "You already have a rented vehicle!",
        [6] = "You cannot use it inside a vehicle.",
        [7] = "You've wandered too far, we'll take you back to the area.",

    },

    ['ES'] = {
        [1] = "Pulsa ~b~E~w~ para alquilar",
        [2] = "Tu tiempo se acabo, se esta devolviendo el vehiculo automaticamente.",
        [3] = "No tienes suficiente dinero.",
        [4] = "~g~[E]~s~ - Aparcar vehiculo",
        [5] = "¡Ya tienes un vehiculo alquilado!",
        [6] = "No puedes usar esto dentro de un vehiculo.",
        [7] = "Te has alejado demasido, te estamos llevando de nuevo a la zona.",
    },

    ['FR'] = {      
        [1] = "Appuyez sur ~b~E~w~ pour louer",
        [2] = "Votre temps est écoulé, le véhicule est rendu automatiquement.",
        [3] = "Vous n'avez pas assez d'argent.",
        [4] = "~g~[E]~s~ - Stationnement du véhicule",
        [5] = "Vous avez déjà un véhicule loué!",
        [6] = "Vous ne pouvez pas utiliser ceci à l'intérieur d'un véhicule",
        [7] = "Vous vous êtes aventuré trop loin, nous allons vous ramener dans la zone.",
    },

}
```

{% endcode %}
{% endtab %}

{% tab title="FUNCTION" %}
{% hint style="info" %}
Here are the important functions open. You will be able to set your **Key System**, **Fuel System**, **Blips**...
{% endhint %}

:thumbsup:You will have to know the **EXPORT** of your system (e.g. from your fuel script) and add it, **replacing the existing one**.

*For example if you don't use LegacyFuel and you use BitFuel, then replace `exports["LegacyFuel"]:SetFuel(fuelvehicle, 100)` with your BitFuel export.*

{% code lineNumbers="true" %}

```lua
if Configuration[2].UseKeys == true then
    function keys(vehicle)
        TriggerEvent('cd_garage:AddKeys', exports['cd_garage']:GetPlate(vehicle))
    end
end

if Configuration[2].UseFuel == true then
    function fuel(vehicle)
        exports["LegacyFuel"]:SetFuel(vehicle, 100)
    end
end

function BlipHome()
    for i, v in ipairs(Activities) do
        v.blip = AddBlipForCoord(v.NPC.x, v.NPC.y, v.NPC.z)
        SetBlipSprite(v.blip, 471)
        SetBlipColour(v.blip, 3)
        SetBlipScale(v.blip, 0.7)
        SetBlipAsShortRange(v.blip, true)
        BeginTextCommandSetBlipName("STRING")
        AddTextComponentSubstringPlayerName(Buty.NameBlip)
        EndTextCommandSetBlipName(v.blip)
 
    end
end


-- Client notifications
function SendClientNotification(type, text, time)
    -- time = 10000
    -- if type == 'success' then
    --     exports["Venice-Notification"]:Notify(text, time, "check", options)
    -- elseif type == 'error' then
    --     exports["Venice-Notification"]:Notify(text, time, "error", options)
    -- elseif type == 'info' then
    --     exports["Venice-Notification"]:Notify(text, time, "info", options)
    -- end
    if Configuration[1].framework == 'esx' then

     ESX.ShowNotification(text)

    elseif Configuration[1].framework == 'qbcore' then

     QBCore.Functions.Notify(text)

    end
end

-- Server side notifications
function SendServerNotification(source, type, text, time)
    -- time = 10000
    -- if type == 'success' then
    --     TriggerClientEvent('codem-notification', source, text, time, 'check', options)
    -- elseif type == 'error' then
    --     TriggerClientEvent('codem-notification', source, text, time, 'error', options)
    -- elseif type == 'info' then
    --     TriggerClientEvent('codem-notification', source, text, time, 'info', options)
    -- end

    if Configuration[1].framework == 'esx' then

        TriggerClientEvent('esx:showNotification', source, text)

    elseif Configuration[1].framework == 'qbcore' then

        TriggerClientEvent('QBCore:Notify', source, text)

    end
end

function hintToDisplay(text,coords)
	local dist = Vdist(coords.x,coords.y,coords.z,GetEntityCoords(PlayerPedId(-1)))
    if dist < 1.5 then
        DrawText3Ds(coords.x,coords.y,coords.z + 1.05,text, 0, 0.1, 0.1,255)
    else
        DrawText3Ds(coords.x,coords.y,coords.z + 1.05,text, 0, 0.1, 0.1,100)
    end
end

function DrawText3Ds(x, y, z, text)
	SetTextScale(0.35, 0.35)
    SetTextFont(4)
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 215)
    SetTextEntry("STRING")
    SetTextCentre(true)
    AddTextComponentString(text)
    SetDrawOrigin(x,y,z, 0)
    DrawText(0.0, 0.0)
    ClearDrawOrigin()

end

```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# 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://buty-documentation.gitbook.io/home/guides/rent-water-activities/installation.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.
