CurrentCops = 0
local zones = {}
fleecas = {"Legion", "RockfordHills", "Burton", "Alta", "GrandSenoraDesert", "BanhamCanyon"} -- Remove the bank location you want to disable from this table
if Config.Framework == "qb-core" then
local QBCore = exports[Config.Core.resource]:GetCoreObject()
function Notification(notification, notificationType, duration)
TriggerEvent(Config.Core.name..':Notify', notification, notificationType, duration)
end
function HasItem(item)
return QBCore.Functions.HasItem(item)
end
function Progressbar(name, label, duration, success, fail, icon)
QBCore.Functions.Progressbar(name, label, duration, false, false, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true
}, {}, {}, {}, success, fail, icon)
end
RegisterNetEvent(Config.Core.name..':Client:OnPlayerLoaded', function()
OnPlayerLoadedData()
end)
elseif Config.Framework == "esx" then
function Notification(notification, notificationType, duration)
TriggerEvent('esx:showNotification', notification, notificationType, duration)
end
function HasItem(item)
local p = promise.new()
lib.callback('projectx-fleecabankrobbery:server:hasitem', false, function(result)
p:resolve(result)
end, item)
return Citizen.Await(p)
end
function Progressbar(name, label, duration, success, fail, icon)
if lib.progressBar({
duration = duration,
label = label,
useWhileDead = false,
canCancel = true,
disable = {car = true},
anim = {},
prop = {},
}) then success() else fail() end
end
RegisterNetEvent('projectx-fleecabankrobbery:client:PdNotify', function(coords)
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(blip, 364)
SetBlipScale(blip, 1.0)
SetBlipColour(blip, 59)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Fleeca Bank Robbery")
EndTextCommandSetBlipName(blip)
SetTimeout(120000, function()
RemoveBlip(blip)
end)
end)
RegisterNetEvent('esx:playerLoaded', function()
OnPlayerLoadedData()
end)
else
end
function CreateCircleZones(name, coords, size, event, icon, label, distance)
local Target
if Config.Target == "ox_target" or Config.Target == "qb-target" then Target = "qb-target" else Target = Config.Target end
exports[Target]:AddCircleZone(name, coords, size,
{name = name, debugPoly = Config.debug, useZ=true},
{
options = {
{
name = name,
type = "client",
action = event,
icon = icon,
label = label,
coords = coords,
}
},
distance = distance
})
end
function CircleZoneDestroy(name)
local Target
if Config.Target == "ox_target" or Config.Target == "qb-target" then Target = "qb-target" else Target = Config.Target end
exports[Target]:RemoveZone(name)
end
function drawTextUi(bool, text)
if Config.Drawtext == "OX" then
if bool then lib.showTextUI(text) else lib.hideTextUI() end
elseif Config.Drawtext == "QB" then
if bool then exports[Config.Core.abbrev..'-core']:DrawText(text) else exports[Config.Core.abbrev..'-core']:HideText() end
elseif Config.Drawtext == "OLDQB" then
if bool then exports[Config.Core.abbrev..'-drawtext']:DrawText(text) else exports[Config.Core.abbrev..'-drawtext']:HideText() end
end
end
function zoneDestroy(name)
for k, v in pairs(zones) do
if v.name == name then
zones[k]:remove()
table.remove(zones, k)
end
end
end
function zoneCreate(name, coords, size, rotation, onEnter, onExit)
zones[#zones + 1] = lib.zones.box({
name = name,
coords = coords,
size = size,
rotation = rotation,
debug = Config.debug,
onEnter = onEnter,
onExit = onExit,
})
end
function Emote(name)
if Config.EmoteMenu == "dpemotes" then
TriggerEvent('animations:client:EmoteCommandStart', {name})
elseif Config.EmoteMenu == "rpemotes" then
exports["rpemotes"]:EmoteCommandStart(name, 1)
elseif Config.EmoteMenu == "scully" then
exports.scully_emotemenu:playEmoteByCommand(name)
elseif Config.EmoteMenu == "cylex" then
exports.cylex_animmenuv2:playEmote(name)
else
ExecuteCommand("e "..name)
end
end
function OnEvidence(pos, chance)
if math.random(1, 100) > chance or IsWearingHandshoes() then return end
TriggerServerEvent("evidence:server:CreateFingerDrop", pos)
end
function Stress(chance)
TriggerServerEvent('hud:server:GainStress', chance)
end
function PoliceCheck()
return CurrentCops >= Config.MinimumFleecaPolice
end
function Dispatch()
if Config.Dispatch == "cd" then
local data = exports['cd_dispatch']:GetPlayerInfo()
TriggerServerEvent('cd_dispatch:AddNotification', {
job_table = {'police', },
coords = data.coords,
title = '10-15 - Fleeca Bank Robbery',
message = 'A '..data.sex..' robbing a bank at '..data.street,
flash = 0,
unique_id = data.unique_id,
sound = 1,
blip = {
sprite = 431,
scale = 1.2,
colour = 3,
flashes = false,
text = '911 - Fleeca Bank Robbery',
time = 5,
radius = 0,
}
})
elseif Config.Dispatch == "qs" then
exports['qs-dispatch']:FleecaBankRobbery()
elseif Config.Dispatch == "ps" then
exports['ps-dispatch']:FleecaBankRobbery()
else
if Config.Framework == "esx" then
TriggerServerEvent('projectx-fleecabankrobbery:server:PdNotify')
-- (ESX) Add your disptach script here if it's none of the above and remove the line above this one
else
-- (Qbcore) Add your disptach script here if it's none of the above
end
end
end
----- Client Side EXP Events (Only use this if Config.ServerSideEvents is false and your skill system has client sided functions)
RegisterNetEvent("projectx-fleecabankrobbery:client:AddExperience", function(exp)
-- add exp function here and insert exp as a parameter
end)
lib.callback.register("projectx-fleecabankrobbery:client:CheckExpLevel", function()
-- Add "return" then add your check exp level function here
end)
--------------------- Minigames ---------------------
------ You can return true to skip a minigame -------
-----------------------------------------------------
function FingerprintMinigame()
local p = promise:new()
TriggerEvent("utk_fingerprint:Start", 4, 6, 2, function(result)
p:resolve(result)
end)
return Citizen.Await(p)
-- add exp here if needed
end
function FuseboxMinigame()
local p = promise:new()
exports['ps-ui']:Maze(function(success)
p:resolve(success)
end, 20)
return Citizen.Await(p)
-- add exp here if needed
end
function KeypadOneMinigame()
local p = promise:new()
local result = exports['simonsays']:StartSimonSays(5, 5)
p:resolve(result)
return Citizen.Await(p)
-- add exp here if needed
end
function VaultMinigame()
local p = promise:new()
local success = exports['SN-Hacking']:ColorPicker(5, 7000, 3000)--ColorPicker(icons(number), typeTime(milliseconds), viewTime(milliseconds))
p:resolve(success)
return Citizen.Await(p)
-- add exp here if needed
end
function PrinterMinigame()
local p = promise:new()
local result = exports['lightsout']:StartLightsOut(4, 20)
p:resolve(result)
return Citizen.Await(p)
-- add exp here if needed
end
function SearchMinigame()
local p = promise:new()
exports['ps-ui']:Circle(function(result)
p:resolve(result)
end, 6, 10)
return Citizen.Await(p)
-- add exp here if needed
end
function JailDoorKeypadMinigame()
local p = promise:new()
local success = exports['SN-Hacking']:ColorPicker(5, 7000, 3000)--ColorPicker(icons(number), typeTime(milliseconds), viewTime(milliseconds))
p:resolve(success)
return Citizen.Await(p)
-- add exp here if needed
end
function JailDoorMinigame()
return true -- return true if you dont want a minigame here
-- add exp here if needed
end