# Accessible files

<details>

<summary>config.lua</summary>

<pre class="language-lua"><code class="lang-lua"><strong>----------------------------------------------------------------------------------------------
</strong>-----------------------------------| BRUTAL GYM SYSTEM :) |-----------------------------------
----------------------------------------------------------------------------------------------

--[[

Hi, thank you for buying our script, We are very grateful!

For help join our Discord server:     https://discord.gg/85u2u5c8q9
More informations about the script:   https://docs.brutalscripts.com

--]]

-- You can add your own notify here >> [gym-cl_utils.lua]

Config = {
    DeveloperMode = false, -- Developer mode (for support)

    Core = 'ESX',  -- ESX / QBCORE  | Other core setting on the 'core' folder
    TextUI = 'brutal_textui', -- false = DrawText3D / 'brutal_textui' / 'ox_lib' / 'okokTextUI' / 'ESXTextUI' / 'QBDrawText' // Custom can be add in the gym-cl_utils.lua!!!
    ProgressBar = '', -- 'progressBars' / 'pogressBar' / 'mythic_progbar' // Custom can be add in the gym-cl_utils.lua!!!
    BrutalNotify = true, -- Buy here: (4€+VAT) https://store.brutalscripts.com | Or set up your own notify >> gym-cl_utils.lua
    MINIGAME = false,  -- Download here: https://github.com/firestix77/taskbarskill   (You can edit in the [gym-cl_utils.lua])
    GYMDistance = 60,  -- This is the distance from which membership is broken
    PressKey = 38,  -- If you want to change: https://docs.fivem.net/docs/game-references/controls/

    DisableControls = {}, -- These controls will blocked during the exercises
    ShootWeponsBlackList = {'WEAPON_PETROLCAN'},

    GYMResting = {
        Use = false, -- Enable resting between workouts.
        RestDuration = 60, -- Rest duration in seconds. 
    },

    Skills = {
        SkillMenu = {Label = 'Brutal Skill Menu', Command = 'skillmenu', Control = 'DELETE'},  -- SETTINGS > KEYBINDINGS
        SkillNotifyTime = 5000, -- in milisec | 1000 = 1 sec
        SaveFrequency = 5, -- in minutes | Save in the SQL after that time
        RemoveTime = 10,  -- in munites | Remove one skill from player after that time

        SprintSpeedIncrease = 'MEDIUM', -- ('FAST', 'MEDIUM', 'SLOWLY') At what rate should you increase the run speed?
        SwimSpeedIncrease = 'MEDIUM', -- ('FAST', 'MEDIUM', 'SLOWLY') At what rate should you increase the swimming speed?
        StrengthIncrease = 'MEDIUM', -- ('HIGH', 'MEDIUM', 'LOW') At what rate should you increase strength?

        AllowOutsideTraining = false, -- If true, players can earn Stamina and Running points even when not in the gym.

        SkillTypes = {
            -- ⬇️ DO not edit this FIRST element! [You can edit the Skill Name with the Label]
            ['Stamina']  = {Use = true, Label = 'Stamina', Color = 'rgb(24, 191, 238)', Description = 'Affects ability to sprint, cycle and swim, Max stamina is unlimited stamina.'},
            ['Running']  = {Use = true, Label = 'Running', Color = 'rgb(24, 237, 148)', Description = 'Increases running speed. This brings a number of benefits.'},
            ['Driving']  = {Use = true, Label = 'Driving', Color = 'rgb(198, 237, 24)', Description = 'Increase vehicle handling, control wheelies better, increases control of veicle while in the air.'},
            ['Strength'] = {Use = true, Label = 'Strength', Color = 'rgb(237, 24, 24)', Description = 'Increases melee ability, increases speed on ladders/climbing, increases proficiency in sports, reduces demage taken.'},
            ['Swimming'] = {Use = true, Label = 'Swimming', Color = 'rgb(52, 24, 237)', Description = 'Increases the lung capacity, you can stay underwater longer.'},
            ['Shooting'] = {Use = true, Label = 'Shooting', Color = 'rgb(212, 24, 237)', Description = 'Increases accuracy, reduces recoil of guns, increases ammo capacity.'},
        }
    },

    Exersices = {
        -- Only use these [Stamina / Running / Driving / Strength / Swimming / Shooting] to the skill value.
        ['running'] = {label = "Running", anim = "running", time = 30, skill = 'Running'},
        ['pushups'] = {label = "Pushups", anim = "pushups", time = 30, skill = 'Strength'},
        ['situps'] = {label = "Situps", anim = "situps", time = 30, skill = 'Stamina'},
        ['weightlifting'] = {label = "Weightlifting", anim = "world_human_muscle_free_weights", time = 30, skill = 'Strength'},
        ['yoga'] = {label = "Yoga", anim = "world_human_yoga", time = 30, skill = 'Stamina'},
        ['pullup'] = {label = "Pullup", anim = "prop_human_muscle_chin_ups", time = 30, skill = 'Strength'},
        -- You can add more...
    },
    
    Gyms = {
        ['Beach GYM'] = {
            ItemRequired = {Use = false, Item = '', Time = 30, RemoveItem = false},
            Distances = {Marker = 10, Text = 1.0},
            GYMCoords = { x = -1200.3149, y = -1568.4581, z = 4.6123},
            Marker = { Distance = 15, Sprite = 30, Rotation = true, UpAndDown = false, Brightness = 100, r = 240, g = 221, b = 12, sizes = {x = 0.25, y = 0.3, z = 0.3}},  -- More sprites: https://docs.fivem.net/docs/game-references/markers/
            Blip = { Use = true, colour = 33, size = 1.1, sprite = 311 },
            Exersices = {
                [1]  = { type = 'weightlifting', x = -1197.0083, y = -1573.0277, z = 4.6125, heading = 29.5812},
                [2]  = { type = 'weightlifting', x = -1210.0604, y = -1561.3734, z = 4.6080, heading = 76.0602},
                [3]  = { type = 'pullup', x = -1204.6512, y = -1564.4742, z = 4.6096, heading = 36.2476},
                [4]  = { type = 'pullup', x = -1200.1077, y = -1570.9010, z = 4.6097, heading = 216.9520},
                [5]  = { type = 'yoga', x = -1204.6547, y = -1560.7797, z = 4.6143, heading = 35.4453},
                [6]  = { type = 'pushups', x = -1207.3629, y = -1565.8481, z = 4.6080, heading = 125.5502},
                [7]  = { type = 'situps', x = -1202.0811, y = -1567.2975, z = 4.6106,heading =  209.7822},
                -- You can add more...
            }
        },
        
        ['City GYM'] = {
            ItemRequired = {Use = false, Item = 'gym_membership', Time = 15, RemoveItem = true},
            Distances = {Marker = 10, Text = 1.0},
            GYMCoords = { x = -1263.9678, y = -360.9280, z = 36.9944},
            Marker = { Distance = 15, Sprite = 30, Rotation = true, UpAndDown = false, Brightness = 100, r = 260, g = 40, b = 40, sizes = {x = 0.25, y = 0.3, z = 0.3}},  -- More sprites: https://docs.fivem.net/docs/game-references/markers/
            Blip = { Use = true, colour = 1, size = 1.1, sprite = 311 },
            Exersices = {
                [1]  = { type = 'weightlifting', x = -1269.4681, y = -362.2640, z = 36.9837, heading = 114.9331},
                [2]  = { type = 'weightlifting', x = -1267.5681, y = -365.8660, z = 36.9837, heading = 111.7152},
                [3]  = { type = 'pullup', x = -1256.8202, y = -358.4193, z = 36.9595, heading = 115.7973},
                [4]  = { type = 'pullup', x = -1258.6047, y = -355.1523, z = 36.9596, heading = 157.1221},
                [5]  = { type = 'yoga', x = -1270.4337, y = -359.4362, z = 36.9596, heading = 265.9220},
                [6]  = { type = 'pushups', x = -1262.6473, y = -359.7602, z = 36.9948, heading = 118.7721},
                [7]  = { type = 'pushups', x = -1261.6625, y = -361.5224, z = 36.9948, heading = 114.4993},
                [8]  = { type = 'situps', x = -1266.0231, y = -356.7149, z = 36.9596, heading = 208.9295},
                [9]  = { type = 'situps', x = -1263.2084, y = -355.0845, z = 36.9596, heading = 205.2904},
                [10] = { type = 'running', x = -1263.5249, y = -369.5938, z = 37.1113, heading = 213.0987},
                [11] = { type = 'running', x = -1260.6754, y = -368.0751, z = 37.1124, heading = 213.4567},
                [12] = { type = 'running', x = -1257.7607, y = -366.3998, z = 37.1116, heading = 208.1506},
                -- You can add more...
            }
        },

        ['Prison GYM'] = {
            ItemRequired = {Use = false, Item = 'gym_membership', Time = 15, RemoveItem = true},
            Distances = {Marker = 10, Text = 1.0},
            GYMCoords = { x = 1747.8870, y = 2544.0845, z = 43.5854},
            Marker = { Distance = 15, Sprite = 30, Rotation = true, UpAndDown = false, Brightness = 100, r = 260, g = 40, b = 40, sizes = {x = 0.25, y = 0.3, z = 0.3}},  -- More sprites: https://docs.fivem.net/docs/game-references/markers/
            Blip = { Use = false, colour = 1, size = 1.1, sprite = 311 },
            Exersices = {
                [1]  = { type = 'weightlifting', x = 1746.9486, y = 2543.9863, z = 43.5855, heading = 100.8497},
                [2]  = { type = 'weightlifting', x = 1748.1990, y = 2541.6675, z = 43.5855, heading = 111.0449},
                [3]  = { type = 'pushups', x = 1739.7616, y = 2541.2312, z = 43.5855, heading = 206.0246},
                [4]  = { type = 'pushups', x = 1742.0660, y = 2537.2927, z = 43.5855, heading = 32.1690},
                [5]  = { type = 'situps', x = 1751.0808, y = 2536.8789, z = 43.5855, heading = 24.3098},
                [6]  = { type = 'situps', x = 1752.6005, y = 2537.6794, z = 43.5855, heading = 24.3307},
                -- You can add more...
            }
        },

        -- You can add more GYM's...
    },
    

    -----------------------------------------------------------
    -----------------------| TRANSLATE |-----------------------
    -----------------------------------------------------------

    Texts = {
        TextUI = {'[E] - Do some'}, 
        Text3D = {'To~r~', '~w~press ~w~[~g~E~w~]'}, 
    },    

    Notify = {
        [1] = {'Brutal GYM', "You don't have GYM card!", 5000, 'error'},
        [2] = {'Brutal GYM', "The time is up!", 5000, 'warning'},
        [3] = {'Brutal GYM', "You left the GYM!", 5000, 'warning'},
        [4] = {'Brutal GYM', "You can not do this in a vehicle!", 5000, 'error'},
        [5] = {'Brutal GYM', "You need to rest before starting another workout!", 5000, 'warning'},
        [6] = {'Brutal GYM', "You can now exercise again.", 5000, 'info'},
    }
}
</code></pre>

</details>

<details>

<summary>gym-cl_utils.lua</summary>

```lua
ESX = Core
QBCore = Core

-- Buy here: (4€+VAT) https://store.brutalscripts.com
function notification(title, text, time, type)
    if Config.BrutalNotify then
        exports['brutal_notify']:SendAlert(title, text, time, type)
    else
        -- Put here your own notify and set the Config.BrutalNotify to false
        SetNotificationTextEntry("STRING")
        AddTextComponentString(text)
        DrawNotification(0,1)

        -- Default ESX Notify:
        --TriggerEvent('esx:showNotification', text)

        -- Default QB Notify:
        --TriggerEvent('QBCore:Notify', text, 'info', 5000)

        -- OKOK Notify:
        -- exports['okokNotify']:Alert('GYM', text, time, type, false)

    end
end

function AddSkill(Skill)
    -- You can use another skill system, but I think our the best :D, because that is simple and great
    if Config.MINIGAME then
        finished = exports["taskbarskill"]:taskBar(3700, 1)
        if finished == 100 then 
            TriggerEvent('brutal_skills:client:AddSkill', Skill, 1)
        end
    else
        TriggerEvent('brutal_skills:client:AddSkill', Skill, 1)
    end
    -- Trigger name, SKILL_NAME, AMOUNT
end

function TextUIFunction(type, text)
    if type == 'open' then
        if Config.TextUI:lower() == 'ox_lib' then
            lib.showTextUI(text)
        elseif Config.TextUI:lower() == 'okoktextui' then
            exports['okokTextUI']:Open(text, 'darkblue', 'right')
        elseif Config.TextUI:lower() == 'esxtextui' then
            ESX.TextUI(text)
        elseif Config.TextUI:lower() == 'qbdrawtext' then
            exports['qb-core']:DrawText(text,'left')
        elseif Config.TextUI:lower() == 'brutal_textui' then
            exports['brutal_textui']:Open(text, "yellow")
        end
    elseif type == 'hide' then
        if Config.TextUI:lower() == 'ox_lib' then
            lib.hideTextUI()
        elseif Config.TextUI:lower() == 'okoktextui' then
            exports['okokTextUI']:Close()
        elseif Config.TextUI:lower() == 'esxtextui' then
            ESX.HideUI()
        elseif Config.TextUI:lower() == 'qbdrawtext' then
            exports['qb-core']:HideText()
        elseif Config.TextUI:lower() == 'brutal_textui' then
            exports['brutal_textui']:Close()
        end
    end
end

function ProgressBarFunction(time, text)
    if Config.ProgressBar:lower() == 'progressbars' then --LINK: https://github.com/EthanPeacock/progressBars/releases/tag/1.0
        exports['progressBars']:startUI(time, text)
    elseif Config.ProgressBar:lower() == 'mythic_progbar' then -- LINK: https://github.com/HarryElSuzio/mythic_progbar
        TriggerEvent("mythic_progbar:client:progress", {name = "policejobduty", duration = time, label = text, useWhileDead = false, canCancel = false})
    elseif Config.ProgressBar:lower() == 'pogressbar' then -- LINK: https://github.com/SWRP-PUBLIC/pogressBar
        exports['pogressBar']:drawBar(time, text)
    end
end

function DrawText3D(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)
    local factor = (string.len(text)) / 370
    DrawRect(0.0, 0.0+0.0125, 0.025+ factor, 0.03, 0, 0, 0, 75)
    ClearDrawOrigin()
end


--[[
    Exercise Play trigger: TriggerEvent('brutal_skills:client:PlayExercise', exercise, heading)
]]
```

</details>

<details>

<summary>skills-cl_utils.lua</summary>

```lua
function DefaultSkills() -- Add Skills
    Citizen.CreateThread(function()
        while true do
            local ped = PlayerPedId()
            local vehicle = GetVehiclePedIsUsing(ped)
    
            if IsPedSwimmingUnderWater(ped) then
                TriggerEvent('brutal_skills:client:AddSkill', 'Swimming', 1)
            elseif GetEntitySpeed(vehicle) * 3.6 >= 100 and GetPedInVehicleSeat(GetVehiclePedIsIn(ped), -1) == ped then
                TriggerEvent('brutal_skills:client:AddSkill', 'Driving', 1)
            elseif Config.Skills.AllowOutsideTraining then    
                
                if IsPedRunning(ped) then
                    TriggerEvent('brutal_skills:client:AddSkill', 'Stamina', 1)
                end

                if IsPedSprinting(ped) then
                    TriggerEvent('brutal_skills:client:AddSkill', 'Running', 1)
                end
            end
            Citizen.Wait(30000)
        end
    end)
    Citizen.CreateThread(function()
        while true do
            local ped = PlayerPedId()
            if IsPedShooting(ped) then
                GoodWeapon = true
                for k,v in pairs(Config.ShootWeponsBlackList) do
                    if GetSelectedPedWeapon(ped) == GetHashKey(v) then
                        GoodWeapon = false
                    end
                end

                if GoodWeapon then
                    TriggerEvent('brutal_skills:client:AddSkill', 'Shooting', 1)
                end
            end
            Citizen.Wait(200)
        end
    end)
end
```

</details>

<details>

<summary>client-core.lua</summary>

```lua
Core = nil

if Config.Core:upper() == 'ESX' then

    local _esx_ = 'new' -- 'new' / 'old'

    if _esx_ then
        Core = exports['es_extended']:getSharedObject()
    else
        while Core == nil do
            TriggerEvent('esx:getSharedObject', function(obj) Core = obj end)
            Citizen.Wait(0)
        end
    end
    
    LoadedEvent = 'esx:playerLoaded'
    ReviveEvent = 'esx_ambulancejob:revive'
    TSCB = Core.TriggerServerCallback

elseif Config.Core:upper() == 'QBCORE' then

    Core = exports['qb-core']:GetCoreObject()
    LoadedEvent = 'QBCore:Client:OnPlayerLoaded'
    ReviveEvent = 'hospital:client:Revive'
    TSCB = Core.Functions.TriggerCallback

end
```

</details>

<details>

<summary>server-core.lua</summary>

```lua
Core = nil

if Config.Core:upper() == 'ESX' then
--------------------------------------------------------------------------
---------------------------------| ESX |----------------------------------
--------------------------------------------------------------------------

    local _esx_ = 'new' -- 'new' / 'old'
        
    if _esx_ == 'new' then
        Core = exports['es_extended']:getSharedObject()
    else
        Core = nil
        TriggerEvent('esx:getSharedObject', function(obj) Core = obj end)
        while Core == nil do
            Citizen.Wait(0)
        end
    end

    RESCB = Core.RegisterServerCallback
    GETPFI = Core.GetPlayerFromId
    RUI = Core.RegisterUsableItem
    Accounts = {'money', 'bank'}

    function GetIdentifier(source)
        local xPlayer = GETPFI(source)
        while xPlayer == nil do
            Citizen.Wait(1000)
            xPlayer = GETPFI(source) 
        end
        return xPlayer.identifier
    end

    function GetAccountMoney(xPlayer,account)
        return xPlayer.getAccount(account).money
    end

    function GetItemCount(xPlayer, item)
        if xPlayer.getInventoryItem(item) == nil then
            print("^1PROBLEM!^7 The ^3" ..item.. "^7 item is not created.")
            return 0
        end

        return xPlayer.getInventoryItem(item).count
    end

    function RemoveAccountMoney(xPlayer, account, amount)
        xPlayer.removeAccountMoney(account, amount)
    end

    function AddAccountMoney(xPlayer, account, amount)
        xPlayer.addAccountMoney(account, amount)
    end

    function RemoveItem(xPlayer, item)
        xPlayer.removeInventoryItem(item, 1)
    end

elseif Config.Core:upper() == 'QBCORE' then
--------------------------------------------------------------------------
--------------------------------| QBCore |--------------------------------
--------------------------------------------------------------------------

    Core = exports['qb-core']:GetCoreObject()
    RESCB = Core.Functions.CreateCallback
    GETPFI = Core.Functions.GetPlayer
    RUI = Core.Functions.CreateUseableItem
    Accounts = {'cash', 'bank'}

    function GetIdentifier(source)
        local xPlayer = GETPFI(source)
        while xPlayer == nil do
            Citizen.Wait(1000)
            xPlayer = GETPFI(source) 
        end
        return xPlayer.PlayerData.citizenid
    end

    function GetAccountMoney(xPlayer, account)
        if account == Accounts[1] then
            return xPlayer.PlayerData.money['cash']
        elseif account == Accounts[2] then
            return xPlayer.PlayerData.money['bank']
        end
    end

    function GetItemCount(xPlayer, item)
        local items = xPlayer.Functions.GetItemByName(item)
        local item_count = 0
        if items ~= nil then
            item_count = items.amount
        else
            item_count = 0
        end
        return item_count
    end

    function RemoveAccountMoney(xPlayer, account, amount)
        xPlayer.Functions.RemoveMoney(account, amount)
    end

    function AddAccountMoney(xPlayer, account, amount)
        xPlayer.Functions.AddMoney(account, amount)
    end

    function RemoveItem(xPlayer, item)
        xPlayer.Functions.RemoveItem(item, 1)
    end
    
end
```

</details>


---

# 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.brutalscripts.com/site/scripts/gym-with-skills-v2/accessible-files.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.
