> 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/infinite-activities/installation.md).

# INSTALLATION

{% hint style="warning" %}
FOR THIS SCRIPT YOU MUST HAVE THE **MINIMUM VERSION OF THE GAME** IN: `2545`

*If you use a previous one it will not work for you.*

`+set sv_enforceGameBuild 2545`

*If you have a later one, no problem.*
{% endhint %}

## 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-Activities"**.

## 2. DEPENDENCIES AND INSTALLATION

This **SCRIPT only has one dependency**, which is a small **shopping cart add-on**, which is used in one of the missions.&#x20;

The creator of this prop is [bzzz.tebex.io](https://bzzz.tebex.io/), a magnificent modeler. Download it here or on their website:

{% file src="/files/tt7DNl9H4YmOxsRWjhhV" %}

It has to be ensured above the script, like this:

```lua
ensure bzzz_basket
ensure Buty-Activities
```

<mark style="color:red;">**You must install the SQL that comes in the script, so that everything works correctly.**</mark>&#x20;

These database entries are not used by the MAIN SCRIPT, they are used by the LEADERBOARD and Daily Mission System.

```sql
CREATE TABLE `leaderboard` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`identifier` LONGTEXT NOT NULL COLLATE 'utf8mb4_general_ci',
	`points` INT(11) NULL DEFAULT NULL,
	`missions` LONGTEXT NOT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `leaderboard_timer` (
	`weeklytimer` INT(11) NULL DEFAULT NULL,
	`dailytimer` INT(11) NULL DEFAULT NULL
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `daily_missions` (
	`id` INT(11) NOT NULL AUTO_INCREMENT,
	`name` LONGTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`amount` INT(11) NULL DEFAULT NULL,
	`prize` INT(11) NULL DEFAULT NULL,
	`claimed` LONGTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;
```

## 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 experien

{% tabs %}
{% tab title="CONFIG" %}

````lua
Configuration = {
    FrameWork = "esx", -- esx | qbcore
    
    CoreFolderName = "", 

    SQLWrapper = "oxmysql", -- oxmysql, mysql-async or ghmattisql

    UseTarget = true, TargetName = "qtarget", -- Put the name of your target here

    DailyLimit = {true, 24}, ResetTime = 16, -- In case you want to limit the profits. The first number is the daily limit and the second number is the reset time

    Marker = { -- In case you want a question mark to appear in the heads of the NPCs with a mission
        UseMarker = true, 
        Type = 32,
        Color = {106, 3, 247}
    },

    Blip = { -- In case you want the missions to appear marked on the map
        UseBlip = true,
        Name = "Mystery Person",
        Type = 280,
        Color = 57,
    },

    ScenarioAnim = { -- These are the animations that NPCs will do when they are waiting for you
        {"anim@amb@waving@female", "air_wave"},
        {"anim@amb@waving@male","ground_wave"},
        {"amb@world_human_hang_out_street@female_arms_crossed@base","base"},
        {"anim@amb@nightclub@peds@","rcmme_amanda1_stand_loop_cop"},
        {"mini@hookers_spvanilla","idle_reject_loop_a"},
        {"amb@world_human_hang_out_street@male_b@idle_a","friends@fra@ig_1"},
        {"mp_move@prostitute@m@french","idle"},
        {"anim@mp_celebration@idles@female","celebration_idle_f_a"},
        {"anim@mp_corona_idles@male_d@idle_a","idle_a"},
        {"amb@world_human_hang_out_street@female_hold_arm@idle_a","idle_a"},
        {"random@drunk_driver_1","drunk_driver_stand_loop_dd2"},
        {"amb@world_human_hang_out_street@Female_arm_side@idle_a","idle_a"},
        {"rcmjosh1","idle"},
        {"timetable@amanda@ig_3","ig_3_base_tracy"},
        {"anim@mp_player_intcelebrationfemale@knuckle_crunch","knuckle_crunch"},
        {"move_p_m_two_idles@generic","fidget_sniff_fingers"},
        {"anim@miss@low@fin@vagos@","idle_ped06"},
        {"misscarsteal4@aliens","rehearsal_base_idle_director"},
    },

    EndAnim = { 

        completed = { -- These are the animations that NPCs will do when you complete a mission
            {"anim@mp_player_intupperslow_clap","idle_a"},
            {"anim@arena@celeb@flat@solo@no_props@","angry_clap_a_player_a"},
            {"anim@mp_player_intcelebrationmale@slow_clap","slow_clap"},
            {"anim@mp_player_intselfieblow_kiss","exit"},
            {"anim@mp_player_intselfiedock","idle_a"},
            {"mp_action","thanks_male_06"},
            {"anim@mp_player_intselfiethumbs_up","idle_a"},
            {"anim@amb@nightclub@mini@dance@dance_solo@female@var_a@","high_center_up"},
            {"misschinese2_crystalmazemcs1_ig","dance_loop_tao"},
            {"anim@mp_player_intupperraining_cash","idle_a"},
            {"anim@mp_player_intcelebrationpaired@f_f_sarcastic","sarcastic_left"},
            {"anim@mp_player_intincarsalutestd@ps@","idle_a"},
            {"anim@mp_player_intcelebrationmale@thumbs_up","thumbs_up"},  
            {"anim@mp_player_intcelebrationmale@freakout","freakout"},
            {"anim@mp_player_intupperair_shagging", "idle_a"},   
            {"anim@mp_player_intselfieblow_kiss", "exit"},
            {"amb@world_human_cheering@male_a", "base"}, 
        },

        notcompleted = { -- These are the animations that NPCs will do when you cancel a mission
            {"misscarsteal4@actor","stumble"},
            {"mp_player_int_upperfinger","mp_player_int_finger_01_enter"},
            {"mp_player_intfinger","mp_player_int_finger"},
            {"anim@mp_player_intupperfinger","idle_a_fp"},
            {"anim@arena@celeb@podium@no_prop@","flip_off_a_1st"},
            {"anim@arena@celeb@podium@no_prop@","flip_off_c_1st"},
            {"gestures@m@standing@casual","gesture_damn"},
            {"anim@am_hold_up@male","shoplift_mid"},
            {"anim@mp_player_intcelebrationfemale@face_palm","face_palm"},
            {"random@car_thief@agitated@idle_a","agitated_idle_a"},
            {"missminuteman_1ig_2","tasered_2"},
            {"anim@mp_player_intupperface_palm","idle_a"},
            {"mp_suicide","pistol"},
            {"mp_suicide","pill"},
            {"anim@gangops@hostage@","victim_fail"},
            {"anim@heists@ornate_bank@chat_manager","fail"},
            {"mp_player_int_upper_nod","mp_player_int_nod_no"},
            {"gestures@m@standing@casual","gesture_no_way"},  
            {"misscommon@response","screw_you"},
            {"gestures@f@standing@casual","gesture_shrug_hard"},
            {"anim@mp_player_intcelebrationfemale@face_palm", "face_palm"},
            {"random@car_thief@agitated@idle_a", "agitated_idle_a"},
        },

    }
}

Webhooks = { -- If you want there to be LOGs of important information on Discord, fill out the following

    Active = false,

    Config = {
        Webhook = "https://discord.com/api/webhooks/1141399499349180477/7Qx-SVp5kB-Qxv7GfCkwIMIL9WymMuhHcnmeWD5DsAciLESR701gw7djI7RRLN0Pqpw4",
        Color = 65280,
    },

    Text = {
        DailyLimit = "**> Player Information** " .. "\n" .. "** Player Name:** {name} " .."\n" .. "\n" .. "**◽ Player Identifier:** {identifier}" .. "\n" .. "\n" .. "**# [DAILY LIMIT]**" .. "\n" .. "\n" .. "❌I can't do any more activities for today**" .. "\n" .. "\n" .. "⏰ **May work in: ** {TotalTime}",
    
        GetMoney = "**# Player Name:** ```{name}``` " .. "\n" .. "**# Player Identifier:** ```{identifier}```" .. "\n" .. "**# INFO:** ```Helped a person and got {money}$ 💰 ```",
    
        GetItem = "**# Player Name:** ```{name}``` " .. "\n" .. "**# Player Identifier:** ```{identifier}```" .. "\n" .. "**# INFO:** ```Helped a person and got x{money} {nameitem} 📦```",
    },
}

Payments = { -- Each mission has a difficulty, you can put what you pay on each difficulty. You can also change the difficulty of each mission in the ACTIVITIES folder
    EASY = {180, 350},
    MEDIUM = {350, 490},
    HARD = {490, 620},
    ILLEGAL = {490, 620},
}

Activities = {animation, buying, delivery, npc_interaction, prop, talk, transport, illegal}

````

{% endtab %}

{% tab title="CONFIG\_LEADERBOARD" %}
This script has a **Leaderboard and a Daily Missions System (Trophies**) that complements the entire system.

Here you can configure everything about it:

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

```lua
Config = {}

Config.Refresh = {
    LeaderboardTimer = 7, -- In days. Every time the LeaderBoard is restarted
    DailyMissionsTimer = { hours = 0, minutes = 20 }, -- In minutes. Every time the Daily Missions is restarted
    Prize = { ['1'] = 20000, ['2'] = 10000, ['3'] = 5000 } -- These are the prizes given to the firsts on the Leaderboard
}

Config.NPC = { -- The NPC that will open the Leaderboard UI and Daily Missions UI
    Position = vector4(-257.261536, -972.685730, 30.217529, 252.283463),
    Model = 'u_m_m_jesus_01'
}

Config.DailyMissionsMax = 3 -- The missions that will appear to each player each day

Config.DailyMissions = { -- These are all the missions that can come out. From here it will choose the number you put above

    {
        Name = 'help', -- Do not touch!
        Label = 'Help <span>%s</span> people',
        MinMax = { 2, 10 }, -- You will get a number between these two. For example Help "2" people
        Prize = { 1000, 2000 } -- The prize will be a number between these two
    },

    {
        Name = 'delivery', -- Do not touch!
        Label = 'Do <span>%s</span> delivery missions',
        MinMax = { 2, 10 },
        Prize = { 1000, 2000 }
    },

    {
        Name = 'pickup', -- Do not touch!
        Label = 'Pick up <span>%s</span> people',
        MinMax = { 2, 10 },
        Prize = { 1000, 2000 }
    },

    {
        Name = 'sport', -- Do not touch!
        Label = 'Do sports <span>%s</span> times',
        MinMax = { 2, 10 },
        Prize = { 1000, 2000 }
    },

    {
        Name = 'shopping', -- Do not touch!
        Label = 'Go shopping <span>%s</span> times',
        MinMax = { 2, 10 },
        Prize = { 1000, 2000 }
    },

    {
        Name = 'talk', -- Do not touch!
        Label = 'Talk to <span>%s</span> people',
        MinMax = { 2, 10 },
        Prize = { 1000, 2000 }
    }

}

Config.Translation = {

    OpenMenu = 'Press ~INPUT_CONTEXT~ to talk to Jesus'

}

```

{% endtab %}

{% tab title="CLIENT - OPEN" %}

{% hint style="danger" %}
It is recommended that many of the modifications to the **OPENFUNCTION** files be made by a programmer with LUA and FiveM ideas.
{% endhint %}

<pre class="language-lua"><code class="lang-lua"><strong>Pay = function(buty, money)
</strong>    trigger('buty:pay', function(money)
        Notify("success", notify.pay .. money, time, "client")
    end, buty, money)
end

AddKeys = function(veh)
    local plate = GetVehicleNumberPlateText(veh)
    TriggerEvent("vehiclekeys:client:SetOwner", plate) 
end

RemoveVehicle = function(veh)
    DeleteVehicle(veh) 
end

Notify = function(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.FrameWork == 'esx' then 
    
        ESX.ShowNotification(text)

    else
        QBCore.Functions.Notify(text)
    end
end

hintToDisplay = function(text,coords)
	local dist = Vdist(coords.x,coords.y,coords.z,GetEntityCoords(PlayerPedId(-1)))
    if dist &#x3C; 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

DrawText3Ds = function (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

RegisterNetEvent("buty:polblip")
AddEventHandler("buty:polblip", function(coord)
    local Blip = AddBlipForRadius(coord.x, coord.y, coord.z, 50.0)
    SetBlipHighDetail(Blip, true)
    SetBlipColour(Blip, 1)
    SetBlipAlpha(Blip, 128)
    Citizen.Wait(25000)
    RemoveBlip(Blip)
end)


setblip = function(name, coords,blipnames)
    if name == "help" then
        help = AddBlipForCoord(coords[1], coords[2], coords[3])
        SetBlipSprite(help, 1)
        SetBlipColour(help, 50)
        SetBlipScale(help, 0.4)
        SetBlipAsShortRange(help, true)
        BeginTextCommandSetBlipName("STRING")
        AddTextComponentSubstringPlayerName(blipnames)
        EndTextCommandSetBlipName(help)
        SetBlipRoute(help, true)
        SetBlipRouteColour(help,29)
    elseif name == "ends" then
        ends = AddBlipForCoord(coords[1], coords[2], coords[3])
        SetBlipSprite(ends, 1)
        SetBlipColour(ends, 50)
        SetBlipScale(ends, 0.4)
        SetBlipAsShortRange(ends, true)
        BeginTextCommandSetBlipName("STRING")
        AddTextComponentSubstringPlayerName(name)
        EndTextCommandSetBlipName(ends)
        SetBlipRoute(ends, true)
        SetBlipRouteColour(ends,29)
    elseif name == "ActionBlip" then
        for k,b in ipairs(coords) do
            b.ActionBlip = AddBlipForCoord(b.Spawn_Coord)
            SetBlipSprite(b.ActionBlip, 306)
            SetBlipColour(b.ActionBlip, 5)
            SetBlipScale(b.ActionBlip, 0.8)
            SetBlipAsShortRange(b.ActionBlip, true)
            BeginTextCommandSetBlipName("STRING")
            AddTextComponentSubstringPlayerName(b.blipname)
            EndTextCommandSetBlipName(b.ActionBlip)
            SetBlipRoute(b.ActionBlip, true)
            SetBlipRouteColour(b.ActionBlip,5)
        end
    elseif name == "ActionBlip2" then
        for k,x in ipairs(coords) do
            x.ActionBlip = AddBlipForCoord(x.Coord)
            SetBlipSprite(x.ActionBlip, 306)
            SetBlipColour(x.ActionBlip, 5)
            SetBlipScale(x.ActionBlip, 0.8)
            SetBlipAsShortRange(x.ActionBlip, true)
            BeginTextCommandSetBlipName("STRING")
            AddTextComponentSubstringPlayerName(blipnames)
            EndTextCommandSetBlipName(x.ActionBlip)
            SetBlipRoute(x.ActionBlip, true)
            SetBlipRouteColour(x.ActionBlip,5)
        end
    elseif name == "shop" then
        shop = AddBlipForCoord(coords[1], coords[2], coords[3])
        SetBlipSprite(shop, 272)
        SetBlipColour(shop, 50)
        SetBlipScale(shop, 1.2)
        SetBlipAsShortRange(shop, true)
        BeginTextCommandSetBlipName("STRING")
        AddTextComponentSubstringPlayerName(name)
        EndTextCommandSetBlipName(shop)
        SetBlipRoute(shop, true)
        SetBlipRouteColour(shop,29)
    end
end
</code></pre>

{% endtab %}

{% tab title="SERVER - OPEN" %}

```lua
RegisterServerEvent("buty:policecall")
AddEventHandler("buty:policecall", function(jobs)
    local source = source
    local isESX = Configuration.FrameWork == 'esx'
    local ubi = GetEntityCoords(GetPlayerPed(source))

    for _, playerId in ipairs(GetPlayers()) do
        local player = isESX and ESX.GetPlayerFromId(playerId) or QBCore.Functions.GetPlayer(playerId)
        
        if player and IsPlayerInPoliceJob(player, jobs) then
            TriggerClientEvent('buty:notify',playerId,"info", "They have called the police and they are on their way.", time)
            TriggerClientEvent('buty:polblip', playerId, ubi)
        end
    end
end)

```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
**If you want to edit the aesthetics or design. You have the HTML open so you can modify the style and everything as you want.**

The script is **RESPONSIVE** for all resolutions as well.
{% endhint %}

## 4. TRANSLATIONS AND MISSION CONFIGURATION

* The SCRIPT has a large amount of text, since each mission tells you a different story and each time a player accesses a mission that story will be different.  **It is in 3 languages: English, Spanish and French, although you can translate it to all the languages ​​you want in this file. There is a TRANSLATES.lua file**

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

* Although there are almost **100 missions with different stories,** there are different **types of missions**, in these files is where you can configure each mission (coordinates and many other options). Likewise, you can create as many missions as you want. **There is an ACTIVITIES folder with all the types and their configurations.**

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