This script is to allow citizens of your city to find peace and relax in the city of Los Santos by finding their Zen while exercising in Yoga.

Citizens of your city will be able to interact with yoga mats placed around the city to destress before going about their busy daily lives.


Video Preview = https://youtu.be/pcqOWr_0QiA
Tebex = mckleans-scripts.tebex.io/


Dependencies

Key Features

  • Provides your city with a way to release stress and or health
    • Set your Stress release anywhere from 1-100 in the config
    • Set your Health gain to anywhere from 1-100 in the config
  • Config Adjustments
    • Progressbar timer (set long by default to stop abuse)
    • Adjustable Yoga animation in the config
    • Set your yoga mat locations, as many as you want
    • Set your Yoga Location’s names and blips
  • 3 Yoga Mats are set by the main Courthouse by default

#FirstScript


Code is accessible Yes
Subscription-based No
Lines (approximately) 60
Requirements qb-target / Polyzone
Support Yes
exports['qb-target']:AddTargetModel({-1978741854, 2057317573, -232023078}, { --Yoga mats
    options = {
        {
            type = "client",
            event = "yoga:start",
            icon = "fas fa-yin-yang",
            label = "Do yoga",
        },
    },
    distance = 2.5
})

local SucceededAttempts = 0
local NeededAttempts = 2

RegisterNetEvent('yoga:start', function()
    local ped = PlayerPedId()
    local coords = GetEntityCoords(ped)
    local Skillbar = exports['qb-skillbar']:GetSkillbarObject()

    TriggerEvent('animations:client:EmoteCommandStart', {"yoga"})
    FreezeEntityPosition(ped, true)

    Skillbar.Start({
        duration = math.random(7500, 15000),
        pos = math.random(10, 30),
        width = math.random(10, 20),
    }, function()
        if SucceededAttempts + 1 >= NeededAttempts then
            ClearPedTasks(ped)
            SucceededAttempts = 0
            FreezeEntityPosition(ped, false)
            TriggerServerEvent('hud:server:RelieveStress', 5)
            QBCore.Functions.Notify("You have a bit less stress", "success")
        else
            Skillbar.Repeat({
                duration = math.random(700, 1250),
                pos = math.random(10, 40),
                width = math.random(10, 13),
            })
            SucceededAttempts = SucceededAttempts + 1
        end
    end, function()
        ClearPedTasks(ped)
        FreezeEntityPosition(ped, false)
        QBCore.Functions.Notify("Failed, focus..", "error")
        SetPedToRagdollWithFall(ped, 1000, 2000, 1, GetEntityForwardVector(ped), 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
        SucceededAttempts = 0
    end)
end)

Citizen.CreateThread(function()
    local coords = vector3(-1493.59, 829.14, 181.6)
    local blip = AddBlipForCoord(coords)
    SetBlipSprite(blip, 197)
    SetBlipDisplay(blip, 4)
    SetBlipScale(blip, 0.6)
    SetBlipAsShortRange(blip, true)
    SetBlipColour(blip, 24)
    BeginTextCommandSetBlipName("STRING")
    AddTextComponentSubstringPlayerName("Yoga")
    EndTextCommandSetBlipName(blip)
end)
1 Like

Nicely put together, I never thought about including the skill bar game, although I see this added onto a lot of things at the moment, i personally prefer the wait timer on something like this as its relaxing adds a little to the rp and slows down the pace a little. I will say my script makes it so you can have yoga mats anywhere you wish to have them and use them rather than going to the naturally spawned areas.

● mk-yoga v2.2

  • Added onResourceStop to remove those pesky polyboxes when testing
    ∘ or when youve accidentally left debug on :o
    ∘ Blip bits configured into the Config
  • Added Debug Print for the locations
    ∘ Made the yogamat spawns and Target more optamised/cleaner
  • Added a version file
  • Added a shared folder [this folder is escrowed]
  • Added Locales to config
  • Added to the Instructions.md that this script is NoPixel Inspired