Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix padlock sticky note #67

Merged
merged 2 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading