Skip to content

Commit

Permalink
Merge pull request #67 from citRaTTV/fix/padlock-sticky-note
Browse files Browse the repository at this point in the history
Fix padlock sticky note
  • Loading branch information
GhzGarage authored Dec 31, 2023
2 parents 7088a33 + 1809c29 commit a1d5c8d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Config.RegisterEarnings = math.random(Config.minEarn, Config.maxEarn)
Config.MinimumStoreRobberyPolice = 2
Config.resetTime = (60 * 1000) * 30
Config.tickInterval = 1000
Config.stickyNoteChance = 10 -- Percent chance to get the safe code from a cash register

Config.Registers = {
[1] = { vector3(-47.24, -1757.65, 29.53), robbed = false, time = 0, safeKey = 1, camId = 4 },
Expand Down
12 changes: 8 additions & 4 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,20 @@ RegisterNetEvent('qb-storerobbery:server:takeMoney', function(register, isDone)
}
Player.Functions.AddItem('markedbills', bags, false, info)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['markedbills'], 'add')
if math.random(1, 100) <= 10 then
if math.random(1, 100) <= Config.stickyNoteChance then
local code = SafeCodes[Config.Registers[register].safeKey]
if Config.Safes[Config.Registers[register].safeKey].type == 'keypad' then
info = {
label = Lang:t('text.safe_code') .. tostring(code)
}
else
info = {
label = Lang:t('text.safe_code') .. tostring(math.floor((code[1] % 360) / 3.60)) .. '-' .. tostring(math.floor((code[2] % 360) / 3.60)) .. '-' .. tostring(math.floor((code[3] % 360) / 3.60)) .. '-' .. tostring(math.floor((code[4] % 360) / 3.60)) .. '-' .. tostring(math.floor((code[5] % 360) / 3.60))
}
local label = Lang:t('text.safe_code') .. ' '

for i = 1, #code do
label = label .. tostring(math.floor((code[i] % 360) / 3.60)) .. ' - '
end

info = {label = label:sub(1, -3)}
end
Player.Functions.AddItem('stickynote', 1, false, info)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['stickynote'], 'add')
Expand Down

0 comments on commit a1d5c8d

Please sign in to comment.