Merge pull request #808 from QB-Extended/main

feat(es_extended): add message to event
This commit is contained in:
Benzo
2023-01-08 10:55:38 +01:00
committed by GitHub
17 changed files with 67 additions and 59 deletions
+5
View File
@@ -5,3 +5,8 @@ end)
if GetResourceState('ox_inventory') ~= 'missing' then
Config.OxInventory = true
end
AddEventHandler("esx:getSharedObject", function()
local Invoke = GetInvokingResource()
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/sharedevent for how to fix!"):format(Invoke))
end)
+4
View File
@@ -14,6 +14,10 @@ Core.Pickups = {}
Core.PickupId = 0
Core.PlayerFunctionOverrides = {}
AddEventHandler("esx:getSharedObject", function()
local Invoke = GetInvokingResource()
print(("[^1ERROR^7] Resource ^5%s^7 Used the ^5getSharedObject^7 Event, this event ^1no longer exists!^7 Visit https://documentation.esx-framework.org/tutorials/sharedevent for how to fix!"):format(Invoke))
end)
exports('getSharedObject', function()
return ESX
@@ -29,5 +29,6 @@ client_scripts {
dependencies {
'es_extended',
'esx_skin',
'esx_society',
'esx_vehicleshop'
}
@@ -4,9 +4,9 @@ if GetResourceState("esx_phone") ~= 'missing' then
TriggerEvent('esx_phone:registerNumber', 'ambulance', TranslateCap('alert_ambulance'), true, true)
end
if GetResourceState("esx_society") ~= 'missing' then
TriggerEvent('esx_society:registerSociety', 'ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'})
end
CreateThread(function()
exports["esx_society"]:registerSociety('ambulance', 'Ambulance', 'society_ambulance', 'society_ambulance', 'society_ambulance', {type = 'public'})
end)
RegisterNetEvent('esx_ambulancejob:revive')
AddEventHandler('esx_ambulancejob:revive', function(playerId)
+4 -1
View File
@@ -24,4 +24,7 @@ client_scripts {
'client/main.lua'
}
dependency 'es_extended'
dependencies {
'es_extended',
'esx_society'
}
+3 -1
View File
@@ -1,5 +1,7 @@
TriggerEvent('esx_phone:registerNumber', 'banker', _('phone_receive'), false, false)
TriggerEvent('esx_society:registerSociety', 'banker', TranslateCap('phone_label'), 'society_banker', 'society_banker', 'society_banker', {type = 'public'})
CreateThread(function()
exports["esx_society"]:registerSociety('banker', TranslateCap('phone_label'), 'society_banker', 'society_banker', 'society_banker', {type = 'public'})
end)
RegisterServerEvent('esx_bankerjob:customerDeposit')
AddEventHandler('esx_bankerjob:customerDeposit', function (target, amount)
+4 -1
View File
@@ -5,7 +5,10 @@ if Config.MaxInService ~= -1 then
end
TriggerEvent('esx_phone:registerNumber', 'mechanic', TranslateCap('mechanic_customer'), true, true)
TriggerEvent('esx_society:registerSociety', 'mechanic', 'mechanic', 'society_mechanic', 'society_mechanic', 'society_mechanic', {type = 'private'})
CreateThread(function()
exports["esx_society"]:registerSociety('mechanic', 'mechanic', 'society_mechanic', 'society_mechanic', 'society_mechanic', {type = 'private'})
end)
local function Harvest(source)
SetTimeout(4000, function()
@@ -27,5 +27,6 @@ client_scripts {
dependencies {
'es_extended',
'esx_billing',
'esx_society',
'esx_vehicleshop'
}
+3 -1
View File
@@ -5,7 +5,9 @@ if Config.EnableESXService then
end
TriggerEvent('esx_phone:registerNumber', 'police', TranslateCap('alert_police'), true, true)
TriggerEvent('esx_society:registerSociety', 'police', 'Police', 'society_police', 'society_police', 'society_police', {type = 'public'})
CreateThread(function()
exports["esx_society"]:registerSociety('police', 'Police', 'society_police', 'society_police', 'society_police', {type = 'public'})
end)
RegisterNetEvent('esx_policejob:confiscatePlayerItem')
AddEventHandler('esx_policejob:confiscatePlayerItem', function(target, itemType, itemName, amount)
+2 -1
View File
@@ -42,5 +42,6 @@ client_scripts {
}
dependencies {
'es_extended'
'es_extended',
'esx_society'
}
+1 -1
View File
@@ -147,7 +147,7 @@ CreateThread(function()
Wait(10)
ESX.RefreshJobs()
TriggerEvent('esx_society:registerSociety', 'realestateagent', 'realestateagent', 'society_realestateagent', 'society_realestateagent', 'society_realestateagent', {type = 'private'})
exports["esx_society"]:registerSociety('realestateagent', 'realestateagent', 'society_realestateagent', 'society_realestateagent', 'society_realestateagent', {type = 'private'})
end
end)
+1 -30
View File
@@ -1,36 +1,7 @@
# esx_society
<h1 align='center'>[ESX] Society</a></h1><p align='center'><b><a href='https://discord.esx-framework.org/'>Discord</a> - <a href='https://esx-framework.org/'>Website</a> - <a href='https://documentation.esx-framework.org/legacy/installation'>Documentation</a></b></h5>
Society management for ESX. Adds employee management (hire, fire, promote / demote, change salary), society bank accounts and money washing. It's crucial that this script gets started before all resources that utilize societies do, or else many things will go wrong.
## Requirements
- [cron](https://github.com/esx-framework/esx-legacy/tree/main/%5Besx%5D/cron)
- [esx_addonaccount](https://github.com/esx-framework/esx-legacy/tree/main/%5Besx_addons%5D/esx_addonaccount)
## Download & Installation
### Using [fvm](https://github.com/qlaffont/fvm-installer)
```
fvm install --save --folder=esx esx-org/esx_society
```
### 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
## Installation
- 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', for example 'society_taxi' or 'society_realestateagent'. If you job grade is 'boss' the society money will be displayed in your hud.
+18 -14
View File
@@ -9,24 +9,24 @@ function GetSociety(name)
end
end
AddEventHandler('onResourceStart', function(resourceName)
if resourceName == GetCurrentResourceName() then
local result = MySQL.query.await('SELECT * FROM jobs')
exports("GetSociety", GetSociety)
for i = 1, #result, 1 do
Jobs[result[i].name] = result[i]
Jobs[result[i].name].grades = {}
end
CreateThread(function()
local result = MySQL.query.await('SELECT * FROM jobs')
local result2 = MySQL.query.await('SELECT * FROM job_grades')
for i = 1, #result, 1 do
Jobs[result[i].name] = result[i]
Jobs[result[i].name].grades = {}
end
for i = 1, #result2, 1 do
Jobs[result2[i].job_name].grades[tostring(result2[i].grade)] = result2[i]
end
local result2 = MySQL.query.await('SELECT * FROM job_grades')
for i = 1, #result2, 1 do
Jobs[result2[i].job_name].grades[tostring(result2[i].grade)] = result2[i]
end
end)
AddEventHandler('esx_society:registerSociety', function(name, label, account, datastore, inventory, data)
function registerSociety(name, label, account, datastore, inventory, data)
local found = false
local society = {
@@ -46,9 +46,13 @@ AddEventHandler('esx_society:registerSociety', function(name, label, account, da
end
if not found then
table.insert(RegisteredSocieties, society)
RegisteredSocieties[#RegisteredSocieties + 1] = society
print(("[^2INFO^7] Registered Society ^5%s^7"):format(label))
end
end)
end
AddEventHandler('esx_society:registerSociety',registerSociety)
exports("registerSociety", registerSociety)
AddEventHandler('esx_society:getSocieties', function(cb)
cb(RegisteredSocieties)
+4 -1
View File
@@ -22,4 +22,7 @@ server_scripts {
'server/main.lua'
}
dependency 'es_extended'
dependencies {
'es_extended',
'esx_society'
}
+5 -3
View File
@@ -5,9 +5,11 @@ if Config.MaxInService ~= -1 then
end
TriggerEvent('esx_phone:registerNumber', 'taxi', TranslateCap('taxi_client'), true, true)
TriggerEvent('esx_society:registerSociety', 'taxi', 'Taxi', 'society_taxi', 'society_taxi', 'society_taxi', {
type = 'public'
})
CreateThread(function()
exports["esx_society"]:registerSociety('taxi', 'Taxi', 'society_taxi', 'society_taxi', 'society_taxi', {
type = 'public'
})
end)
RegisterNetEvent('esx_taxijob:success')
AddEventHandler('esx_taxijob:success', function()
+5 -1
View File
@@ -26,6 +26,10 @@ client_scripts {
'client/main.lua'
}
dependency 'es_extended'
dependencies {
'es_extended',
'esx_society'
}
export 'GeneratePlate'
+3 -1
View File
@@ -1,7 +1,9 @@
local categories, vehicles = {}, {}
TriggerEvent('esx_phone:registerNumber', 'cardealer', TranslateCap('dealer_customers'), false, false)
TriggerEvent('esx_society:registerSociety', 'cardealer', TranslateCap('car_dealer'), 'society_cardealer', 'society_cardealer', 'society_cardealer', {type = 'private'})
CreateThread(function()
exports["esx_society"]:registerSociety('cardealer', TranslateCap('car_dealer'), 'society_cardealer', 'society_cardealer', 'society_cardealer', {type = 'private'})
end)
CreateThread(function()
local char = Config.PlateLetters