Updated readme

This commit is contained in:
ElPumpo
2018-06-13 22:12:34 +02:00
parent 8cd98426d1
commit 2af92a163c
2 changed files with 34 additions and 18 deletions
+33 -11
View File
@@ -1,28 +1,38 @@
# fxserver-esx_service
FXServer ESX Service
# esx_service
[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_service esx_service
fvm install --save --folder=esx esx-org/esx_service
```
3) Add this in your server.cfg :
### Using Git
```
cd resources
git clone https://github.com/ESX-Org/esx_service [esx]/esx_service
```
### Manually
- Download https://github.com/ESX-Org/esx_service/archive/master.zip
- Put it in the `[esx]` directory
## Installation
- Add this to your `server.cfg`:
```
start esx_service
```
[USAGE]
```
## Usage
```lua
-- Enable service
ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount)
if canTakeService then
ESX.ShowNotification('Vous avez pris votre service')
ESX.ShowNotification('You enabled service')
else
ESX.ShowNotification('Service complet : ' .. inServiceCount .. '/' .. maxInService)
ESX.ShowNotification('Service is full: ' .. inServiceCount .. '/' .. maxInService)
end
end, 'taxi')
@@ -30,3 +40,15 @@ end, 'taxi')
-- Disable service
TriggerServerEvent('esx_service:disableService', 'taxi')
```
# Legal
### License
esx_service - be in service
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 -7
View File
@@ -5,7 +5,6 @@ local MaxInService = {}
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
function GetInServiceCount(name)
local count = 0
for k,v in pairs(InService[name]) do
@@ -15,7 +14,6 @@ function GetInServiceCount(name)
end
return count
end
AddEventHandler('esx_service:activateService', function(name, max)
@@ -29,7 +27,6 @@ AddEventHandler('esx_service:disableService', function(name)
end)
ESX.RegisterServerCallback('esx_service:enableService', function(source, cb, name)
local inServiceCount = GetInServiceCount(name)
if inServiceCount >= MaxInService[name] then
@@ -38,11 +35,9 @@ ESX.RegisterServerCallback('esx_service:enableService', function(source, cb, nam
InService[name][source] = true
cb(true, MaxInService[name], inServiceCount)
end
end)
AddEventHandler('playerDropped', function()
local _source = source
for k,v in pairs(InService) do
@@ -50,5 +45,4 @@ AddEventHandler('playerDropped', function()
v[_source] = nil
end
end
end)
end)