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

sync #784

Closed
wants to merge 63 commits into from
Closed

sync #784

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
7af5325
Merge pull request #726 from bitpredator/dev
bitpredator Jun 16, 2024
84c945d
Merge pull request #727 from bitpredator/dev
bitpredator Jun 16, 2024
50495aa
Merge pull request #728 from bitpredator/dev
bitpredator Jun 17, 2024
0e9959f
Merge pull request #729 from bitpredator/dev
bitpredator Jun 17, 2024
f8716bd
chore(deps-dev): bump ws
dependabot[bot] Jun 18, 2024
8301480
Merge pull request #731 from bitpredator/dev
bitpredator Jun 19, 2024
e6983dc
Merge pull request #730 from bitpredator/dependabot/npm_and_yarn/serv…
bitpredator Jun 20, 2024
d34c6a9
Merge pull request #732 from bitpredator/dev
bitpredator Jun 20, 2024
c5bb566
Merge pull request #733 from bitpredator/dev
bitpredator Jun 20, 2024
9ed0d3e
Merge pull request #734 from bitpredator/dev
bitpredator Jun 20, 2024
83c9821
Merge pull request #735 from bitpredator/dev
bitpredator Jun 21, 2024
b29bb97
Merge pull request #1 from bitpredator/main
busco82 Jun 21, 2024
4d0d890
Merge pull request #736 from bitpredator/dev
bitpredator Jun 22, 2024
c91172f
Merge pull request #2 from bitpredator/main
busco82 Jun 22, 2024
781b4b1
Merge pull request #737 from bitpredator/dev
bitpredator Jun 23, 2024
0564b63
Merge pull request #3 from bitpredator/main
busco82 Jun 23, 2024
7ef04b9
Merge pull request #738 from bitpredator/dev
bitpredator Jun 24, 2024
c6e2fa5
Merge pull request #4 from bitpredator/main
busco82 Jun 24, 2024
2bc0319
Merge pull request #739 from bitpredator/dev
bitpredator Jun 28, 2024
32f346a
Update codeql.yml
bitpredator Jun 28, 2024
c28c30f
Merge pull request #740 from bitpredator/bitpredator-patch-1
bitpredator Jun 28, 2024
a06c72c
Merge pull request #741 from bitpredator/dev
bitpredator Jun 29, 2024
4acb130
Merge pull request #742 from bitpredator/dev
bitpredator Jul 1, 2024
396c110
Merge pull request #743 from bitpredator/dev
bitpredator Jul 4, 2024
e8263ab
Merge pull request #744 from bitpredator/dev
bitpredator Jul 6, 2024
e00ce09
Merge pull request #745 from bitpredator/dev
bitpredator Jul 11, 2024
409d533
Merge pull request #746 from bitpredator/dev
bitpredator Jul 16, 2024
5ddba5e
Merge pull request #749 from bitpredator/dev
bitpredator Jul 18, 2024
a4a5fcb
Merge pull request #750 from bitpredator/dev
bitpredator Jul 20, 2024
f475cc9
Merge pull request #751 from bitpredator/dev
bitpredator Jul 20, 2024
c3dc32f
Merge pull request #752 from bitpredator/dev
bitpredator Jul 21, 2024
aa4e408
Merge pull request #753 from bitpredator/dev
bitpredator Jul 23, 2024
2cd3b63
Merge pull request #754 from bitpredator/dev
bitpredator Jul 24, 2024
fa13ce2
Merge pull request #755 from bitpredator/dev
bitpredator Jul 25, 2024
1a0d924
Merge pull request #756 from bitpredator/dev
bitpredator Jul 27, 2024
7bde62a
Merge pull request #757 from bitpredator/dev
bitpredator Jul 27, 2024
0d69694
Merge pull request #758 from bitpredator/dev
bitpredator Jul 27, 2024
5097360
Merge pull request #759 from bitpredator/dev
bitpredator Jul 31, 2024
9ba07f4
Merge pull request #760 from bitpredator/dev
bitpredator Aug 2, 2024
37e5abe
Merge pull request #761 from bitpredator/dev
bitpredator Aug 2, 2024
67b5931
Merge pull request #762 from bitpredator/dev
bitpredator Aug 2, 2024
cd2c8df
Merge pull request #763 from bitpredator/dev
bitpredator Aug 4, 2024
c259770
Merge pull request #764 from bitpredator/dev
bitpredator Aug 4, 2024
e4ce356
Merge pull request #765 from bitpredator/dev
bitpredator Aug 4, 2024
5e503b4
Merge pull request #766 from bitpredator/dev
bitpredator Aug 4, 2024
06a73d6
Merge pull request #768 from bitpredator/dev
bitpredator Aug 4, 2024
e730f82
Merge pull request #769 from bitpredator/dev
bitpredator Aug 4, 2024
17c4e8c
Merge pull request #770 from bitpredator/dev
bitpredator Aug 4, 2024
5636315
Merge pull request #771 from bitpredator/dev
bitpredator Aug 4, 2024
e45e32b
Merge pull request #772 from bitpredator/dev
bitpredator Aug 5, 2024
5ff27bc
Merge pull request #773 from bitpredator/dev
bitpredator Aug 5, 2024
e34cb77
Merge pull request #774 from bitpredator/dev
bitpredator Aug 5, 2024
808618a
Merge pull request #776 from bitpredator/dev
bitpredator Aug 6, 2024
1adda81
Merge pull request #777 from bitpredator/dev
bitpredator Aug 7, 2024
918e509
Merge pull request #778 from bitpredator/dev
bitpredator Aug 7, 2024
4196cc5
Merge pull request #779 from bitpredator/dev
bitpredator Aug 8, 2024
8dddb07
Merge pull request #780 from bitpredator/dev
bitpredator Aug 8, 2024
2402383
Merge pull request #781 from bitpredator/dev
bitpredator Aug 8, 2024
8325e63
Merge pull request #782 from bitpredator/dev
bitpredator Aug 9, 2024
8bb83dd
Merge pull request #783 from bitpredator/dev
bitpredator Aug 10, 2024
6b51eb1
Merge branch 'bitpredator:main' into main
busco82 Aug 10, 2024
899f685
sync
busco82 Aug 10, 2024
78f1390
Delete server-data/resources/[esx_addons]/esx_property/properties.json
bitpredator Aug 10, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'TypeScript' ]
language: [ 'javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ function OpenMobileAmmuActionsMenu()
if closestPlayer == -1 or closestDistance > 3.0 then
ESX.ShowNotification(TranslateCap("no_players_near"))
else
TriggerServerEvent("bpt_billing:sendBill", GetPlayerServerId(closestPlayer), "society_ammu", "Ammu", amount)
TriggerServerEvent("bpt_billing:sendBill", GetPlayerServerId(closestPlayer), "society_ammu", TranslateCap("Ammu"), amount)
ESX.ShowNotification(TranslateCap("billing_sent"))
end
end
Expand Down
4 changes: 2 additions & 2 deletions server-data/resources/[bpt_addons]/bpt_crafting/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Config = {
isGun = false,
Jobs = { "ammu" },
JobGrades = {},
Amount = 1,
Amount = 10,
SuccessRate = 100,
requireBlueprint = false,
Time = 30,
Expand All @@ -289,7 +289,7 @@ Config = {
isGun = false,
Jobs = { "ammu" },
JobGrades = {},
Amount = 1,
Amount = 10,
SuccessRate = 100,
requireBlueprint = false,
Time = 30,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ AddEventHandler("bpt_taxijob:getStockItem", function(itemName, count)
local xPlayer = ESX.GetPlayerFromId(source)

if xPlayer.job.name == "taxi" then
TriggerEvent("esx_addoninventory:getSharedInventory", "society_taxi", function(inventory)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_taxi", function(inventory)
local item = inventory.getItem(itemName)

-- is there enough in the society?
Expand All @@ -91,7 +91,7 @@ AddEventHandler("bpt_taxijob:getStockItem", function(itemName, count)
end)

ESX.RegisterServerCallback("bpt_taxijob:getStockItems", function(source, cb)
TriggerEvent("esx_addoninventory:getSharedInventory", "society_taxi", function(inventory)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_taxi", function(inventory)
cb(inventory.items)
end)
end)
Expand All @@ -102,7 +102,7 @@ AddEventHandler("bpt_taxijob:putStockItems", function(itemName, count)
local sourceItem = xPlayer.getInventoryItem(itemName)

if xPlayer.job.name == "taxi" then
TriggerEvent("esx_addoninventory:getSharedInventory", "society_taxi", function(inventory)
TriggerEvent("bpt_addoninventory:getSharedInventory", "society_taxi", function(inventory)
local item = inventory.getItem(itemName)

if sourceItem.count >= count and count > 0 then
Expand Down
Original file line number Diff line number Diff line change
@@ -1,158 +1,158 @@
local function billPlayerByIdentifier(targetIdentifier, senderIdentifier, sharedAccountName, label, amount)
local xTarget = ESX.GetPlayerFromIdentifier(targetIdentifier)
amount = ESX.Math.Round(amount)
if amount <= 0 then
return
end
if string.match(sharedAccountName, "society_") then
return TriggerEvent("esx_addonaccount:getSharedAccount", sharedAccountName, function(account)
if not account then
return print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from invalid society - ^5%s^7"):format(senderIdentifier, sharedAccountName))
end
MySQL.insert.await("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { targetIdentifier, senderIdentifier, "society", sharedAccountName, label, amount })
if not xTarget then
return
end
xTarget.showNotification(TranslateCap("received_invoice"))
end)
end
MySQL.insert.await("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { targetIdentifier, senderIdentifier, "player", senderIdentifier, label, amount })
if not xTarget then
return
end
xTarget.showNotification(TranslateCap("received_invoice"))
end
local function billPlayer(targetId, senderIdentifier, sharedAccountName, label, amount)
local xTarget = ESX.GetPlayerFromId(targetId)
if not xTarget then
return
end
billPlayerByIdentifier(xTarget.identifier, senderIdentifier, sharedAccountName, label, amount)
end
RegisterNetEvent("bpt_billing:sendBill", function(targetId, sharedAccountName, label, amount)
local xPlayer = ESX.GetPlayerFromId(source)
local jobName = string.gsub(sharedAccountName, "society_", "")
if xPlayer.job.name ~= jobName then
return print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName))
end
billPlayer(targetId, xPlayer.identifier, sharedAccountName, label, amount)
end)
exports("BillPlayer", billPlayer)
RegisterNetEvent("bpt_billing_billing:sendBillToIdentifier", function(targetIdentifier, sharedAccountName, label, amount)
local xPlayer = ESX.GetPlayerFromId(source)
local jobName = string.gsub(sharedAccountName, "society_", "")
if xPlayer.job.name ~= jobName then
return print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName))
end
billPlayerByIdentifier(targetIdentifier, xPlayer.identifier, sharedAccountName, label, amount)
end)
exports("BillPlayerByIdentifier", billPlayerByIdentifier)
ESX.RegisterServerCallback("bpt_billing:getBills", function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
local result = MySQL.query.await("SELECT amount, id, label FROM billing WHERE identifier = ?", { xPlayer.identifier })
cb(result)
end)
ESX.RegisterServerCallback("bpt_billing:getTargetBills", function(source, cb, target)
local xPlayer = ESX.GetPlayerFromId(target)
if not xPlayer then
return cb({})
end
local result = MySQL.query.await("SELECT amount, id, label FROM billing WHERE identifier = ?", { xPlayer.identifier })
cb(result)
end)
ESX.RegisterServerCallback("bpt_billing:payBill", function(source, cb, billId)
local xPlayer = ESX.GetPlayerFromId(source)
local result = MySQL.single.await("SELECT sender, target_type, target, amount FROM billing WHERE id = ?", { billId })
if not result then
return
end
local amount = result.amount
local xTarget = ESX.GetPlayerFromIdentifier(result.sender)
if result.target_type == "player" then
if not xTarget then
xPlayer.showNotification(TranslateCap("player_not_online"))
return cb()
end
local paymentAccount = "money"
if xPlayer.getMoney() < amount then
paymentAccount = "bank"
if xPlayer.getAccount("bank").money < amount then
xTarget.showNotification(TranslateCap("target_no_money"))
xPlayer.showNotification(TranslateCap("no_money"))
return cb()
end
end
local rowsChanged = MySQL.update.await("DELETE FROM billing WHERE id = ?", { billId })
if rowsChanged ~= 1 then
return cb()
end
xPlayer.removeAccountMoney(paymentAccount, amount, "Bill Paid")
xTarget.addAccountMoney(paymentAccount, amount, "Paid bill")
local groupedDigits = ESX.Math.GroupDigits(amount)
xPlayer.showNotification(TranslateCap("paid_invoice", groupedDigits))
xTarget.showNotification(TranslateCap("received_payment", groupedDigits))
return cb(true)
end
TriggerEvent("esx_addonaccount:getSharedAccount", result.target, function(account)
local paymentAccount = "money"
if xPlayer.getMoney() < amount then
paymentAccount = "bank"
if xPlayer.getAccount("bank").money < amount then
xTarget.showNotification(TranslateCap("target_no_money"))
xPlayer.showNotification(TranslateCap("no_money"))
return cb()
end
end
local rowsChanged = MySQL.update.await("DELETE FROM billing WHERE id = ?", { billId })
if rowsChanged ~= 1 then
return cb()
end
xPlayer.removeAccountMoney(paymentAccount, amount, "Bill Paid")
account.addMoney(amount)
TriggerEvent("bpt_billing:paidBill", source, billId)
local groupedDigits = ESX.Math.GroupDigits(amount)
xPlayer.showNotification(TranslateCap("paid_invoice", groupedDigits))
if xTarget then
xTarget.showNotification(TranslateCap("received_payment", groupedDigits))
end
cb(true)
end)
end)
local function billPlayerByIdentifier(targetIdentifier, senderIdentifier, sharedAccountName, label, amount)
local xTarget = ESX.GetPlayerFromIdentifier(targetIdentifier)
amount = ESX.Math.Round(amount)

if amount <= 0 then
return
end

if string.match(sharedAccountName, "society_") then
return TriggerEvent("bpt_addonaccount:getSharedAccount", sharedAccountName, function(account)
if not account then
return print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from invalid society - ^5%s^7"):format(senderIdentifier, sharedAccountName))
end

MySQL.insert.await("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { targetIdentifier, senderIdentifier, "society", sharedAccountName, label, amount })

if not xTarget then
return
end

xTarget.showNotification(TranslateCap("received_invoice"))
end)
end

MySQL.insert.await("INSERT INTO billing (identifier, sender, target_type, target, label, amount) VALUES (?, ?, ?, ?, ?, ?)", { targetIdentifier, senderIdentifier, "player", senderIdentifier, label, amount })

if not xTarget then
return
end

xTarget.showNotification(TranslateCap("received_invoice"))
end

local function billPlayer(targetId, senderIdentifier, sharedAccountName, label, amount)
local xTarget = ESX.GetPlayerFromId(targetId)

if not xTarget then
return
end

billPlayerByIdentifier(xTarget.identifier, senderIdentifier, sharedAccountName, label, amount)
end

RegisterNetEvent("bpt_billing:sendBill", function(targetId, sharedAccountName, label, amount)
local xPlayer = ESX.GetPlayerFromId(source)
local jobName = string.gsub(sharedAccountName, "society_", "")

if xPlayer.job.name ~= jobName then
return print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName))
end

billPlayer(targetId, xPlayer.identifier, sharedAccountName, label, amount)
end)
exports("BillPlayer", billPlayer)

RegisterNetEvent("bpt_billing:sendBillToIdentifier", function(targetIdentifier, sharedAccountName, label, amount)
local xPlayer = ESX.GetPlayerFromId(source)
local jobName = string.gsub(sharedAccountName, "society_", "")

if xPlayer.job.name ~= jobName then
return print(("[^2ERROR^7] Player ^5%s^7 Attempted to Send bill from a society (^5%s^7), but does not have the correct Job - Possibly Cheats"):format(xPlayer.source, sharedAccountName))
end

billPlayerByIdentifier(targetIdentifier, xPlayer.identifier, sharedAccountName, label, amount)
end)
exports("BillPlayerByIdentifier", billPlayerByIdentifier)

ESX.RegisterServerCallback("bpt_billing:getBills", function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)

local result = MySQL.query.await("SELECT amount, id, label FROM billing WHERE identifier = ?", { xPlayer.identifier })
cb(result)
end)

ESX.RegisterServerCallback("bpt_billing:getTargetBills", function(source, cb, target)
local xPlayer = ESX.GetPlayerFromId(target)

if not xPlayer then
return cb({})
end

local result = MySQL.query.await("SELECT amount, id, label FROM billing WHERE identifier = ?", { xPlayer.identifier })
cb(result)
end)

ESX.RegisterServerCallback("bpt_billing:payBill", function(source, cb, billId)
local xPlayer = ESX.GetPlayerFromId(source)

local result = MySQL.single.await("SELECT sender, target_type, target, amount FROM billing WHERE id = ?", { billId })
if not result then
return
end

local amount = result.amount
local xTarget = ESX.GetPlayerFromIdentifier(result.sender)

if result.target_type == "player" then
if not xTarget then
xPlayer.showNotification(TranslateCap("player_not_online"))
return cb()
end

local paymentAccount = "money"
if xPlayer.getMoney() < amount then
paymentAccount = "bank"
if xPlayer.getAccount("bank").money < amount then
xTarget.showNotification(TranslateCap("target_no_money"))
xPlayer.showNotification(TranslateCap("no_money"))
return cb()
end
end

local rowsChanged = MySQL.update.await("DELETE FROM billing WHERE id = ?", { billId })
if rowsChanged ~= 1 then
return cb()
end

xPlayer.removeAccountMoney(paymentAccount, amount, "Bill Paid")
xTarget.addAccountMoney(paymentAccount, amount, "Paid bill")

local groupedDigits = ESX.Math.GroupDigits(amount)
xPlayer.showNotification(TranslateCap("paid_invoice", groupedDigits))
xTarget.showNotification(TranslateCap("received_payment", groupedDigits))

return cb(true)
end

TriggerEvent("bpt_addonaccount:getSharedAccount", result.target, function(account)
local paymentAccount = "money"
if xPlayer.getMoney() < amount then
paymentAccount = "bank"
if xPlayer.getAccount("bank").money < amount then
xTarget.showNotification(TranslateCap("target_no_money"))
xPlayer.showNotification(TranslateCap("no_money"))
return cb()
end
end

local rowsChanged = MySQL.update.await("DELETE FROM billing WHERE id = ?", { billId })
if rowsChanged ~= 1 then
return cb()
end

xPlayer.removeAccountMoney(paymentAccount, amount, "Bill Paid")
account.addMoney(amount)

TriggerEvent("bpt_billing:paidBill", source, billId)

local groupedDigits = ESX.Math.GroupDigits(amount)
xPlayer.showNotification(TranslateCap("paid_invoice", groupedDigits))

if xTarget then
xTarget.showNotification(TranslateCap("received_payment", groupedDigits))
end

cb(true)
end)
end)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function StartPayCheck()
elseif Config.EnableSocietyPayouts then -- possibly a society
TriggerEvent("esx_society:getSociety", xPlayer.job.name, function(society)
if society ~= nil then -- verified society
TriggerEvent("esx_addonaccount:getSharedAccount", society.account, function(account)
TriggerEvent("bpt_addonaccount:getSharedAccount", society.account, function(account)
if account.money >= salary then -- does the society money to pay its employees?
xPlayer.addAccountMoney("bank", salary, "Paycheck")
account.removeMoney(salary)
Expand Down
Loading
Loading