[HELP] Guns Dont Remove After Player Dropp/DC

Hi Guys

sorry for my bad english

guys , i want this script make player while playing warzone script and force disconnect from server (playerDropped, for loot every gun what is not allowed on normal world) guns get remove

this is my code in server.lua

RegisterNetEvent('FORCEDC:ALT+F4')
AddEventHandler('FORCEDC:ALT+F4', function(source)
	local xPlayer = ESX.GetPlayerFromId(source)
	if xPlayer ~= nil then
		for i=1, #xPlayer.loadout, 1 do
			if xPlayer.loadout[i].name then
				xPlayer.removeWeapon(xPlayer.loadout[i].name)
			end
		end

	
		if xPlayer.getInventoryItem('BRD') then
			xPlayer.removeInventoryItem('BRD', 4000)
		end
	end
	TriggerEvent('DiscordBot:ToDiscord', 'warzone',	   'WarZone' , "```css\n" .. GetPlayerName(source) .. " DC\n```",'user', source, true, false)
end)


AddEventHandler('playerDropped', function(source, resoan)
	local source = source
	TriggerClientEvent('FORCEDC:ALT+F4', source)
	print('TEST')
end)

Its fine , No error , BUT Not Working ! Not remove the guns !!
Tnx for help

RegisterNetEvent('FORCEDC:ALT+F4')
AddEventHandler('FORCEDC:ALT+F4', function(source)
	local xPlayer = ESX.GetPlayerFromId(source)
	if xPlayer ~= nil then
		for i=1, #xPlayer.loadout, 1 do
			if xPlayer.loadout[i].name then
				xPlayer.removeWeapon(xPlayer.loadout[i].name)
			end
		end

	
		if xPlayer.getInventoryItem('BRD') then
			xPlayer.removeInventoryItem('BRD', 4000)
		end
	end
	TriggerEvent('DiscordBot:ToDiscord', 'warzone',	   'WarZone' , "```css\n" .. GetPlayerName(source) .. " DC\n```",'user', source, true, false)
end)


AddEventHandler('playerDropped', function(source, resoan)
	local source = source
	TriggerEvent('FORCEDC:ALT+F4', source)
	print('TEST')
end)

Tnx for reply

but still nothing happened !

don’t remove guns from user after disconnect

SOLVED

just use part of ambulance job what is call IsDead True

after doing that , if player disconnect it will be combat log and erase everything

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.