Functions.lua

Preview

function ProgressbarFunc(k)
    if Config.ProgressBar == 'progressbar' then
        exports['progressbar']:Progress({
            name = "unique_action_name",
            duration = Config.ProgressTime * 1000,
            label = Config.ProgressLabel,
            useWhileDead = false,
            canCancel = false,
            controlDisables = {
                disableMovement = true,
                disableCarMovement = true,
                disableMouse = false,
                disableCombat = true,
            },
        }, function(status)
            if not status then
                ClearPedTasks(myPed)
                TriggerServerEvent('stoned:claimDrop', k)

            end
        end)
    elseif  Config.ProgressBar == 'mythic_progbar' then
        TriggerEvent("mythic_progbar:client:progress", {
            name = "abrir",
            duration = Config.ProgressTime * 1000,
            label = Config.ProgressLabel,
            useWhileDead = false,
            canCancel = true,
            controlDisables = {
                disableMovement = true,
                disableCarMovement = true,
                disableMouse = true,
                disableCombat = true,
            },
            animation = {
                animDict = "amb@prop_human_parking_meter@male@idle_a",
                anim = "idle_a",
            },                                
        }, function(status)
            if not status then

                TriggerServerEvent('stoned:claimDrop', k)

            end
        end)
    elseif Config.ProgressBar == 'ox_lib' then
        if lib.progressCircle({
            duration = Config.ProgressTime * 1000,
            label = Config.ProgressLabel,
            position = 'bottom',
            useWhileDead = false,
            canCancel = true,
            disable = {
                car = true,
                move = true,
                combat = true
            },
            anim = {
                dict = "amb@prop_human_parking_meter@male@idle_a",
                clip = "idle_a",
            },
        }) then
            --print(k)
            TriggerServerEvent('stoned:claimDrop', k)
        end
    end
end

function DrawText3D(x, y, z, text)
    SetTextScale(0.35, 0.35)
    SetTextFont(4)
    SetTextDropShadow()
    SetTextProportional(1)
    SetTextColour(255, 255, 255, 215)
    SetTextEntry("STRING")
    SetTextCentre(true)
    AddTextComponentString(text)
    SetTextOutline() -- Adiciona contorno ao texto para tornΓ‘-lo mais grosso
    SetDrawOrigin(x, y, z, 0)
    DrawText(0.0, 0.0)
    local factor = (string.len(text)) / 370
    DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75)
    ClearDrawOrigin()
end


function GetItemLabelQB(item)
    local itemLabel = QBCore.Shared.Items[item:lower()].label
    return itemLabel
end

function GetItemLabelESX(item)
    local itemLabel = ESX.GetItemLabel(item)
    return itemLabel
end

function GetItemLabelVRP(item)
    local itemLabel = nil

    -- Use a function for vRP to get name or label of the item
    local itemInfo = vRP.getItemDefinition(item)
    if itemInfo and itemInfo.label then
        itemLabel = itemInfo.label
    else
        itemLabel = item 
    end

    return itemLabel
end

Last updated

Was this helpful?