Updated to work with latest ESX

This commit is contained in:
ElPumpo
2020-02-17 21:15:52 +01:00
parent 783a5eeae2
commit 739a228dd2
2 changed files with 21 additions and 28 deletions
+11 -9
View File
@@ -36,16 +36,18 @@ AddEventHandler('playerSpawned', function()
exports.spawnmanager:setAutoSpawn(false) -- disable respawn
firstSpawn = false
ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
if shouldDie and Config.AntiCombatLog then
while not PlayerLoaded do
Citizen.Wait(1000)
end
ESX.ShowNotification(_U('combatlog_message'))
RemoveItemsAfterRPDeath()
if Config.AntiCombatLog then
while not PlayerLoaded do
Citizen.Wait(1000)
end
end)
ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
if shouldDie then
ESX.ShowNotification(_U('combatlog_message'))
RemoveItemsAfterRPDeath()
end
end)
end
end
end)
+10 -19
View File
@@ -250,20 +250,11 @@ AddEventHandler('esx_ambulancejob:giveItem', function(itemName, amount)
end
end)
TriggerEvent('es:addGroupCommand', 'revive', 'admin', function(source, args, user)
if args[1] then
local playerId = tonumber(args[1])
if playerId and ESX.GetPlayerFromId(playerId) then
TriggerClientEvent('esx_ambulancejob:revive', playerId)
else
TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Player not online.' } })
end
else
TriggerClientEvent('esx_ambulancejob:revive', source)
end
end, function(source, args, user)
TriggerClientEvent('chat:addMessage', source, { args = { '^1SYSTEM', 'Insufficient Permissions.' } })
end, { help = _U('revive_help'), params = {{ name = 'playerId' }} })
ESX.RegisterCommand('revive', 'admin', function(xPlayer, args, showError)
args.playerId.triggerEvent('esx_ambulancejob:revive')
end, true, {help = _U('revive_help'), validate = true, arguments = {
{name = 'playerId', help = 'The player id', type = 'player'}
}})
ESX.RegisterUsableItem('medikit', function(source)
if not playersHealing[source] then
@@ -292,13 +283,13 @@ ESX.RegisterUsableItem('bandage', function(source)
end)
ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, cb)
local identifier = GetPlayerIdentifiers(source)[1]
local xPlayer = ESX.GetPlayerFromId(source)
MySQL.Async.fetchScalar('SELECT is_dead FROM users WHERE identifier = @identifier', {
['@identifier'] = identifier
['@identifier'] = xPlayer.identifier
}, function(isDead)
if isDead then
print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(identifier))
print(('[esx_ambulancejob] [^2INFO^7] "%s" attempted combat logging'):format(xPlayer.identifier))
end
cb(isDead)
@@ -307,11 +298,11 @@ end)
RegisterNetEvent('esx_ambulancejob:setDeathStatus')
AddEventHandler('esx_ambulancejob:setDeathStatus', function(isDead)
local identifier = GetPlayerIdentifiers(source)[1]
local xPlayer = ESX.GetPlayerFromId(source)
if type(isDead) == 'boolean' then
MySQL.Sync.execute('UPDATE users SET is_dead = @isDead WHERE identifier = @identifier', {
['@identifier'] = identifier,
['@identifier'] = xPlayer.identifier,
['@isDead'] = isDead
})
end