Skip to content

Commit

Permalink
Me again. Looks like I wasn't the only person who was unaware of QBCo…
Browse files Browse the repository at this point in the history
…re.Shared.Round.
  • Loading branch information
mbiddle committed Nov 16, 2024
1 parent 662ebca commit 61d5bdc
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,6 @@ local function escape_sqli(source)
return source:gsub("['\"]", replacements)
end

local function round(num, numDecimalPlaces)
if numDecimalPlaces and numDecimalPlaces > 0 then
local mult = 10 ^ numDecimalPlaces
return math.floor(num * mult + 0.5) / mult
end
return math.floor(num + 0.5)
end

function QBPhone.AddMentionedTweet(citizenid, TweetData)
if MentionedTweets[citizenid] == nil then
MentionedTweets[citizenid] = {}
Expand Down Expand Up @@ -298,7 +290,7 @@ QBCore.Functions.CreateCallback('qb-phone:server:PayInvoice', function(source, c

if exists[1] and exists[1]["count"] == 1 then
if SenderPly and Config.BillingCommissions[society] then
local commission = round(amount * Config.BillingCommissions[society])
local commission = QBCore.Shared.Round(amount * Config.BillingCommissions[society])
SenderPly.Functions.AddMoney('bank', commission)
invoiceMailData = {
sender = 'Billing Department',
Expand Down Expand Up @@ -888,7 +880,7 @@ RegisterNetEvent('qb-phone:server:TransferMoney', function(iban, amount)
end
else
local moneyInfo = json.decode(result[1].money)
moneyInfo.bank = round((moneyInfo.bank + amount))
moneyInfo.bank = QBCore.Shared.Round(moneyInfo.bank + amount)
MySQL.update('UPDATE players SET money = ? WHERE citizenid = ?',
{ json.encode(moneyInfo), result[1].citizenid })
sender.Functions.RemoveMoney('bank', amount, 'phone-transfered')
Expand Down

0 comments on commit 61d5bdc

Please sign in to comment.