mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Improved washing money code, README cleanup
This commit is contained in:
@@ -1,31 +1,38 @@
|
||||
# fxserver-esx_society
|
||||
FXServer ESX Society
|
||||
# esx_society
|
||||
|
||||
[REQUIREMENTS]
|
||||
## Requirements
|
||||
- [cron](https://github.com/ESX-Org/cron)
|
||||
- [esx_addonaccount](https://github.com/ESX-Org/esx_addonaccount)
|
||||
|
||||
- cron => https://github.com/FXServer-ESX/fxserver-cron
|
||||
- esx_addonaccount => https://github.com/FXServer-ESX/fxserver-esx_addonaccount
|
||||
## Download & Installation
|
||||
|
||||
[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_society esx_society
|
||||
fvm install --save --folder=esx esx-org/esx_society
|
||||
```
|
||||
3) Import esx_society.sql in your database
|
||||
4) Add this in your server.cfg :
|
||||
|
||||
### Using Git
|
||||
```
|
||||
cd resources
|
||||
git clone https://github.com/ESX-Org/esx_society [esx]/esx_society
|
||||
```
|
||||
|
||||
### Manually
|
||||
- Download https://github.com/ESX-Org/esx_society/archive/master.zip
|
||||
- Put it in the `[esx]` directory
|
||||
|
||||
- Import `esx_society.sql` in your database
|
||||
- Add this in your `server.cfg`:
|
||||
|
||||
```
|
||||
start esx_society
|
||||
```
|
||||
[EXPLANATION]
|
||||
|
||||
ESX Society works with addon accounts named 'society_xxx' like 'society_taxi' or 'society_realestateagent'.
|
||||
If you job grade is 'boss', you will see the society_xxx money of your job showed in the HUD.
|
||||
## Explanation
|
||||
ESX Society works with addon accounts named 'society_xxx', for example 'society_taxi' or 'society_realestateagent'. If you job grade is 'boss' the society money will be displayed in your hud.
|
||||
|
||||
[USAGE]
|
||||
```
|
||||
## Usage
|
||||
```lua
|
||||
local society = 'taxi'
|
||||
local amount = 100
|
||||
|
||||
@@ -33,3 +40,15 @@ TriggerServerEvent('esx_society:withdrawMoney', society, amount)
|
||||
TriggerServerEvent('esx_society:depositMoney', society, amount)
|
||||
TriggerServerEvent('esx_society:washMoney', society, amount)
|
||||
```
|
||||
|
||||
# Legal
|
||||
### License
|
||||
esx_society - societies for ESX
|
||||
|
||||
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/.
|
||||
+1
-1
@@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
|
||||
|
||||
description 'ESX Society'
|
||||
|
||||
version '1.0.3'
|
||||
version '1.0.4'
|
||||
|
||||
server_scripts {
|
||||
'@mysql-async/lib/MySQL.lua',
|
||||
|
||||
+6
-7
@@ -1,11 +1,10 @@
|
||||
USE `essentialmode`;
|
||||
|
||||
CREATE TABLE `society_moneywash` (
|
||||
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(60) NOT NULL,
|
||||
`society` varchar(60) NOT NULL,
|
||||
`amount` int(11) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`identifier` varchar(60) NOT NULL,
|
||||
`society` varchar(60) NOT NULL,
|
||||
`amount` int(11) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
+21
-40
@@ -366,49 +366,30 @@ ESX.RegisterServerCallback('esx_society:getVehiclesInGarage', function(source, c
|
||||
|
||||
end)
|
||||
|
||||
function WashMoneyCRON(d, h, m)
|
||||
function WashMoneyCRON()
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT * FROM society_moneywash', {},
|
||||
function(result)
|
||||
for i=1, #result, 1 do
|
||||
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT * FROM society_moneywash',
|
||||
{},
|
||||
function(result)
|
||||
-- add society money
|
||||
local society = GetSociety(result[i].society)
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
|
||||
account.addMoney(result[i].amount)
|
||||
end)
|
||||
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
|
||||
for i=1, #result, 1 do
|
||||
|
||||
local foundPlayer = false
|
||||
local xPlayer = nil
|
||||
local society = GetSociety(result[i].society)
|
||||
|
||||
for j=1, #xPlayers, 1 do
|
||||
local xPlayer2 = ESX.GetPlayerFromId(xPlayers[j])
|
||||
if xPlayer2.identifier == result[i].identifier then
|
||||
foundPlayer = true
|
||||
xPlayer = xPlayer2
|
||||
end
|
||||
end
|
||||
|
||||
TriggerEvent('esx_addonaccount:getSharedAccount', society.account, function(account)
|
||||
account.addMoney(result[i].amount)
|
||||
end)
|
||||
|
||||
if foundPlayer then
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_have_laundered', result[i].amount))
|
||||
end
|
||||
|
||||
MySQL.Async.execute(
|
||||
'DELETE FROM society_moneywash WHERE id = @id',
|
||||
{
|
||||
['@id'] = result[i].id
|
||||
}
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
-- send notification if player is online
|
||||
local xPlayer = ESX.GetPlayerFromIdentifier(result[i].identifier)
|
||||
if xPlayer ~= nil then
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('you_have_laundered', result[i].amount))
|
||||
end
|
||||
|
||||
MySQL.Async.execute('DELETE FROM society_moneywash WHERE id = @id',
|
||||
{
|
||||
['@id'] = result[i].id
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
TriggerEvent('cron:runAt', 3, 0, WashMoneyCRON)
|
||||
|
||||
Reference in New Issue
Block a user