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
+33 -12
View File
@@ -1,22 +1,43 @@
# fxserver-esx_bankerjob
FXServer ESX BankerJob
# esx_bankerjob
[REQUIREMENTS]
## Requirements
- cron => https://github.com/FXServer-ESX/fxserver-cron
- esx_addonaccount => https://github.com/FXServer-ESX/fxserver-esx_addonaccount
- esx_society => https://github.com/FXServer-ESX/fxserver-esx_society
- [cron](https://github.com/ESX-Org/cron)
- [esx_addonaccount](https://github.com/ESX-Org/esx_addonaccount)
- [esx_society](https://github.com/ESX-Org/esx_society)
[INSTALLATION]
## Download & Installation
1) CD in your resources/[esx] folder
2) Clone the repository
### Using [fvm](https://github.com/qlaffont/fvm-installer)
```
git clone https://github.com/FXServer-ESX/fxserver-esx_bankerjob esx_bankerjob
fvm install --save --folder=esx esx-org/esx_bankerjob
```
3) Import esx_bankerjob.sql in your database
4) Add this in your server.cfg :
### Using Git
```
cd resources
git clone https://github.com/ESX-Org/esx_bankerjob [esx]/esx_bankerjob
```
### Manually
- Download https://github.com/ESX-Org/esx_bankerjob/archive/master.zip
- Put it in the `[esx]` directory
- Import `esx_bankerjob.sql` in your database
- Add this in your `server.cfg`:
```
start esx_bankerjob
```
# Legal
### License
esx_bankerjob - bank script
Copyright (C) 2015-2018 Jérémie N'gadi
This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.
This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details.
You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/.
+2 -1
View File
@@ -54,6 +54,7 @@ function OpenBankActionsMenu ()
'default', GetCurrentResourceName(), 'bank_actions',
{
title = _U('bank'),
align = 'top-left',
elements = elements,
},
function (data, menu)
@@ -291,7 +292,7 @@ end)
-- Key Controls
Citizen.CreateThread(function ()
while true do
Citizen.Wait(0)
Citizen.Wait(10)
if CurrentAction ~= nil then
SetTextComponentFormat('STRING')
+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