update
This commit is contained in:
parent
dfc233c1db
commit
caa1a1929c
19 changed files with 584 additions and 134 deletions
|
@ -1,6 +1,6 @@
|
|||
-- Initialize config(s)
|
||||
local sh_config = require 'config.shared'
|
||||
local cl_config = require 'config.client'
|
||||
local shared = require 'config.shared'
|
||||
local client = require 'config.client'
|
||||
local icons = require 'config.icons'
|
||||
|
||||
-- Initialize variables to track active locations
|
||||
|
@ -16,8 +16,8 @@ local wrongPIN, failedHack = 0, 0
|
|||
local questionData = {}
|
||||
|
||||
-- Build the input dialog for questionnaire if applicable
|
||||
if sh_config.computers.questionnaire then
|
||||
for _, question in ipairs(sh_config.questionnaire.questions) do
|
||||
if shared.computers.questionnaire then
|
||||
for _, question in ipairs(shared.questionnaire.questions) do
|
||||
questionData[#questionData + 1] = {
|
||||
type = question.type,
|
||||
label = question.label,
|
||||
|
@ -34,9 +34,9 @@ end
|
|||
-- Used to check if the answers submitted are correct
|
||||
--- @param answers table
|
||||
local function AreAnswersCorrect(answers)
|
||||
for question, answer in ipairs(sh_config.questionnaire.answers) do
|
||||
for question, answer in ipairs(shared.questionnaire.answers) do
|
||||
local submitted_answer = answers[question]
|
||||
if sh_config.questionnaire.questions[question].type == 'select' then
|
||||
if shared.questionnaire.questions[question].type == 'select' then
|
||||
if tonumber(submitted_answer) ~= answer then
|
||||
return false
|
||||
end
|
||||
|
@ -53,11 +53,11 @@ end
|
|||
local function InitiateRegisterRobbery()
|
||||
local canStart = lib.callback.await('lation_247robbery:StartRobbery', false)
|
||||
if not canStart then activeRegister = false return end
|
||||
local dict, anim = cl_config.anims.lockpick.dict, cl_config.anims.lockpick.clip
|
||||
local dict, anim = client.anims.lockpick.dict, client.anims.lockpick.clip
|
||||
lib.requestAnimDict(dict)
|
||||
while not HasAnimDictLoaded(dict) do Wait(0) end
|
||||
TaskPlayAnim(cache.ped, dict, anim, 8.0, 8.0, -1, 51, 1.0, false, false, false)
|
||||
local skillcheck = Minigame(sh_config.registers.minigame)
|
||||
local skillcheck = Minigame(shared.registers.minigame)
|
||||
ClearPedTasks(cache.ped)
|
||||
if not skillcheck then
|
||||
TriggerServerEvent('lation_247robbery:DoesLockpickBreak')
|
||||
|
@ -70,15 +70,16 @@ local function InitiateRegisterRobbery()
|
|||
street = GetStreetNameFromHashKey(GetStreetNameAtCoord(coords.x, coords.y, coords.z))
|
||||
}
|
||||
PoliceDispatch(data)
|
||||
if ProgressBar(cl_config.anims.register) then
|
||||
if ProgressBar(client.anims.register) then
|
||||
local codeChance = math.random(100)
|
||||
if codeChance <= sh_config.registers.noteChance then
|
||||
if codeChance <= shared.registers.noteChance then
|
||||
local generatedCode = math.random(1111, 9999)
|
||||
if safePin then safePin = nil end
|
||||
safePin = generatedCode
|
||||
local note = lib.alertDialog({
|
||||
local note = ShowAlert({
|
||||
header = locale('alerts.note.header'),
|
||||
content = locale('alerts.note.content', safePin),
|
||||
icon = icons.received_pin,
|
||||
centered = true,
|
||||
cancel = false,
|
||||
})
|
||||
|
@ -99,7 +100,7 @@ end
|
|||
-- Function to handle hacking the computer if required
|
||||
local function InitiateComputerHack()
|
||||
activeComputer = false -- Deactive target
|
||||
if failedHack >= sh_config.computers.maxAttempts then
|
||||
if failedHack >= shared.computers.maxAttempts then
|
||||
activeRegister = false
|
||||
activeComputer = false
|
||||
failedHack = 0
|
||||
|
@ -107,12 +108,12 @@ local function InitiateComputerHack()
|
|||
TriggerServerEvent('lation_247robbery:FailedRobbery')
|
||||
return
|
||||
end
|
||||
local dict, anim = cl_config.anims.hackPC.dict, cl_config.anims.hackPC.clip
|
||||
local dict, anim = client.anims.hackPC.dict, client.anims.hackPC.clip
|
||||
lib.requestAnimDict(dict)
|
||||
while not HasAnimDictLoaded(dict) do Wait(0) end
|
||||
TaskPlayAnim(cache.ped, dict, anim, 8.0, 8.0, -1, 1, 1, false, false, false)
|
||||
if sh_config.computers.questionnaire then
|
||||
local questions = lib.inputDialog(locale('inputs.questions.header'), questionData)
|
||||
if shared.computers.questionnaire then
|
||||
local questions = ShowInput({ title = locale('inputs.questions.header'), options = questionData })
|
||||
if not questions then
|
||||
activeComputer = true
|
||||
ClearPedTasks(cache.ped)
|
||||
|
@ -124,9 +125,10 @@ local function InitiateComputerHack()
|
|||
local generatedCode = math.random(1111, 9999)
|
||||
if safePin then safePin = nil end
|
||||
safePin = generatedCode
|
||||
lib.alertDialog({
|
||||
ShowAlert({
|
||||
header = locale('alerts.hack.header'),
|
||||
content = locale('alerts.hack.content', safePin),
|
||||
icon = icons.received_pin,
|
||||
centered = true,
|
||||
cancel = false
|
||||
})
|
||||
|
@ -138,7 +140,7 @@ local function InitiateComputerHack()
|
|||
ShowNotification(locale('notify.failed-hack'), 'error')
|
||||
end
|
||||
else
|
||||
local skillcheck = Minigame(sh_config.computers.minigame)
|
||||
local skillcheck = Minigame(shared.computers.minigame)
|
||||
if not skillcheck then
|
||||
ClearPedTasks(cache.ped)
|
||||
activeComputer = true
|
||||
|
@ -151,9 +153,10 @@ local function InitiateComputerHack()
|
|||
local generatedCode = math.random(1111, 9999)
|
||||
if safePin then safePin = nil end
|
||||
safePin = generatedCode
|
||||
lib.alertDialog({
|
||||
ShowAlert({
|
||||
header = locale('alerts.hack.header'),
|
||||
content = locale('alerts.hack.content', safePin),
|
||||
icon = icons.received_pin,
|
||||
centered = true,
|
||||
cancel = false
|
||||
})
|
||||
|
@ -164,7 +167,7 @@ end
|
|||
-- Function to handle the safe robbery
|
||||
local function InitiateSafeRobbery()
|
||||
activeSafe = false
|
||||
if wrongPIN >= sh_config.safes.maxAttempts then
|
||||
if wrongPIN >= shared.safes.maxAttempts then
|
||||
activeRegister = false
|
||||
activeSafe = false
|
||||
wrongPIN = 0
|
||||
|
@ -172,14 +175,17 @@ local function InitiateSafeRobbery()
|
|||
TriggerServerEvent('lation_247robbery:FailedRobbery')
|
||||
return
|
||||
end
|
||||
local inputCode = lib.inputDialog(locale('inputs.safe.header'), {
|
||||
{
|
||||
type = 'input',
|
||||
label = locale('inputs.safe.label'),
|
||||
description = locale('inputs.safe.desc'),
|
||||
placeholder = locale('inputs.safe.placeholder'),
|
||||
icon = icons.safe_pin,
|
||||
required = true
|
||||
local inputCode = ShowInput({
|
||||
title = locale('inputs.safe.header'),
|
||||
options = {
|
||||
{
|
||||
type = 'input',
|
||||
label = locale('inputs.safe.label'),
|
||||
description = locale('inputs.safe.desc'),
|
||||
placeholder = locale('inputs.safe.placeholder'),
|
||||
icon = icons.safe_pin,
|
||||
required = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if not inputCode then activeSafe = true return end
|
||||
|
@ -191,7 +197,7 @@ local function InitiateSafeRobbery()
|
|||
elseif convertedCode == safePin then
|
||||
activeSafe = false
|
||||
wrongPIN = 0
|
||||
if ProgressBar(cl_config.anims.safe) then
|
||||
if ProgressBar(client.anims.safe) then
|
||||
activeRegister = false
|
||||
TriggerServerEvent('lation_247robbery:CompleteSafeRobbery')
|
||||
safePin = nil
|
||||
|
@ -211,7 +217,7 @@ AddEventHandler('lation_247robbery:onPlayerLoaded', function()
|
|||
name = 'cash_register' ..key,
|
||||
coords = coord,
|
||||
radius = 0.35,
|
||||
debug = sh_config.setup.debug,
|
||||
debug = shared.setup.debug,
|
||||
options = {
|
||||
{
|
||||
label = locale('target.register'),
|
||||
|
@ -242,7 +248,7 @@ AddEventHandler('lation_247robbery:onPlayerLoaded', function()
|
|||
name = 'computer' ..key,
|
||||
coords = coord,
|
||||
radius = 0.35,
|
||||
debug = sh_config.setup.debug,
|
||||
debug = shared.setup.debug,
|
||||
options = {
|
||||
{
|
||||
label = locale('target.computer'),
|
||||
|
@ -267,7 +273,7 @@ AddEventHandler('lation_247robbery:onPlayerLoaded', function()
|
|||
name = 'safe' ..key,
|
||||
coords = coord,
|
||||
radius = 0.45,
|
||||
debug = sh_config.setup.debug,
|
||||
debug = shared.setup.debug,
|
||||
options = {
|
||||
{
|
||||
label = locale('target.safe'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue