Stop incompatible resources (see description)

Automaticly stop resources that

- a) not compatible with ESX, for example spawnmanager
- b) does the same as esx does, but what esx probably does better
This commit is contained in:
ElPumpo
2020-04-13 17:50:20 +02:00
parent 2b58041abb
commit 238bcae7c0
3 changed files with 44 additions and 4 deletions
+14
View File
@@ -18,3 +18,17 @@ Config.MaxWeight = 24 -- the max inventory weight without backpack
Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds
Config.EnableDebug = false
Config.IncompatibleResourcesToStop = {
['essentialmode'] = 'ES for short, the performance heavy RP framework no one uses - and source for the random unwanted ZAP ads you\'re seeing',
['es_admin2'] = 'Adminstration tool for the ancient ES framework that wont work with ESX',
['esplugin_mysql'] = 'MySQL "plugin" for the ancient ES framework that has a SQL injection vulnerability',
['es_ui'] = 'Money HUD for ES',
['spawnmanager'] = 'Default resource that takes care of spawning players, ESX does this already',
['mapmanager'] = 'Default resource that was required by spawnmanager, but neither are used',
['basic-gamemode'] = 'Resource that is solely for choosing the default game type',
['fivem'] = 'Resource that is solely for choosing the default game type',
['fivem-map-hipster'] = 'Default spawn locations for mapmanager',
['fivem-map-skater'] = 'Default spawn locations for mapmanager',
['baseevents'] = 'Default resource for handling death events, ESX does this already'
}
-3
View File
@@ -19,9 +19,6 @@ function getSharedObject()
end
MySQL.ready(function()
SetMapName('San Andreas')
SetGameType('Roleplay')
MySQL.Async.fetchAll('SELECT * FROM items', {}, function(result)
for k,v in ipairs(result) do
ESX.Items[v.name] = {
+30 -1
View File
@@ -1,3 +1,32 @@
Citizen.CreateThread(function()
SetMapName('San Andreas')
SetGameType('Roleplay')
local resourcesStopped = {}
for resourceName,reason in pairs(Config.IncompatibleResourcesToStop) do
local status = GetResourceState(resourceName)
if status == 'started' or status == 'starting' then
while status == 'starting' do
Citizen.Wait(100)
end
StopResource(resourceName)
resourcesStopped[resourceName] = reason
end
end
if ESX.Table.SizeOf(resourcesStopped) > 0 then
local allStoppedResources = ''
for resourceName,reason in pairs(resourcesStopped) do
allStoppedResources = ('%s\n- ^3%s^7, %s'):format(allStoppedResources, resourceName, reason)
end
print(('[es_extended] [^3WARNING^7] Stopped %s incompatible resource(s) that can cause issues when used with ESX. They are not needed and can safely be removed from your server, remove these resource(s) from your resource directory and your configuration file:%s'):format(ESX.Table.SizeOf(resourcesStopped), allStoppedResources))
end
end)
RegisterNetEvent('esx:onPlayerJoined')
AddEventHandler('esx:onPlayerJoined', function()
if not ESX.Players[source] then
@@ -216,7 +245,7 @@ function loadESXPlayer(identifier, playerId)
inventory = xPlayer.getInventory(),
job = xPlayer.getJob(),
loadout = xPlayer.getLoadout(),
maxWeight = xPlayer.maxWeight,
maxWeight = xPlayer.getMaxWeight(),
money = xPlayer.getMoney()
})