mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 08:01:24 +00:00
feat(es_extended): Added Reasons for Account Changes
This commit is contained in:
@@ -40,7 +40,7 @@ end, false, {help = _U('command_cardel'), validate = false, arguments = {
|
||||
|
||||
ESX.RegisterCommand('setaccountmoney', 'admin', function(xPlayer, args, showError)
|
||||
if args.playerId.getAccount(args.account) then
|
||||
args.playerId.setAccountMoney(args.account, args.amount)
|
||||
args.playerId.setAccountMoney(args.account, args.amount, "Government Grant")
|
||||
else
|
||||
showError(_U('command_giveaccountmoney_invalid'))
|
||||
end
|
||||
@@ -52,7 +52,7 @@ end, true, {help = _U('command_setaccountmoney'), validate = true, arguments = {
|
||||
|
||||
ESX.RegisterCommand('giveaccountmoney', 'admin', function(xPlayer, args, showError)
|
||||
if args.playerId.getAccount(args.account) then
|
||||
args.playerId.addAccountMoney(args.account, args.amount)
|
||||
args.playerId.addAccountMoney(args.account, args.amount, "Government Grant")
|
||||
else
|
||||
showError(_U('command_giveaccountmoney_invalid'))
|
||||
end
|
||||
|
||||
@@ -398,8 +398,8 @@ if not Config.OxInventory then
|
||||
end
|
||||
elseif type == 'item_account' then
|
||||
if itemCount > 0 and sourceXPlayer.getAccount(itemName).money >= itemCount then
|
||||
sourceXPlayer.removeAccountMoney(itemName, itemCount)
|
||||
targetXPlayer.addAccountMoney(itemName, itemCount)
|
||||
sourceXPlayer.removeAccountMoney(itemName, itemCount, "Gave to " .. targetXPlayer.name)
|
||||
targetXPlayer.addAccountMoney(itemName, itemCount, "Received from " .. sourceXPlayer.name)
|
||||
|
||||
sourceXPlayer.showNotification(_U('gave_account_money', ESX.Math.GroupDigits(itemCount), Config.Accounts[itemName].label, targetXPlayer.name))
|
||||
targetXPlayer.showNotification(_U('received_account_money', ESX.Math.GroupDigits(itemCount), Config.Accounts[itemName].label,
|
||||
@@ -495,7 +495,7 @@ if not Config.OxInventory then
|
||||
if (itemCount > account.money or account.money < 1) then
|
||||
xPlayer.showNotification(_U('imp_invalid_amount'))
|
||||
else
|
||||
xPlayer.removeAccountMoney(itemName, itemCount)
|
||||
xPlayer.removeAccountMoney(itemName, itemCount, "Threw away")
|
||||
local pickupLabel = ('%s [%s]'):format(account.label, _U('locale_currency', ESX.Math.GroupDigits(itemCount)))
|
||||
ESX.CreatePickup('item_account', itemName, itemCount, pickupLabel, playerId)
|
||||
xPlayer.showNotification(_U('threw_account', ESX.Math.GroupDigits(itemCount), string.lower(account.label)))
|
||||
@@ -551,7 +551,7 @@ if not Config.OxInventory then
|
||||
end
|
||||
elseif pickup.type == 'item_account' then
|
||||
success = true
|
||||
xPlayer.addAccountMoney(pickup.name, pickup.count)
|
||||
xPlayer.addAccountMoney(pickup.name, pickup.count, "Picked up")
|
||||
elseif pickup.type == 'item_weapon' then
|
||||
if xPlayer.hasWeapon(pickup.name) then
|
||||
xPlayer.showNotification(_U('threw_weapon_already'))
|
||||
|
||||
@@ -10,7 +10,7 @@ function StartPayCheck()
|
||||
|
||||
if salary > 0 then
|
||||
if job == 'unemployed' then -- unemployed
|
||||
xPlayer.addAccountMoney('bank', salary)
|
||||
xPlayer.addAccountMoney('bank', salary, "Welfare Check")
|
||||
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_help', salary),
|
||||
'CHAR_BANK_MAZE', 9)
|
||||
elseif Config.EnableSocietyPayouts then -- possibly a society
|
||||
@@ -18,7 +18,7 @@ function StartPayCheck()
|
||||
if society ~= nil then -- verified society
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
|
||||
if account.money >= salary then -- does the society money to pay its employees?
|
||||
xPlayer.addAccountMoney('bank', salary)
|
||||
xPlayer.addAccountMoney('bank', salary, "Paycheck")
|
||||
account.removeMoney(salary)
|
||||
|
||||
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'),
|
||||
@@ -28,13 +28,13 @@ function StartPayCheck()
|
||||
end
|
||||
end)
|
||||
else -- not a society
|
||||
xPlayer.addAccountMoney('bank', salary)
|
||||
xPlayer.addAccountMoney('bank', salary, "Paycheck")
|
||||
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary),
|
||||
'CHAR_BANK_MAZE', 9)
|
||||
end
|
||||
end)
|
||||
else -- generic job
|
||||
xPlayer.addAccountMoney('bank', salary)
|
||||
xPlayer.addAccountMoney('bank', salary, "Paycheck")
|
||||
TriggerClientEvent('esx:showAdvancedNotification', xPlayer.source, _U('bank'), _U('received_paycheck'), _U('received_salary', salary),
|
||||
'CHAR_BANK_MAZE', 9)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user