[How to] kill player if combat logging with esx_ambulancejob

First open up the client/main.lua in esx_ambulancejob folder and find this:

if FirstSpawn then
	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)

and replace with this:

if firstSpawn then
	firstSpawn = false

	if Config.AntiCombatLog then
		while not PlayerLoaded do
			Citizen.Wait(5000)
		end

		ESX.TriggerServerCallback('esx_ambulancejob:getDeathStatus', function(shouldDie)
			if shouldDie then
				Citizen.Wait(10000)
				SetEntityHealth(PlayerPedId(), 0)
			end
		end)
	end
end

end)

When the player spawns in it will take a couple of seconds so that the player skin loads and will then kill them.

I hope this helps out people who have been looking on how to stop people combat logging :smiley:

OR if you find it easier you can go to my GitHub and download the whole script there.

4 Likes

You should pull request such changes to the orginal esx_ambulancejob repository so everyone can enjoy your changes.

1 Like

Hello…! I do the tutorial step by step and for a reason My ambulance Script doesnt work!Then ,I downloaded the script in the post but Combat Logging Still works! Is there any solution for this?(Sorry For My bad english)

1 Like

Sorry for late reply. Do you still need assistance?

2 Likes

No ,thank you!

1 Like

AddEventHandler(‘playerSpawned’, function()
isDead = false

if firstSpawn then
	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()
		end
	end)
else
	TriggerServerEvent('esx_ambulancejob:onPlayerSpawn')
end

end)

My code look like that what do i need to change to get it work?

1 Like

when i do this, admin cannot use /revive command. how can i fix this

1 Like