Colored role tags

I want to make a script that when you get the message “You were killed by a Traitor” the word “Traitor” is red, or when “You were killed by a Detective” the word “Detective” is blue, or when “killed by prop/world” the words “prop/world” is grey. This is what I have.

function CustomTTTMsg(ply_or_rfilter, msg, clr)
clr = clr or Color(255, 255, 255, 255)

umsg.Start(“game_msg_color”, ply_or_rfilter)
umsg.String(msg)
umsg.Short(clr.r)
umsg.Short(clr.g)
umsg.Short(clr.b)
umsg.End()
end

hook.Add(“DoPlayerDeath”, “MistRDMDet_NotifyDeaths”, function(ply, attacker, dmginfo)

if IsValid(attacker) and attacker:IsPlayer() then
if attacker == ply then
CustomTTTMsg(ply, “You killed yourself”, COLOR_GREEN)
else
local clr = attacker:GetRole() == ROLE_TRAITOR and COLOR_RED or COLOR_GREEN
CustomTTTMsg(ply, "You were killed by a " … attacker:GetRoleString(), clr)
end
else
CustomTTTMsg(ply, “You were killed by <something/world>”, COLOR_WHITE)
end

end)

Could someone help me out?

I think the lua section will be more help.

i put the lua tag on it? o.0

[editline]26th November 2012[/editline]

oh my bad