Problem counting kills when misison finished

i made a function that i call when i finished the mission…

function peddead()
if countnumberofdead == 1 then

	
for a = 1, #trackedPeds do
if IsEntityDead(trackedPeds[a]) then
DeleteEntity(trackedPeds[a])
countkill = countkill +1
else
DeleteEntity(trackedPeds[a])



			--PlaySound(-1, "LOCAL_PLYR_CASH_COUNTER_INCREASE", "DLC_HEISTS_GENERAL_FRONTEND_SOUNDS", 0, 0, 1)
		end
end
end


countnumberofdead = 0
end

the problem is that it count the first time the kill i made.( i killed 3 guys so it count 3 guys.)

when i ask to finish mission again it count all the spawn i deleted… (17)

i want to remove those tracked ped…
here is the code that i used to insert trackedpeds:

local pos =  GetEntityCoords(GetPlayerPed(-1))
  local ped =  CreatePed(4, hash, -316.296, -967.748, 31.0806, 0.0, true, true)
table.insert(trackedPeds, ped)

so as you can see table.insert works… but if i want to remove all peds from the variable…
how? i want to count 0 next time i quit the mission because there is no other spawn after quiting the misison at first time

okay i found out how here the sinmple things to do.

the variable trackedPeds, set it to 0. there will be no more peds registered to count.

trackedPeds = 0