mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-03 03:38:50 +00:00
Fix inventory limit + move paycheck in separate file
This commit is contained in:
@@ -15,6 +15,7 @@ server_scripts {
|
||||
'server/common.lua',
|
||||
'server/classes/player.lua',
|
||||
'server/functions.lua',
|
||||
'server/paycheck.lua',
|
||||
'server/main.lua',
|
||||
'server/commands.lua'
|
||||
}
|
||||
|
||||
@@ -177,31 +177,6 @@ ESX.StartDBSync = function()
|
||||
|
||||
end
|
||||
|
||||
ESX.StartPayCheck = function()
|
||||
|
||||
function payCheck()
|
||||
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
|
||||
|
||||
if xPlayer.job.grade_salary > 0 then
|
||||
xPlayer.addMoney(xPlayer.job.grade_salary)
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rec_salary') .. '~g~$' .. xPlayer.job.grade_salary)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
SetTimeout(Config.PaycheckInterval, payCheck)
|
||||
|
||||
end
|
||||
|
||||
SetTimeout(Config.PaycheckInterval, payCheck)
|
||||
|
||||
end
|
||||
|
||||
ESX.GetPlayers = function()
|
||||
|
||||
local sources = {}
|
||||
|
||||
@@ -305,7 +305,7 @@ AddEventHandler('esx:giveInventoryItem', function(target, type, itemName, itemCo
|
||||
|
||||
if itemCount > 0 and sourceItem.count >= itemCount then
|
||||
|
||||
if targetItem.limit ~= -1 and (targetItem.count + sourceItem.count) > targetItem.limit then
|
||||
if targetItem.limit ~= -1 and (targetItem.count + itemCount) > targetItem.limit then
|
||||
TriggerClientEvent('esx:showNotification', target, _U('ex_inv_lim') .. targetXPlayer.name)
|
||||
else
|
||||
sourceXPlayer.removeInventoryItem(itemName, itemCount)
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
ESX.StartPayCheck = function()
|
||||
|
||||
function payCheck()
|
||||
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
|
||||
for i=1, #xPlayers, 1 do
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
|
||||
|
||||
if xPlayer.job.grade_salary > 0 then
|
||||
xPlayer.addMoney(xPlayer.job.grade_salary)
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rec_salary') .. '~g~$' .. xPlayer.job.grade_salary)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
SetTimeout(Config.PaycheckInterval, payCheck)
|
||||
|
||||
end
|
||||
|
||||
SetTimeout(Config.PaycheckInterval, payCheck)
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user