I'm trying to make a death notification thing for TTT and right now I have:
function notifyDeath( victim, inflictor, attacker )
if victim == attacker then
victim:PrintMessage( HUD_PRINTTALK, "You killed yourself. Good job." )
elseif !attacker:IsPlayer() then
victim:PrintMessage( HUD_PRINTTALK, "You probably fell to your death." )
elseif attacker:GetRole() == ROLE_TRAITOR then
ULib.tsayColor( victim, "You were killed by " .. Color( 255, 0, 0 ) .. attacker:Nick() .. Color( 255, 255, 255 ) .. " who was a " .. Color( 255, 0, 0 ) .. "Traitor!" )
elseif attacker:getRole() == ROLE_INNOCENT then
ULib.tsayColor( victim, "You were killed by " .. Color( 0, 255, 0 ) .. attacker:Nick() .. Color( 255, 255, 255 ) .. " who was an " .. Color( 0, 255, 0 ) .. "Innocent!" )
elseif attacker:getRole() == ROLE_DETECTIVE then
ULib.tsayColor( victim, "You were killed by " .. Color( 0, 0, 255 ) .. attacker:Nick() .. Color( 255, 255, 255 ) .. " who was a " .. Color( 0, 0, 255 ) .. "Detective!" )
end
end
hook.Add( "PlayerDeath", "deathNotif", notifyDeath )
but it's not working... right now I have it in
garrysmod/addons/deathnotify/lua/autorun, is this the right place to put it or what? There were no errors in the console (neither client nor server) but I'm getting no message in the chat.
I've only tried killing myself as I didn't have anyone to test it on at the time..