Death Notify

I have some code that was written up for me, but it was untested and I was unable to get a hold of the coder.
The code essentially prints in chat who you were killed by in TTT, so if you were killed by a Traitor for instance, it would say that in chat along with the traitors name.

[lua]if ( SERVER ) then
AddCSLuaFile(“autorun/ttt_death_notify.lua”)
hook.Add( “PlayerDeath”, “CHIIPPPSS” , function( Pl, Ent, Killer )

    umsg.Start( "PlayerDeathCustom", Pl )
        umsg.Entity( Killer )
        umsg.Bool( Killer:IsTraitor() )
        umsg.Bool( Killer:IsDetective() )
    umsg.End()
   
end)

else

usermessage.Hook( "PlayerDeathCustom" , function( um )
   
    local Killer = um:ReadEntity()
    local IsT = um:ReadBool()
    local IsD = um:ReadBool()
       
        chat.AddText( Color( 255,255,255 ) , "You've been killed by ", Color( 175,175,175 ), Killer:Nick(),
            Color( 255,255,255 ), ( ( IsT or IsD ) and ", a " or ", an " ), ( (IsT and Color( 255,99,99)) or IsD (and Color( 52,128, 209)) or Color(161,232,116) ),
            ( (IsT and "Traitor!") or (IsD and "Detective!") or "Innocent!" ) )

    chat.PlaySound()
       
end)

end[/lua]

I have no idea what the issue is.

Thanks

Is there any errors in the console when ya tested it?

I cannot remember if their were any, I cannot test it again at the moment :confused:
Sorry

Is it running? Does it say something in the chat?

Again, I am currently unable to test it. I am on my craptop.

EDIT: Opps, read that wrong. No nothing is posted in chat.

I just tested, the following error was printed on console "
[ERROR] lua/autorun/client/ttt_death_notify.lua:23: unexpected symbol near ‘and’

  1. unknown - lua/autorun/client/ttt_death_notify.lua:0
    "

The code here,



 Color( 255,255,255 ), ( ( IsT or IsD ) and ", a " or ", an " ), ( (IsT and Color( 255,99,99)) or IsD (and Color( 52,128, 209)) or Color(161,232,116) ),
                ( (IsT and "Traitor!") or (IsD and "Detective!") or "Innocent!" ) )


Has a bracket before the and, which the compiler is reading as an empty expression so it pops up an error, that line should become



 Color( 255,255,255 ), ( ( IsT or IsD ) and ", a " or ", an " ), ( (IsT and Color( 255,99,99)) or (IsD and Color( 52,128, 209)) or Color(161,232,116) ),
                ( (IsT and "Traitor!") or (IsD and "Detective!") or "Innocent!" ) )