> For the complete documentation index, see [llms.txt](https://buty-documentation.gitbook.io/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://buty-documentation.gitbook.io/home/guides/rent-kart-vehicles/installation.md).

# INSTALLATION

Read very well and follow all the steps below. If you find any error or have any doubt open a ticket.

## 1. **DOWNLOAD AND INSTALLATION**

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-KartRent".

With the purchase you will receive two folders, one with the **SCRIPT** and the other with the **ADD-ONS VEHICLES**. Remember that you can put the vehicles that you want.

Do not forget to ensure the vehicles before the script:

```lua
ensure mariokart
ensure racekart
ensure toiletpaperkart
ensure wtfkart
ensure Buty-KartRent
```

## 2. 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" %}
First, make sure you have the vehicles that are added in the configuration.
{% endhint %}

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

{% 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 = -168.606598, y = -2146.457031,z = 16.827881, h = 195.590546},
    --Here the vehicle will spawn
        SpawnVehicle = vector4(-230.637360, -2170.813232, 12.413208, 277.795288),
    --This is where the vehicle driven by an NPC will go.
        VehicleGo = vector3(-165.824173, -2155.964844, 16.692993),
    --This is where you can eliminate the vehicle before the time is up.
        DeleteVehicle = {x = -155.657135, y = -2131.898926, z = 14.792993},

        Returned = {x = -165.824173, y = -2155.964844, z = 16.692993},

        deleteped = vector3(-174.619781, -2136.329590, 19.203613),
    --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 = -95.828568, y = -2095.107666, z =17.198486},

        SizeZone = 200.0,   
    },
}

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

Buty.NameBlip = 'Kart Rental'

Buty.NPCS = {
    ['home'] = {
        model = 'csb_trafficwarden', --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 = 'mp_m_waremech_01',
    }

}

Buty.Vehicles = {

    [1] = {
        model = 'skart', -- vehicle
        price = 1000,       -- price rent
        time = 18,       -- 30min

    },

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

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

    [4] = {
        model = 'vetog',
        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("vehiclekeys:client:SetOwner", vehicle) 
    end
end

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

function Blips()
    for i, v in ipairs(Activities) do
        v.blip = AddBlipForCoord(v.NPC.x, v.NPC.y, v.NPC.z)
        SetBlipSprite(v.blip, 748)
        SetBlipColour(v.blip, 1)
        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 %}
