Functions

local QBCore = exports[Config.Utility.CoreName]:GetCoreObject()
---------------
-- 𝗙𝗨𝗡𝗖𝗧𝗜đ—ĸ𝗡đ—Ļ
---------------

function PoliceCall()
    --exports['ps-dispatch']:HouseRobbery()
    -- If you use ps-dispatch uncomment line 7
end

-- Notifys
function Notify(msg)
    QBCore.Functions.Notify(msg)
end

-- Progressbars
function progressBar(msg)
    QBCore.Functions.Progressbar("Cenas", msg, 5000, false, false, {disableMovement = true,disableCarMovement = true,disableMouse = false,
    disableCombat = true}, {}, {}, {}, function() end)
end

-- Email when you start the heist
function Email()
    TriggerServerEvent("qb-phone:server:sendNewMail", {
        sender = Language.Sender,
        subject = Language.Subject,
        message = Language.Message,
    })
end


-- Fade animation when entering and leaving the house
function AnimacaoFade()
    DoScreenFadeOut(1000)
    Wait(1000)
    DoScreenFadeIn(1000)
end

-- Function to enter in house ( if you need to change the mini-game )
-- If you don't know what to change, please open a discord ticket and I'll help
function TentarEntrar(Casinha)
  QBCore.Functions.TriggerCallback('m-HouseRobbery:Server:HaveLockpick', function(cb)
    if cb then
        local random = math.random(0, 100)
        if random <= Config.Utility.ChanceCallCops then
            PoliceCall()
        end
        if Config.Utility.Skillbar == "qb-lock" then
            local success = exports['qb-lock']:StartLockPickCircle(5,20)
            if success then
                TriggerServerEvent('m-HouseRobbery:Server:RemoveItem', Config.Utility.ItemStartRobbery, 1)
                TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[Config.Utility.ItemStartRobbery], "remove", 1)
                EntrarCasa(Casinha)
                TriggerEvent('instance:create', 'house')
                Wait(math.random(15000,30000))
            else
                Notify(Language.Failed)
            end
        elseif Config.Utility.Skillbar == "ps-ui" then
            exports['ps-ui']:Circle(function(success)
                if success then
                    TriggerServerEvent('m-HouseRobbery:Server:RemoveItem', Config.Utility.ItemStartRobbery, 1)
                    TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[Config.Utility.ItemStartRobbery], "remove", 1)
                    EntrarCasa(Casinha)
                    TriggerEvent('instance:create', 'house')
                    Wait(math.random(15000,30000))
                else
                    Notify(Language.Failed)
                end
            end, 2, 20) -- NumberOfCircles, MS
        end
    else
        Notify(Language.NoItems)
        end
    end)
end


-- 3D Text ( Only for exit house )
function DrawText3D(x, y, z, text, scale)
    local onScreen, _x, _y = World3dToScreen2d(x, y, z)
    local pX, pY, pZ = table.unpack(GetGameplayCamCoords())
    SetTextScale(scale, scale)
    SetTextFont(4)
    SetTextProportional(1)
    SetTextEntry("STRING")
    SetTextCentre(1)
    SetTextColour(255, 255, 255, 255)
    SetTextOutline()
    AddTextComponentString(text)
    DrawText(_x, _y)
end

Last updated