Improved cron code and readme

This commit is contained in:
ElPumpo
2018-05-07 23:02:02 +02:00
parent 0e107e7679
commit 469f7353b1
3 changed files with 37 additions and 24 deletions
+2 -11
View File
@@ -68,21 +68,12 @@ function CalculateBankSavings (d, h, m)
{ ['@account_name'] = 'bank_savings' },
function (result)
local bankInterests = 0
local xPlayers = ESX.GetPlayers()
for i=1, #result, 1 do
local foundPlayer = false
local xPlayer = nil
local xPlayer = ESX.GetPlayerFromIdentifier(result[i].owner)
for i=1, #xPlayers, 1 do
local xPlayer2 = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer2.identifier == result[i].owner then
foundPlayer = true
xPlayer = xPlayer2
end
end
if foundPlayer then
if xPlayer ~= nil then
TriggerEvent('esx_addonaccount:getAccount', 'bank_savings', xPlayer.identifier, function (account)
local interests = math.floor(account.money / 100 * Config.BankSavingPercentage)
bankInterests = bankInterests + interests