Deathlog Help PLEASE

So, we have a deathlog custom function on server and I can’t find whats wrong with it so i thought maybe people who haven’t seen the function itself before might immediately spot the problem. Please Help. Thanks.


function BroadcastKiller(victim, entity, killer) -- This one tells the victim who killed him/her
		if victim != killer and killer:IsPlayer() and entity:IsPlayer() then -- If the victim was killed by another player, with a weapon.
			victim:AddChatText(teal, '[IceMod]', orange, 'You were killed by ', white, killer:Nick(), orange, '[', GetTeamColor(killer), GetTeamString(killer), orange, '] with weapon: ', white, entity:GetActiveWeapon():GetClass(), orange, '.')
		elseif victim == killer and killer == entity then -- If the victim suicided, or was slain
			victim:AddChatText(teal, '[IceMod]', orange, 'You committed suicide or were slain.') -- No way to check this without adding a decent amount of code in other files
		elseif entity:GetClass() == 'worldspawn' and killer:GetClass() == 'worldspawn' then -- If the victim died of fall damage
			victim:AddChatText(teal, '[IceMod]', orange, 'You fell to your death.')
		elseif entity:GetClass() == "entityflame" and killer:GetClass() == "entityflame" then -- If killed by fire
			victim:AddChatText(teal, '[IceMod]', orange, 'You burnt to death.')
		elseif entity:GetClass() == 'prop_physics' then -- If the entity is a prop
			if killer:GetClass() == 'prop_physics' then -- If the killer is also a prop
				victim:AddChatText(teal, '[IceMod]', orange, 'You were killed by a prop')
			elseif killer:IsPlayer() then -- If the killer is a player, it's likely that it's an explosive barrel set off by that player.
				if killer != victim then -- If the killer is not also the victim, it means it's not a suicide.
					victim:AddChatText(teal, '[IceMod]', orange, 'You were killed by a prop triggered by ', white, killer:GetName(), orange, '[', GetTeamColor(killer), GetTeamString(killer), orange, ']. Perhaps an explosive barrel?')
				else -- If the victim is the killer too, then it's an epic fail, and you suicided.
					victim:AddChatText(teal, '[IceMod]', orange, 'You were killed by a prop triggered by yourself. Perhaps an explosive barrel?')
				end
			end
		else
			victim:AddChatText(teal, '[IceMod]', orange, 'You were killed by ', white, killer:Nick(), orange,'[', GetTeamColor(killer),  GetTeamString(killer), orange, '] with ', white, entity:GetClass(), orange, '].') -- If none of the above, (unlikely,) then there is no way to determine how did you die.
		end
		PrintLog(victim, killer, entity)
	end
	hook.Add("PlayerDeath", "BroadcastKiller", BroadcastKiller)

Shows this: which doesn’t look right

[IceMod]You were killed by Pyro[innocent] with weapon: weapon_zm_shotgun.

It says the actual name of the weapon not the table class name which i have in seperate table.


wepnameswitch = {
	weapon_ttt_ak47 = "an AK47",
	ttt_c4 = "C4",
	weapon_ttt_glock = "a Glock",
	weapon_ttt_knife = "a knife",
	weapon_ttt_m3 = "a Pump Shotgun",
	weapon_ttt_m16 = "an M16",
	weapon_ttt_tmp = "a TMP",
	weapon_zm_mac10 = "a Mac10",
	weapon_zm_pistol = "a pistol",
	weapon_zm_revolver = "a Deagle",
	weapon_zm_rifle = "a rifle",
	weapon_zm_shotgun = "a Hunting Shotgun",
	weapon_zm_sledge = "a H.U.G.E-249",
	weapon_zm_improvised = "a crowbar",
	ttt_knife_proj = "a thrown knife",
	weapon_ttt_push = "a Newton Launcher",
	weapon_ttt_flaregun = "a flare gun",
	weapon_ttt_stungun = "a UMP Prototype",
	weapon_ttt_sipistol = "a silenced pistol",
	ttt_slam_trip = "a S.L.A.M.",
	ttt_bomb_station = "a bomb station",
	ttt_plasma = "a plasma grenade"
}

Idk whats wrong…

You’re not even calling the table, use ‘weaponswitch[entity:GetActiveWeapon():GetClass()]’.