mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Merge branch 'master' into master
This commit is contained in:
+23
-25
@@ -16,10 +16,16 @@ AddEventHandler('esx_ambulancejob:revive', function(playerId)
|
||||
|
||||
if xTarget then
|
||||
if deadPlayers[playerId] then
|
||||
xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward))
|
||||
xPlayer.addMoney(Config.ReviveReward)
|
||||
xTarget.triggerEvent('esx_ambulancejob:revive')
|
||||
deadPlayers[playerId] = nil
|
||||
if Config.ReviveReward > 0 then
|
||||
xPlayer.showNotification(_U('revive_complete_award', xTarget.name, Config.ReviveReward))
|
||||
xPlayer.addMoney(Config.ReviveReward)
|
||||
xTarget.triggerEvent('esx_ambulancejob:revive')
|
||||
deadPlayers[playerId] = nil
|
||||
else
|
||||
xPlayer.showNotification(_U('revive_complete', xTarget.name))
|
||||
xTarget.triggerEvent('esx_ambulancejob:revive')
|
||||
deadPlayers[playerId] = nil
|
||||
end
|
||||
else
|
||||
xPlayer.showNotification(_U('player_not_unconscious'))
|
||||
end
|
||||
@@ -48,8 +54,8 @@ AddEventHandler('esx_ambulancejob:onPlayerDistress', function()
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_ambulancejob:onPlayerSpawn')
|
||||
AddEventHandler('esx_ambulancejob:onPlayerSpawn', function()
|
||||
RegisterNetEvent('esx:onPlayerSpawn')
|
||||
AddEventHandler('esx:onPlayerSpawn', function()
|
||||
if deadPlayers[source] then
|
||||
deadPlayers[source] = nil
|
||||
TriggerClientEvent('esx_ambulancejob:setDeadPlayers', -1, deadPlayers)
|
||||
@@ -255,20 +261,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
|
||||
@@ -297,13 +294,14 @@ 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)
|
||||
@@ -312,11 +310,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
|
||||
|
||||
Reference in New Issue
Block a user