mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
Merge branch 'esx-framework:main' into main
This commit is contained in:
+3
-1
@@ -399,7 +399,9 @@ CREATE TABLE `users` (
|
||||
`is_dead` tinyint(1) DEFAULT 0,
|
||||
`id` int(11) NOT NULL,
|
||||
`disabled` TINYINT(1) NULL DEFAULT '0',
|
||||
`last_property` varchar(255) DEFAULT NULL
|
||||
`last_property` varchar(255) DEFAULT NULL,
|
||||
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`last_seen` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -692,6 +692,12 @@ function ESX.Game.GetVehicleProperties(vehicle)
|
||||
customPrimaryColor = {r, g, b}
|
||||
end
|
||||
|
||||
local customXenonColorR, customXenonColorG, customXenonColorB = GetVehicleXenonLightsCustomColor(vehicle)
|
||||
local customXenonColor = nil
|
||||
if customXenonColorR and customXenonColorG and customXenonColorB then
|
||||
customXenonColor = {customXenonColorR, customXenonColorG, customXenonColorB}
|
||||
end
|
||||
|
||||
local hasCustomSecondaryColor = GetIsVehicleSecondaryColourCustom(vehicle)
|
||||
local customSecondaryColor = nil
|
||||
if hasCustomSecondaryColor then
|
||||
@@ -771,6 +777,7 @@ function ESX.Game.GetVehicleProperties(vehicle)
|
||||
wheels = GetVehicleWheelType(vehicle),
|
||||
windowTint = GetVehicleWindowTint(vehicle),
|
||||
xenonColor = GetVehicleXenonLightsColor(vehicle),
|
||||
customXenonColor = customXenonColor,
|
||||
|
||||
neonEnabled = {IsVehicleNeonLightEnabled(vehicle, 0), IsVehicleNeonLightEnabled(vehicle, 1),
|
||||
IsVehicleNeonLightEnabled(vehicle, 2), IsVehicleNeonLightEnabled(vehicle, 3)},
|
||||
@@ -912,6 +919,10 @@ function ESX.Game.SetVehicleProperties(vehicle, props)
|
||||
if props.xenonColor then
|
||||
SetVehicleXenonLightsColor(vehicle, props.xenonColor)
|
||||
end
|
||||
if props.customXenonColor then
|
||||
SetVehicleXenonLightsCustomColor(vehicle, props.customXenonColor[1], props.customXenonColor[2],
|
||||
props.customXenonColor[3])
|
||||
end
|
||||
if props.modSmokeEnabled then
|
||||
ToggleVehicleMod(vehicle, 20, true)
|
||||
end
|
||||
|
||||
@@ -43,16 +43,17 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
end,
|
||||
|
||||
setAccountMoney = function(self)
|
||||
return function(accountName,money)
|
||||
return function(accountName,money, reason)
|
||||
reason = reason or 'unknown'
|
||||
if money >= 0 then
|
||||
local account = self.getAccount(accountName)
|
||||
|
||||
if account then
|
||||
local newMoney = ESX.Math.Round(money)
|
||||
account.money = newMoney
|
||||
money = account.round and ESX.Math.Round(money) or money
|
||||
self.accounts[account.index].money = money
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
|
||||
TriggerEvent('esx:setAccountMoney', self.source, accountName, money, reason)
|
||||
if Inventory.accounts[accountName] then
|
||||
Inventory.SetItem(self.source, accountName, money)
|
||||
end
|
||||
@@ -62,16 +63,16 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
end,
|
||||
|
||||
addAccountMoney = function(self)
|
||||
return function(accountName,money)
|
||||
return function(accountName,money, reason)
|
||||
reason = reason or 'unknown'
|
||||
if money > 0 then
|
||||
local account = self.getAccount(accountName)
|
||||
|
||||
if account then
|
||||
local newMoney = account.money + ESX.Math.Round(money)
|
||||
account.money = newMoney
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
|
||||
money = account.round and ESX.Math.Round(money) or money
|
||||
self.accounts[account.index].money += money
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:addAccountMoney', self.source, accountName, money, reason)
|
||||
if Inventory.accounts[accountName] then
|
||||
Inventory.AddItem(self.source, accountName, money)
|
||||
end
|
||||
@@ -81,16 +82,16 @@ Core.PlayerFunctionOverrides.OxInventory = {
|
||||
end,
|
||||
|
||||
removeAccountMoney = function(self)
|
||||
return function(accountName,money)
|
||||
return function(accountName,money, reason)
|
||||
reason = reason or 'unknown'
|
||||
if money > 0 then
|
||||
local account = self.getAccount(accountName)
|
||||
|
||||
if account then
|
||||
local newMoney = account.money - ESX.Math.Round(money)
|
||||
account.money = newMoney
|
||||
|
||||
money = account.round and ESX.Math.Round(money) or money
|
||||
self.accounts[account.index].money -= money
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
|
||||
TriggerEvent('esx:removeAccountMoney', self.source, accountName, money, reason)
|
||||
if Inventory.accounts[accountName] then
|
||||
Inventory.RemoveItem(self.source, accountName, money)
|
||||
end
|
||||
|
||||
@@ -60,14 +60,14 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
return self.getAccount('money').money
|
||||
end
|
||||
|
||||
function self.addMoney(money)
|
||||
function self.addMoney(money, reason)
|
||||
money = ESX.Math.Round(money)
|
||||
self.addAccountMoney('money', money)
|
||||
self.addAccountMoney('money', money, reason)
|
||||
end
|
||||
|
||||
function self.removeMoney(money)
|
||||
function self.removeMoney(money, reason)
|
||||
money = ESX.Math.Round(money)
|
||||
self.removeAccountMoney('money', money)
|
||||
self.removeAccountMoney('money', money, reason)
|
||||
end
|
||||
|
||||
function self.getIdentifier()
|
||||
@@ -171,7 +171,8 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
self.name = newName
|
||||
end
|
||||
|
||||
function self.setAccountMoney(accountName, money)
|
||||
function self.setAccountMoney(accountName, money, reason)
|
||||
reason = reason or 'unknown'
|
||||
if not tonumber(money) then
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number!'):format(accountName, self.playerId))
|
||||
return
|
||||
@@ -184,6 +185,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
self.accounts[account.index].money = money
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:setAccountMoney', self.source, accountName, money, reason)
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Invalid Account ^5%s^0 For Player ^5%s^0!'):format(accountName, self.playerId))
|
||||
end
|
||||
@@ -192,7 +194,8 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
function self.addAccountMoney(accountName, money)
|
||||
function self.addAccountMoney(accountName, money, reason)
|
||||
reason = reason or 'Unknown'
|
||||
if not tonumber(money) then
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number!'):format(accountName, self.playerId))
|
||||
return
|
||||
@@ -204,6 +207,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
self.accounts[account.index].money += money
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:addAccountMoney', self.source, accountName, money, reason)
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!'):format(accountName, self.playerId))
|
||||
end
|
||||
@@ -212,7 +216,8 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
end
|
||||
end
|
||||
|
||||
function self.removeAccountMoney(accountName, money)
|
||||
function self.removeAccountMoney(accountName, money, reason)
|
||||
reason = reason or 'Unknown'
|
||||
if not tonumber(money) then
|
||||
print(('[^1ERROR^7] Tried To Set Account ^5%s^0 For Player ^5%s^0 To An Invalid Number!'):format(accountName, self.playerId))
|
||||
return
|
||||
@@ -225,6 +230,7 @@ function CreateExtendedPlayer(playerId, identifier, group, accounts, inventory,
|
||||
self.accounts[account.index].money -= money
|
||||
|
||||
self.triggerEvent('esx:setAccountMoney', account)
|
||||
TriggerEvent('esx:removeAccountMoney', self.source, accountName, money, reason)
|
||||
else
|
||||
print(('[^1ERROR^7] Tried To Set Add To Invalid Account ^5%s^0 For Player ^5%s^0!'):format(accountName, self.playerId))
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -12,7 +12,9 @@ CreateThread(function()
|
||||
name = name,
|
||||
data = data
|
||||
})
|
||||
SetTimeout(200, function()
|
||||
SetNuiFocus(true, true)
|
||||
end)
|
||||
end
|
||||
|
||||
local function closeMenu(namespace, name)
|
||||
@@ -58,4 +60,4 @@ CreateThread(function()
|
||||
cb('OK')
|
||||
end)
|
||||
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -2,7 +2,7 @@ RegisterServerEvent('esx_accessories:pay')
|
||||
AddEventHandler('esx_accessories:pay', function()
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeMoney(Config.Price)
|
||||
xPlayer.removeMoney(Config.Price, "Accessory Purchase")
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_paid', ESX.Math.GroupDigits(Config.Price)))
|
||||
end)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ AddEventHandler('esx_ambulancejob:revive', function(playerId)
|
||||
if deadPlayers[playerId] then
|
||||
if Config.ReviveReward > 0 then
|
||||
xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward))
|
||||
xPlayer.addMoney(Config.ReviveReward)
|
||||
xPlayer.addMoney(Config.ReviveReward, "Revive Reward")
|
||||
xTarget.triggerEvent('esx_ambulancejob:revive')
|
||||
else
|
||||
xPlayer.showNotification(_U('revive_complete', xTarget.name))
|
||||
@@ -142,11 +142,11 @@ ESX.RegisterServerCallback('esx_ambulancejob:removeItemsAfterRPDeath', function(
|
||||
|
||||
if Config.RemoveCashAfterRPDeath then
|
||||
if xPlayer.getMoney() > 0 then
|
||||
xPlayer.removeMoney(xPlayer.getMoney())
|
||||
xPlayer.removeMoney(xPlayer.getMoney(), "Death")
|
||||
end
|
||||
|
||||
if xPlayer.getAccount('black_money').money > 0 then
|
||||
xPlayer.setAccountMoney('black_money', 0)
|
||||
xPlayer.setAccountMoney('black_money', 0, "Death")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -198,7 +198,7 @@ if Config.EarlyRespawnFine then
|
||||
local fineAmount = Config.EarlyRespawnFineAmount
|
||||
|
||||
xPlayer.showNotification(_U('respawn_bleedout_fine_msg', ESX.Math.GroupDigits(fineAmount)))
|
||||
xPlayer.removeAccountMoney('bank', fineAmount)
|
||||
xPlayer.removeAccountMoney('bank', fineAmount, "Respawn Fine")
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -218,7 +218,7 @@ ESX.RegisterServerCallback('esx_ambulancejob:buyJobVehicle', function(source, cb
|
||||
cb(false)
|
||||
else
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.removeMoney(price, "Job Vehicle Purchase")
|
||||
|
||||
MySQL.insert('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (?, ?, ?, ?, ?, ?)', {xPlayer.identifier, json.encode(vehicleProps), vehicleProps.plate, type, xPlayer.job.name, true},
|
||||
function (rowsChanged)
|
||||
|
||||
@@ -3,7 +3,7 @@ AddEventHandler('esx_barbershop:pay', function()
|
||||
local source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
xPlayer.removeMoney(Config.Price)
|
||||
xPlayer.removeMoney(Config.Price, "Haircut")
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_paid', ESX.Math.GroupDigits(Config.Price)))
|
||||
end)
|
||||
|
||||
|
||||
@@ -58,8 +58,8 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, billId)
|
||||
MySQL.update('DELETE FROM billing WHERE id = ?', {billId},
|
||||
function(rowsChanged)
|
||||
if rowsChanged == 1 then
|
||||
xPlayer.removeMoney(amount)
|
||||
xTarget.addMoney(amount)
|
||||
xPlayer.removeMoney(amount, "Bill Paid")
|
||||
xTarget.addMoney(amount, "Paid bill")
|
||||
|
||||
xPlayer.showNotification(_U('paid_invoice', ESX.Math.GroupDigits(amount)))
|
||||
xTarget.showNotification(_U('received_payment', ESX.Math.GroupDigits(amount)))
|
||||
@@ -71,8 +71,8 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, billId)
|
||||
MySQL.update('DELETE FROM billing WHERE id = ?', {billId},
|
||||
function(rowsChanged)
|
||||
if rowsChanged == 1 then
|
||||
xPlayer.removeAccountMoney('bank', amount)
|
||||
xTarget.addAccountMoney('bank', amount)
|
||||
xPlayer.removeAccountMoney('bank', amount, "Bill Paid")
|
||||
xTarget.addAccountMoney('bank', amount, "Paid bill")
|
||||
|
||||
xPlayer.showNotification(_U('paid_invoice', ESX.Math.GroupDigits(amount)))
|
||||
xTarget.showNotification(_U('received_payment', ESX.Math.GroupDigits(amount)))
|
||||
@@ -95,7 +95,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, billId)
|
||||
MySQL.update('DELETE FROM billing WHERE id = ?', {billId},
|
||||
function(rowsChanged)
|
||||
if rowsChanged == 1 then
|
||||
xPlayer.removeMoney(amount)
|
||||
xPlayer.removeMoney(amount, "Bill Paid")
|
||||
account.addMoney(amount)
|
||||
|
||||
xPlayer.showNotification(_U('paid_invoice', ESX.Math.GroupDigits(amount)))
|
||||
@@ -110,7 +110,7 @@ ESX.RegisterServerCallback('esx_billing:payBill', function(source, cb, billId)
|
||||
MySQL.update('DELETE FROM billing WHERE id = ?', {billId},
|
||||
function(rowsChanged)
|
||||
if rowsChanged == 1 then
|
||||
xPlayer.removeAccountMoney('bank', amount)
|
||||
xPlayer.removeAccountMoney('bank', amount, "Bill Paid")
|
||||
account.addMoney(amount)
|
||||
xPlayer.showNotification(_U('paid_invoice', ESX.Math.GroupDigits(amount)))
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ ESX.RegisterServerCallback('esx_boat:buyBoat', function(source, cb, vehicleProps
|
||||
cb(false)
|
||||
else
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.removeMoney(price, "Boat Purchase")
|
||||
|
||||
MySQL.update('INSERT INTO owned_vehicles (owner, plate, vehicle, type, `stored`) VALUES (@owner, @plate, @vehicle, @type, @stored)', {
|
||||
['@owner'] = xPlayer.identifier,
|
||||
@@ -92,7 +92,7 @@ ESX.RegisterServerCallback('esx_boat:buyBoatLicense', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.getMoney() >= Config.LicensePrice then
|
||||
xPlayer.removeMoney(Config.LicensePrice)
|
||||
xPlayer.removeMoney(Config.LicensePrice, "Boat License Purchase")
|
||||
|
||||
TriggerEvent('esx_license:addLicense', source, 'boat', function()
|
||||
cb(true)
|
||||
|
||||
@@ -23,7 +23,7 @@ ESX.RegisterServerCallback('esx_clotheshop:buyClothes', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.getMoney() >= Config.Price then
|
||||
xPlayer.removeMoney(Config.Price)
|
||||
xPlayer.removeMoney(Config.Price, "Outfit Purchase")
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_paid', Config.Price))
|
||||
cb(true)
|
||||
else
|
||||
|
||||
@@ -2,7 +2,7 @@ ESX.RegisterServerCallback('esx_dmvschool:canYouPay', function(source, cb, type)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.getMoney() >= Config.Prices[type] then
|
||||
xPlayer.removeMoney(Config.Prices[type])
|
||||
xPlayer.removeMoney(Config.Prices[type], "DMV Purchase")
|
||||
TriggerClientEvent('esx:showNotification', source, _U('you_paid', Config.Prices[type]))
|
||||
cb(true)
|
||||
else
|
||||
|
||||
@@ -21,9 +21,9 @@ AddEventHandler('esx_drugs:sellDrug', function(itemName, amount)
|
||||
price = ESX.Math.Round(price * amount)
|
||||
|
||||
if Config.GiveBlack then
|
||||
xPlayer.addAccountMoney('black_money', price)
|
||||
xPlayer.addAccountMoney('black_money', price, "Drugs Sold")
|
||||
else
|
||||
xPlayer.addMoney(price)
|
||||
xPlayer.addMoney(price, "Drugs Sold")
|
||||
end
|
||||
|
||||
xPlayer.removeInventoryItem(xItem.name, amount)
|
||||
|
||||
@@ -129,7 +129,7 @@ AddEventHandler("esx_garage:payPound", function(amount)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.getMoney() >= amount then
|
||||
xPlayer.removeMoney(amount)
|
||||
xPlayer.removeMoney(amount, "Impound Fee")
|
||||
xPlayer.showNotification(_U('pay_Impound_bill', amount))
|
||||
else
|
||||
xPlayer.showNotification(_U('missing_money'))
|
||||
|
||||
@@ -46,9 +46,9 @@ AddEventHandler('esx_holdup:robberyStarted', function(currentStore)
|
||||
if xPlayer then
|
||||
TriggerClientEvent('esx_holdup:robberyComplete', source, store.reward)
|
||||
if Config.GiveBlackMoney then
|
||||
xPlayer.addAccountMoney('black_money', store.reward)
|
||||
xPlayer.addAccountMoney('black_money', store.reward, "Robbery")
|
||||
else
|
||||
xPlayer.addMoney(store.reward)
|
||||
xPlayer.addMoney(store.reward, "Robbery")
|
||||
end
|
||||
local xPlayers = ESX.GetExtendedPlayers('job', 'police')
|
||||
for i=1, #(xPlayers) do
|
||||
|
||||
@@ -50,7 +50,7 @@ CreateThread(function()
|
||||
end
|
||||
end
|
||||
else
|
||||
xPlayer.addMoney(v.price)
|
||||
xPlayer.addMoney(v.price, "Job Payment")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -108,7 +108,7 @@ RegisterNetEvent('esx_jobs:caution', function(cautionType, cautionAmount, spawnP
|
||||
if cautionAmount <= Config.MaxCaution and cautionAmount >= 0 then
|
||||
TriggerEvent('esx_addonaccount:getAccount', 'caution', xPlayer.identifier, function(account)
|
||||
if xPlayer.getAccount('bank').money >= cautionAmount then
|
||||
xPlayer.removeAccountMoney('bank', cautionAmount)
|
||||
xPlayer.removeAccountMoney('bank', cautionAmount, "Caution Fine")
|
||||
account.addMoney(cautionAmount)
|
||||
xPlayer.showNotification(_U('bank_deposit_taken', ESX.Math.GroupDigits(cautionAmount)))
|
||||
TriggerClientEvent('esx_jobs:spawnJobVehicle', xPlayer.source, spawnPoint, vehicle)
|
||||
@@ -123,7 +123,7 @@ RegisterNetEvent('esx_jobs:caution', function(cautionType, cautionAmount, spawnP
|
||||
local caution = account.money
|
||||
local toGive = ESX.Math.Round(caution * cautionAmount)
|
||||
|
||||
xPlayer.addAccountMoney('bank', toGive)
|
||||
xPlayer.addAccountMoney('bank', toGive, "Caution Return")
|
||||
account.removeMoney(toGive)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('bank_deposit_returned', ESX.Math.GroupDigits(toGive)))
|
||||
end)
|
||||
|
||||
@@ -25,7 +25,7 @@ AddEventHandler('esx_lscustom:buyMod', function(price)
|
||||
if price < xPlayer.getMoney() then
|
||||
TriggerClientEvent('esx_lscustom:installMod', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('purchased'))
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.removeMoney(price, "LSC Purchase")
|
||||
else
|
||||
TriggerClientEvent('esx_lscustom:cancelInstallMod', source)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('not_enough_money'))
|
||||
|
||||
@@ -43,8 +43,8 @@ AddEventHandler('esx_policejob:confiscatePlayerItem', function(target, itemType,
|
||||
|
||||
-- does the target player have enough money?
|
||||
if targetAccount.money >= amount then
|
||||
targetXPlayer.removeAccountMoney(itemName, amount)
|
||||
sourceXPlayer.addAccountMoney (itemName, amount)
|
||||
targetXPlayer.removeAccountMoney(itemName, amount, "Confiscated")
|
||||
sourceXPlayer.addAccountMoney (itemName, amount, "Confiscated")
|
||||
|
||||
sourceXPlayer.showNotification(_U('you_confiscated_account', amount, itemName, targetXPlayer.name))
|
||||
targetXPlayer.showNotification(_U('got_confiscated_account', amount, itemName, sourceXPlayer.name))
|
||||
@@ -320,7 +320,7 @@ ESX.RegisterServerCallback('esx_policejob:buyWeapon', function(source, cb, weapo
|
||||
-- Weapon
|
||||
if type == 1 then
|
||||
if xPlayer.getMoney() >= selectedWeapon.price then
|
||||
xPlayer.removeMoney(selectedWeapon.price)
|
||||
xPlayer.removeMoney(selectedWeapon.price, "Weapon Bought")
|
||||
xPlayer.addWeapon(weaponName, 100)
|
||||
|
||||
cb(true)
|
||||
@@ -336,7 +336,7 @@ ESX.RegisterServerCallback('esx_policejob:buyWeapon', function(source, cb, weapo
|
||||
|
||||
if component then
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.removeMoney(price, "Weapon Component Bought")
|
||||
xPlayer.addWeaponComponent(weaponName, component.name)
|
||||
|
||||
cb(true)
|
||||
@@ -361,7 +361,7 @@ ESX.RegisterServerCallback('esx_policejob:buyJobVehicle', function(source, cb, v
|
||||
cb(false)
|
||||
else
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.removeMoney(price, "Job Vehicle Bought")
|
||||
|
||||
MySQL.insert('INSERT INTO owned_vehicles (owner, vehicle, plate, type, job, `stored`) VALUES (?, ?, ?, ?, ?, ?)', { xPlayer.identifier, json.encode(vehicleProps), vehicleProps.plate, type, xPlayer.job.name, true},
|
||||
function (rowsChanged)
|
||||
|
||||
@@ -180,7 +180,7 @@ ESX.RegisterServerCallback("esx_property:buyProperty", function(source, cb, Prop
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local Price = Properties[PropertyId].Price
|
||||
if xPlayer.getAccount("bank").money >= Price then
|
||||
xPlayer.removeAccountMoney("bank", Price)
|
||||
xPlayer.removeAccountMoney("bank", Price, "Bought Property")
|
||||
Properties[PropertyId].Owner = xPlayer.identifier
|
||||
Properties[PropertyId].OwnerName = xPlayer.getName()
|
||||
Properties[PropertyId].Owned = true
|
||||
@@ -200,7 +200,7 @@ ESX.RegisterServerCallback("esx_property:attemptSellToPlayer", function(source,
|
||||
local xTarget = ESX.GetPlayerFromId(PlayerId)
|
||||
local Price = Properties[PropertyId].Price
|
||||
if xTarget and (xTarget.getAccount("bank").money >= Price) and (xPlayer.job.name == PM.job) then
|
||||
xPlayer.removeAccountMoney("bank", Price)
|
||||
xTarget.removeAccountMoney("bank", Price, "Sold Property")
|
||||
Properties[PropertyId].Owner = xTarget.identifier
|
||||
Properties[PropertyId].OwnerName = xTarget.getName()
|
||||
Properties[PropertyId].Owned = true
|
||||
@@ -218,7 +218,7 @@ ESX.RegisterServerCallback("esx_property:attemptSellToPlayer", function(source,
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', PM.society, function(account)
|
||||
account.addMoney(SocietyPrice)
|
||||
end)
|
||||
xPlayer.addAccountMoney("bank", PlayerPrice)
|
||||
xPlayer.addAccountMoney("bank", PlayerPrice, "Sold Property")
|
||||
end
|
||||
end
|
||||
cb(xPlayer.getAccount("bank").money >= Price)
|
||||
@@ -231,7 +231,7 @@ ESX.RegisterServerCallback("esx_property:buyFurniture", function(source, cb, Pro
|
||||
if xPlayer.identifier == Owner or IsPlayerAdmin(source) or (Properties[PropertyId].Keys and Properties[PropertyId].Keys[xPlayer.identifier]) then
|
||||
local Price = Config.FurnitureCatagories[PropCatagory][PropIndex].price
|
||||
if xPlayer.getAccount("bank").money >= Price then
|
||||
xPlayer.removeAccountMoney("bank", Price)
|
||||
xPlayer.removeAccountMoney("bank", Price, "Furniture")
|
||||
cb(true)
|
||||
local furniture = {Name = PropName, Index = PropIndex, Catagory = PropCatagory, Pos = pos, Heading = heading, Price = Price}
|
||||
table.insert(Properties[PropertyId].furniture, furniture)
|
||||
@@ -265,7 +265,7 @@ ESX.RegisterServerCallback("esx_property:sellProperty", function(source, cb, Pro
|
||||
local Owner = Properties[PropertyId].Owner
|
||||
if xPlayer.identifier == Owner then
|
||||
local Price = ESX.Math.Round(Properties[PropertyId].Price * 0.6)
|
||||
xPlayer.addAccountMoney("bank", Price)
|
||||
xPlayer.addAccountMoney("bank", Price, "Sold Property")
|
||||
Properties[PropertyId].Owner = ""
|
||||
Properties[PropertyId].OwnerName = ""
|
||||
Properties[PropertyId].Owned = false
|
||||
|
||||
@@ -43,7 +43,7 @@ AddEventHandler('esx_shops:buyItem', function(itemName, amount, zone)
|
||||
if xPlayer.getMoney() >= price then
|
||||
-- can the player carry the said amount of x item?
|
||||
if xPlayer.canCarryItem(itemName, amount) then
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.removeMoney(price, label .. " Purchase")
|
||||
xPlayer.addInventoryItem(itemName, amount)
|
||||
xPlayer.showNotification(_U('bought', amount, label, ESX.Math.GroupDigits(price)))
|
||||
else
|
||||
|
||||
@@ -72,7 +72,7 @@ AddEventHandler('esx_society:withdrawMoney', function(societyName, amount)
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
|
||||
if amount > 0 and account.money >= amount then
|
||||
account.removeMoney(amount)
|
||||
xPlayer.addMoney(amount)
|
||||
xPlayer.addMoney(amount, "Society Withdraw")
|
||||
xPlayer.showNotification(_U('have_withdrawn', ESX.Math.GroupDigits(amount)))
|
||||
else
|
||||
xPlayer.showNotification(_U('invalid_amount'))
|
||||
@@ -97,7 +97,7 @@ AddEventHandler('esx_society:depositMoney', function(societyName, amount)
|
||||
if xPlayer.job.name == society.name then
|
||||
if amount > 0 and xPlayer.getMoney() >= amount then
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
|
||||
xPlayer.removeMoney(amount)
|
||||
xPlayer.removeMoney(amount, "Society Deposit")
|
||||
xPlayer.showNotification(_U('have_deposited', ESX.Math.GroupDigits(amount)))
|
||||
account.addMoney(amount)
|
||||
end)
|
||||
@@ -118,7 +118,7 @@ AddEventHandler('esx_society:washMoney', function(society, amount)
|
||||
|
||||
if xPlayer.job.name == society then
|
||||
if amount and amount > 0 and account.money >= amount then
|
||||
xPlayer.removeAccountMoney('black_money', amount)
|
||||
xPlayer.removeAccountMoney('black_money', amount, "Washing")
|
||||
|
||||
MySQL.insert('INSERT INTO society_moneywash (identifier, society, amount) VALUES (?, ?, ?)', {xPlayer.identifier, society, amount},
|
||||
function(rowsChanged)
|
||||
|
||||
@@ -30,12 +30,12 @@ AddEventHandler('esx_taxijob:success', function()
|
||||
local playerMoney = ESX.Math.Round(total / 100 * 30)
|
||||
local societyMoney = ESX.Math.Round(total / 100 * 70)
|
||||
|
||||
xPlayer.addMoney(playerMoney)
|
||||
xPlayer.addMoney(playerMoney, "Taxi Fair")
|
||||
account.addMoney(societyMoney)
|
||||
|
||||
xPlayer.showNotification(_U('comp_earned', societyMoney, playerMoney))
|
||||
else
|
||||
xPlayer.addMoney(total)
|
||||
xPlayer.addMoney(total, "Taxi Fair")
|
||||
xPlayer.showNotification(_U('have_earned', total))
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -167,7 +167,7 @@ ESX.RegisterServerCallback('esx_vehicleshop:buyVehicle', function(source, cb, mo
|
||||
local modelPrice = getVehicleFromModel(model).price
|
||||
|
||||
if modelPrice and xPlayer.getMoney() >= modelPrice then
|
||||
xPlayer.removeMoney(modelPrice)
|
||||
xPlayer.removeMoney(modelPrice, "Vehicle Purchase")
|
||||
|
||||
MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xPlayer.identifier, plate, json.encode({model = joaat(model), plate = plate})
|
||||
}, function(rowsChanged)
|
||||
@@ -302,7 +302,7 @@ ESX.RegisterServerCallback('esx_vehicleshop:resellVehicle', function(source, cb,
|
||||
|
||||
if vehicle.model == model then
|
||||
if vehicle.plate == plate then
|
||||
xPlayer.addMoney(resellPrice)
|
||||
xPlayer.addMoney(resellPrice, "Sold Vehicle")
|
||||
RemoveOwnedVehicle(plate)
|
||||
cb(true)
|
||||
else
|
||||
@@ -393,14 +393,14 @@ function PayRent()
|
||||
|
||||
if bank >= sum and #v > 1 then
|
||||
total = total + sum
|
||||
xPlayer.removeAccountMoney('bank', sum)
|
||||
xPlayer.removeAccountMoney('bank', sum, "Vehicle Rental")
|
||||
xPlayer.showNotification(('You have paid $%s for all of your rentals'):format(ESX.Math.GroupDigits(sum)))
|
||||
else
|
||||
for i = 1, #v do
|
||||
local rental = v[i]
|
||||
if xPlayer.getAccount('bank').money >= rental.rent_price then
|
||||
total = total + rental.rent_price
|
||||
xPlayer.removeAccountMoney('bank', rental.rent_price)
|
||||
xPlayer.removeAccountMoney('bank', rental.rent_price, "Vehicle Rental")
|
||||
xPlayer.showNotification(_U('paid_rental', ESX.Math.GroupDigits(rental.rent_price), rental.plate))
|
||||
else
|
||||
xPlayer.showNotification(_U('paid_rental_evicted', ESX.Math.GroupDigits(rental.rent_price), rental.plate))
|
||||
|
||||
@@ -3,7 +3,7 @@ ESX.RegisterServerCallback('esx_weaponshop:buyLicense', function(source, cb)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if xPlayer.getMoney() >= Config.LicensePrice then
|
||||
xPlayer.removeMoney(Config.LicensePrice)
|
||||
xPlayer.removeMoney(Config.LicensePrice, "Weapon License")
|
||||
|
||||
TriggerEvent('esx_license:addLicense', source, 'weapon', function()
|
||||
cb(true)
|
||||
@@ -28,7 +28,7 @@ ESX.RegisterServerCallback('esx_weaponshop:buyWeapon', function(source, cb, weap
|
||||
else
|
||||
if zone == 'BlackWeashop' then
|
||||
if xPlayer.getAccount('black_money').money >= price then
|
||||
xPlayer.removeAccountMoney('black_money', price)
|
||||
xPlayer.removeAccountMoney('black_money', price, "Black Weapons Deal")
|
||||
xPlayer.addWeapon(weaponName, 42)
|
||||
|
||||
cb(true)
|
||||
@@ -38,7 +38,7 @@ ESX.RegisterServerCallback('esx_weaponshop:buyWeapon', function(source, cb, weap
|
||||
end
|
||||
else
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.removeMoney(price, "Weapons Deal")
|
||||
xPlayer.addWeapon(weaponName, 42)
|
||||
|
||||
cb(true)
|
||||
|
||||
+14
-18
@@ -1,15 +1,12 @@
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# #
|
||||
# ███████╗███████╗██╗ ██╗ ██╗ ███████╗ ██████╗ █████╗ ██████╗██╗ ██╗ #
|
||||
# ██╔════╝██╔════╝╚██╗██╔╝ ██║ ██╔════╝██╔════╝ ██╔══██╗██╔════╝╚██╗ ██╔╝ #
|
||||
# █████╗ ███████╗ ╚███╔╝ ██║ █████╗ ██║ ███╗███████║██║ ╚████╔╝ #
|
||||
# ██╔══╝ ╚════██║ ██╔██╗ ██║ ██╔══╝ ██║ ██║██╔══██║██║ ╚██╔╝ #
|
||||
# ███████╗███████║██╔╝ ██╗ ███████╗███████╗╚██████╔╝██║ ██║╚██████╗ ██║ #
|
||||
# ╚══════╝╚══════╝╚═╝ ╚═╝ ╚══════╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ #
|
||||
# Discord: https://discord.gg/kwYdXC4wzb #
|
||||
# Documentation: https://docs.esx-framework.org #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
# ___ _____ __ _ ___ ___ _ _____ __ #
|
||||
# | __/ __\ \/ / | | | __/ __| /_\ / __\ \ / / #
|
||||
# | _|\__ \> < | |__| _| (_ |/ _ \ (__ \ V / #
|
||||
# |___|___/_/\_\ |____|___\___/_/ \_\___| |_| #
|
||||
# #
|
||||
# Discord: https://discord.gg/esx-framework #
|
||||
# Website: https://esx-framework.org/ #
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
# Only change the IP if you're using a server with multiple network interfaces, otherwise change the port only.
|
||||
endpoint_add_tcp "0.0.0.0:30120"
|
||||
@@ -18,18 +15,17 @@ endpoint_add_udp "0.0.0.0:30120"
|
||||
### Endpoints Privacy ###
|
||||
sv_endpointPrivacy true
|
||||
|
||||
sv_hostname "Unconfigured ESX Legacy Server"
|
||||
sv_hostname "Unconfigured | ESX Legacy Server"
|
||||
set steam_webApiKey ""
|
||||
sv_licenseKey ""
|
||||
sv_maxclients 10 # Allow access to features usually locked behind a FiveM patreon key
|
||||
|
||||
sets sv_projectName "ESX Legacy"
|
||||
sets sv_projectDesc "My new ESX Legacy project"
|
||||
sets locale "en-US"
|
||||
sets tags "default, esx, legacy, Roleplay"
|
||||
sets sv_projectName "Unconfigured | ESX Legacy Server"
|
||||
sets sv_projectDesc "The official recipe of the most popular FiveM RP framework, containing Jobs, Housing, Vehicles & more!"
|
||||
sets tags "default, esx, esx legacy, legacy, official, roleplay"
|
||||
sv_scriptHookAllowed 0
|
||||
|
||||
set onesync legacy # Infinity is not recommended for ESX
|
||||
set onesync on # Enable OneSync [REQUIRED FOR LEGACY 1.7.5 +]
|
||||
set mysql_connection_string "mysql://user:password@localhost/es_extended?waitForConnections=true&charset=utf8mb4"
|
||||
set mysql_ui true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user