[RELEASE][ESX] esx_xp

if Config.ZombieDropLoot then
	Citizen.CreateThread(function()
		while true do
			Citizen.Wait(1)
			
			for i, entity in pairs(entitys) do
				playerX, playerY, playerZ = table.unpack(GetEntityCoords(PlayerPedId(), true))
				pedX, pedY, pedZ = table.unpack(GetEntityCoords(entity, true))
				if DoesEntityExist(entity) == false then
					table.remove(entitys, i)
				end
				if IsPedDeadOrDying(entity, 1) == 1 then
					if GetPedSourceOfDeath(entity) == PlayerPedId() then
						playerX, playerY, playerZ = table.unpack(GetEntityCoords(PlayerPedId(), true))
						pedX, pedY, pedZ = table.unpack(GetEntityCoords(entity, true))	
						
						if not IsPedInAnyVehicle(PlayerPedId(), false) then
							if(Vdist(playerX, playerY, playerZ, pedX, pedY, pedZ) < 1.5) then
								ESX.Game.Utils.DrawText3D({x = pedX, y = pedY, z = pedZ + 0.2}, '~c~PRESS ~b~[E]~c~ TO SEARCH', 0.8, 4)
								if IsControlJustReleased(1, 51) then
									if DoesEntityExist(PlayerPedId()) then
										RequestAnimDict("[email protected]")
										while not HasAnimDictLoaded("[email protected]") do
											Citizen.Wait(1)
										end
										TaskPlayAnim(PlayerPedId(), "[email protected]", "pickup_low", 8.0, -8, 2000, 2, 0, 0, 0, 0)

										Citizen.Wait(2000)
										randomChance = math.random(1, 100)
										randomCommonWeapon = Config.CommonWeaponLoot[math.random(1, #Config.CommonWeaponLoot)]
										-- randomUncommonWeapon = Config.UncommonWeaponLoot[math.random(1, #Config.UncommonWeaponLoot)]
										-- randomRareWeapon = Config.RareWeaponLoot[math.random(1, #Config.RareWeaponLoot)]
										-- randomEpicWeapon = Config.EpicWeaponLoot[math.random(1, #Config.EpicWeaponLoot)]
										-- randomLegendaryWeapon = Config.LegendaryWeaponLoot[math.random(1, #Config.LegendaryWeaponLoot)]
										
										randomCommonItem = Config.CommonItemLoot[math.random(1, #Config.CommonItemLoot)]
										-- randomUncommonItem = Config.UncommonItemLoot[math.random(1, #Config.UncommonItemLoot)]
										-- randomRareItem = Config.RareItemLoot[math.random(1, #Config.RareItemLoot)]
										-- randomEpicItem = Config.EpicItemLoot[math.random(1, #Config.EpicItemLoot)]
										-- randomLegendaryItem = Config.LegendaryItemLoot[math.random(1, #Config.LegendaryItemLoot)]

										if randomChance > 0 and randomChance < Config.ProbabilityWeaponLoot then
											TriggerServerEvent('esx_zombiesystem:weaponloot', randomCommonWeapon)
										elseif randomChance >= Config.ProbabilityWeaponLoot and randomChance < Config.ProbabilityMoneyLoot then
											TriggerServerEvent('esx_zombiesystem:moneyloot')
										elseif randomChance >= Config.ProbabilityMoneyLoot and randomChance < Config.ProbabilityItemLoot then
											TriggerServerEvent('esx_zombiesystem:itemloot', randomCommonItem)
										elseif randomChance >= Config.ProbabilityItemLoot and randomChance < 100 then
											-- ESX.ShowNotification('You not found nothing')
											exports['dopeNotify2']:Alert("LOOT", "Du hast nichts gefunden", 5000, 'error')
										end
										ClearPedSecondaryTask(PlayerPedId())
										local model = GetEntityModel(entity)
										SetEntityAsNoLongerNeeded(entity)
										SetModelAsNoLongerNeeded(model)
										DeleteEntity(entity)
										table.remove(entitys, i)
									end
								end
							end
						end
					end
				end
			end
		end
	end)
end

Can someone tell me where to add the export to add the XP for a kill of an entity (Zombie), when I add it it’s inside the loop and i always get the XP until I loot the zombie although it should be only one time XP-Adding.

The replacement for this resource is currently available in beta: