local QBCore = exports['qb-core']:GetCoreObject()
local LANG = Config.Locales[Config.Lang]
local listen = false
local CurrentShop = nil
aktif = false -- IMPORTANT don't touch please!
-- No target seçeneği
-- # Functions
function CustomNotifVariation(text, style, time)
QBCore.Functions.Notify(text, style, time)
end
function ProgressbarSetting(data, cb)
if not Config.OxLib then
QBCore.Functions.Progressbar("wert_hazır", data.label, data.time, false, true, {
disableMovement = data.disablemove,
disableCarMovement = data.disablecar,
disableMouse = data.disablemouse,
disableCombat = data.disablecombat,
}, {
animDict = data.animdict,
anim = data.animname,
flags = data.animflag or 49,
}, {}, {}, function() -- Done
cb('finish')
end, function() -- Cancel
cb('cancel')
end)
else
if lib.progressCircle({
duration = data.time,
position = 'bottom',
useWhileDead = false,
canCancel = true,
disable = {
car = data.disablecar,
move = data.disablemove,
mouse, data.disablemouse,
combat = data.disablecombat
},
anim = {
dict = data.animdict,
clip = data.animname,
flag = data.animflag or 49
},
}) then cb('finish') else cb('cancel') end
end
end
function RegisterMiniGame(cb)
if Config.RegisterMiniGameType == 'qb-lock' then
local finished = exports['qb-lock']:StartLockPickCircle(3, 10, success)
cb(finished) -- Must return check valid
elseif Config.RegisterMiniGameType == 'ps-ui-circle' then
exports['ps-ui']:Circle(function(success)
cb(success)
end, 2, 20)
elseif Config.RegisterMiniGameType == 'ox-skillbar' then
local success = lib.skillCheck({'easy', 'easy', {areaSize = 60, speedMultiplier = 2}, 'hard'}, {'w', 'a', 's', 'd'})
cb(success)
elseif Config.RegisterMiniGameType == 'none' then
cb(true)
end
end
function SafeMiniGame(cb)
if Config.SafeMinigameType == 'ps-ui-thermite' then
exports['ps-ui']:Thermite(function(success)
cb(success)
end, 10, 5, 3)
elseif Config.SafeMinigameType == 'ps-ui-maze' then
exports['ps-ui']:Maze(function(success)
cb(success)
end, 20)
elseif Config.SafeMinigameType == 'memorygame' then
exports["memorygame"]:thermiteminigame(6, 1, 3, 10, function() -- success
cb(true)
end, function() -- failure
cb(false)
end)
elseif Config.SafeMinigameType == 'none' then
cb(true)
end
end
function HideInteraction()
if Config.NoTargetInteraction == 'textui' then
if Config.OxLib then
lib.hideTextUI()
else
exports['qb-core']:HideText()
end
end
end
function ShowInteraction(displayText)
if Config.NoTargetInteraction == 'textui' then
if Config.OxLib then
lib.showTextUI(displayText)
else
exports['qb-core']:DrawText(displayText, 'left')
end
end
end
local function DrawText3D(x, y, z, text)
-- Use local function instead
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.017 + factor, 0.03, 0, 0, 0, 75)
ClearDrawOrigin()
end
local function StartNoTargetThread(coord, event, notargetlabel)
CreateThread(function()
local event_name = event
local label = notargetlabel
if Config.NoTargetInteraction == 'textui' then
while listen do
if aktif then
Wait(1000)
else
if IsControlJustPressed(0, Config.NoTargetInteractionKey) then
if CurrentShop then
TriggerEvent(event_name, CurrentShop)
end
end
end
Wait(1)
end
elseif Config.NoTargetInteraction == 'drawtext' then
while listen do
if aktif then
Wait(1000)
else
DrawText3D(coord.x, coord.y, coord.z, label)
if IsControlJustPressed(0, Config.NoTargetInteractionKey) then
if CurrentShop then TriggerEvent(event_name, CurrentShop) end
end
end
Wait(1)
end
end
end)
end
-- # Events
RegisterNetEvent("wert-shoprobbery:client:police-alert", function(shopno)
-- Add your police alert event
if Config.PoliceNotificationSystem == 'wert-policesystem' then
exports['wert-policesystem']:alert({
style = "police", -- police or ambulance (job)
code = "10-80", -- code
name = "Shop #" .. shopno .. " Being Robbed", -- title
})
elseif Config.PoliceNotificationSystem == 'ps-dispatch' then
exports['ps-dispatch']:StoreRobbery(shopno)
elseif Config.PoliceNotificationSystem == 'custom' then
-- Your special system
end
end)
RegisterNetEvent("wert-shoprobbery:client:arka-kasa", function(key)
SafeMiniGame(function(success)
if success then
TriggerEvent("wert-shoprobbery:client:police-alert", key)
local animset = Config.PrepareAnimSettings
ProgressbarSetting({label = LANG.progress_prepare, time = Config.ProgressbarTimes.prepare, disablemove = true, disablecar = true, disablemouse = false, disablecombat = true, animdict = animset.dict, animname = animset.anim, animflag = animset.flag}, function(result)
if result == 'finish' then
TriggerEvent('wert-shoprobbery:client:arka-kasa-steptwo', key)
else
aktif = false
end
end)
else
aktif = false
CustomNotifVariation(LANG.minigame_fail, "error")
end
end)
end)
CreateThread(function()
Wait(1000)
local Zones = {}
for k, v in pairs(Config.ShopInfos) do
if v.register and v.safe then
local register_name = k .. "WertShopRegister"
local safe_name = k .. "WertShopSafe"
local register_coord = vector3(v.register.x, v.register.y, v.register.z)
local safe_coord = vector3(v.safe.x, v.safe.y, v.safe.z)
if Config.UseTarget then
exports["qb-target"]:AddBoxZone(register_name, register_coord, 0.8, 0.8, {
name = register_name,
heading = v.register.w,
debugPoly = Config.DebugPoly,
minZ = v.register.z - 0.5,
maxZ = v.register.z + 0.5
}, {
options = {
{
icon = Config.RegisterInteractionIcon,
label = LANG.rob_register,
action = function(entity) TriggerEvent("wert-shoprobbery:client:rob-register", k) end,
canInteract = function(entity)
if not aktif then return true else return false end
end,
},
},
distance = 1.5
})
exports["qb-target"]:AddBoxZone(safe_name, safe_coord, 0.8, 0.8, {
name = safe_name,
heading = v.safe.w,
debugPoly = Config.DebugPoly,
minZ = v.safe.z - 0.5,
maxZ = v.safe.z + 0.5
}, {
options = {
{
icon = Config.SafeInteractionIcon,
label = LANG.rob_safe,
action = function(entity) TriggerEvent("wert-shoprobbery:client:rob-safe", k) end,
canInteract = function(entity)
if not aktif then return true else return false end
end,
},
},
distance = 1.5
})
else
-- No target
Zones[#Zones+1] = CircleZone:Create(register_coord, Config.NoTargetRegisterZoneSize, {
name = register_name,
debugPoly = false,
data = {
casetype = 'register',
key = k
}
})
Zones[#Zones+1] = CircleZone:Create(safe_coord, Config.NoTargetSafeZoneSize, {
name = safe_name,
debugPoly = false,
data = {
casetype = 'safe',
key = k
}
})
end
end
end
if not Config.UseTarget and #Zones > 0 then
local comboZone = ComboZone:Create(Zones, { name = 'wertshoprobberycombo', debugPoly = Config.DebugPoly })
comboZone:onPlayerInOut(function(isPointInside, _, zone)
if isPointInside then
if not listen then
CurrentShop = zone.data.key
listen = true
local shop_coord = Config.ShopInfos[CurrentShop].register
local displayText = LANG.notargetregister_interaction
local eventname = "wert-shoprobbery:client:rob-register"
if zone.data.casetype == 'safe' then
shop_coord = Config.ShopInfos[CurrentShop].safe
displayText = LANG.notargetasafe_interaction
eventname = "wert-shoprobbery:client:rob-safe"
end
StartNoTargetThread(shop_coord, eventname, displayText)
ShowInteraction(displayText)
end
else
listen = false
CurrentShop = nil
HideInteraction()
end
end)
end
end)