(lua/autorun/server/filename.lua)Serverside:
hook.Add("PlayerDeath", "Who Killed You", function(vic, infl, att)
if (att:IsPlayer() && vic:IsPlayer()) then
vic:PrintMessage(HUD_PRINTTALK, "You were killed by "..att:Nick().." ["..att:GetRoleString().."!]")
end
end)
hook.Add("PlayerDeath", "Who You Killed", function(vic, infl, att)
if (att:IsPlayer() && vic:IsPlayer()) then
att:PrintMessage(HUD_PRINTTALK, "You killed "..vic:Nick().." ["..vic:GetRoleString().."]")
end
end)
This is already on my server(CyberGmod.net TTT server).
Thanks to BKU for helping me with a few GModdish issues.(Failing if i specify the code outside the hook, aka, calling a function on death, so i had to put it inside a hook, silly, i know, but it worked..)
I was trying something with umsg's for chat coloring, but i don't think that its needed that much.
Basically, this will tell you who killed you, when you die and what role they were. It also tells the killer the name of the person they killed. You don't really need that, but you can have it as an extra if you want it. If not, remove the second hook.