mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 09:48:52 +00:00
Fixed bugs with setting death status, combat loggers now force-respawn
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
local HasAlreadyEnteredMarker, LastZone, CurrentAction, CurrentActionMsg, CurrentActionData = nil, nil, nil, '', {}
|
||||
local IsBusy = false
|
||||
|
||||
function OpenAmbulanceActionsMenu()
|
||||
local elements = {
|
||||
|
||||
+17
-14
@@ -10,7 +10,7 @@ Keys = {
|
||||
["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
|
||||
}
|
||||
|
||||
local FirstSpawn, IsBusy = true, false
|
||||
local FirstSpawn, PlayerLoaded = true, false
|
||||
|
||||
IsDead = false
|
||||
ESX = nil
|
||||
@@ -25,12 +25,14 @@ Citizen.CreateThread(function()
|
||||
Citizen.Wait(100)
|
||||
end
|
||||
|
||||
PlayerLoaded = true
|
||||
ESX.PlayerData = ESX.GetPlayerData()
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:playerLoaded')
|
||||
AddEventHandler('esx:playerLoaded', function(xPlayer)
|
||||
ESX.PlayerData = xPlayer
|
||||
PlayerLoaded = true
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx:setJob')
|
||||
@@ -42,9 +44,19 @@ AddEventHandler('playerSpawned', function()
|
||||
IsDead = false
|
||||
|
||||
if FirstSpawn then
|
||||
TriggerServerEvent('esx_ambulancejob:firstSpawn')
|
||||
exports.spawnmanager:setAutoSpawn(false) -- disable respawn
|
||||
FirstSpawn = false
|
||||
|
||||
ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(isDead)
|
||||
if isDead and Config.AntiCombatLog then
|
||||
while not PlayerLoaded do
|
||||
Citizen.Wait(1000)
|
||||
end
|
||||
|
||||
ESX.ShowNotification(_U('combatlog_message'))
|
||||
RemoveItemsAfterRPDeath()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -66,7 +78,7 @@ end)
|
||||
|
||||
function OnPlayerDeath()
|
||||
IsDead = true
|
||||
TriggerServerEvent('esx_ambulancejob:setDeathStatus', 1)
|
||||
TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
|
||||
|
||||
StartDeathTimer()
|
||||
StartDistressSignal()
|
||||
@@ -226,7 +238,7 @@ function StartDeathTimer()
|
||||
end
|
||||
|
||||
function RemoveItemsAfterRPDeath()
|
||||
TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0)
|
||||
TriggerServerEvent('esx_ambulancejob:setDeathStatus', false)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
DoScreenFadeOut(800)
|
||||
@@ -290,7 +302,7 @@ RegisterNetEvent('esx_ambulancejob:revive')
|
||||
AddEventHandler('esx_ambulancejob:revive', function()
|
||||
local playerPed = PlayerPedId()
|
||||
local coords = GetEntityCoords(playerPed)
|
||||
TriggerServerEvent('esx_ambulancejob:setDeathStatus', 0)
|
||||
TriggerServerEvent('esx_ambulancejob:setDeathStatus', true)
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
DoScreenFadeOut(800)
|
||||
@@ -322,15 +334,6 @@ AddEventHandler('esx_ambulancejob:revive', function()
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
RegisterNetEvent('esx_ambulancejob:requestDeath')
|
||||
AddEventHandler('esx_ambulancejob:requestDeath', function()
|
||||
if Config.AntiCombatLog then
|
||||
Citizen.Wait(5000)
|
||||
SetEntityHealth(PlayerPedId(), 0)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Load unloaded IPLs
|
||||
if Config.LoadIpl then
|
||||
Citizen.CreateThread(function()
|
||||
|
||||
@@ -52,6 +52,7 @@ Locales['br'] = {
|
||||
['distress_send'] = 'press [~b~G~s~] to send distress signal',
|
||||
['distress_sent'] = 'distress signal has been sent to available units!',
|
||||
['distress_message'] = 'medical attention required: unconscious citizen!',
|
||||
['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.',
|
||||
-- Revive
|
||||
['revive_help'] = 'reviver um jogador',
|
||||
-- Item
|
||||
|
||||
@@ -52,6 +52,7 @@ Locales['en'] = {
|
||||
['distress_send'] = 'press [~b~G~s~] to send distress signal',
|
||||
['distress_sent'] = 'distress signal has been sent to available units!',
|
||||
['distress_message'] = 'medical attention required: unconscious citizen!',
|
||||
['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.',
|
||||
-- Revive
|
||||
['revive_help'] = 'revive a player',
|
||||
-- Item
|
||||
|
||||
@@ -52,6 +52,7 @@ Locales['es'] = {
|
||||
['distress_send'] = 'press [~b~G~s~] to send distress signal',
|
||||
['distress_sent'] = 'distress signal has been sent to available units!',
|
||||
['distress_message'] = 'medical attention required: unconscious citizen!',
|
||||
['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.',
|
||||
-- Revive
|
||||
['revive_help'] = 'reviver un jugador',
|
||||
-- Item
|
||||
|
||||
@@ -52,6 +52,7 @@ Locales['fi'] = {
|
||||
['distress_send'] = 'press [~b~G~s~] to send distress signal',
|
||||
['distress_sent'] = 'distress signal has been sent to available units!',
|
||||
['distress_message'] = 'medical attention required: unconscious citizen!',
|
||||
['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.',
|
||||
-- Revive
|
||||
['revive_help'] = 'elvytä pelaaja',
|
||||
-- Item
|
||||
|
||||
@@ -52,6 +52,7 @@ Locales['fr'] = {
|
||||
['distress_send'] = 'press [~b~G~s~] to send distress signal',
|
||||
['distress_sent'] = 'distress signal has been sent to available units!',
|
||||
['distress_message'] = 'medical attention required: unconscious citizen!',
|
||||
['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.',
|
||||
-- Revive
|
||||
['revive_help'] = 'relancer un joueur',
|
||||
-- Item
|
||||
|
||||
@@ -52,6 +52,7 @@ Locales['pl'] = {
|
||||
['distress_send'] = 'press [~b~G~s~] to send distress signal',
|
||||
['distress_sent'] = 'distress signal has been sent to available units!',
|
||||
['distress_message'] = 'medical attention required: unconscious citizen!',
|
||||
['combatlog_message'] = 'you have been force-respawned because you\'ve previously left the server when dead.',
|
||||
-- Revive
|
||||
['revive_help'] = 'ożyw gracza',
|
||||
-- Item
|
||||
|
||||
@@ -52,6 +52,7 @@ Locales['sv'] = {
|
||||
['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal',
|
||||
['distress_sent'] = 'nödsignal har skickats till samtliga enheter!',
|
||||
['distress_message'] = 'läkarvård krävs: medvetslös medborgare!',
|
||||
['combatlog_message'] = 'du har force-respawnats på grund av att du lämnat servern medans du var död',
|
||||
-- Revive
|
||||
['revive_help'] = 'återuppliva en spelare',
|
||||
-- Item
|
||||
|
||||
+5
-5
@@ -179,17 +179,17 @@ ESX.RegisterUsableItem('bandage', function(source)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('used_bandage'))
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_ambulancejob:firstSpawn')
|
||||
AddEventHandler('esx_ambulancejob:firstSpawn', function()
|
||||
local _source = source
|
||||
local identifier = GetPlayerIdentifiers(_source)[1]
|
||||
ESX.RegisterServerCallback('esx_ambulancejob:getDeathStatus', function(source, cb)
|
||||
local identifier = GetPlayerIdentifiers(source)[1]
|
||||
|
||||
MySQL.Async.fetchScalar('SELECT is_dead FROM users WHERE identifier = @identifier', {
|
||||
['@identifier'] = identifier
|
||||
}, function(isDead)
|
||||
if isDead then
|
||||
print(('esx_ambulancejob: %s attempted combat logging!'):format(identifier))
|
||||
TriggerClientEvent('esx_ambulancejob:requestDeath', _source)
|
||||
end
|
||||
|
||||
cb(isDead)
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user