[HTML]if ( SERVER ) then
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[/HTML]
Code is not working
lua/autorun/something.lua
[QUOTE=ms333;39533748]lua/autorun/something.lua[/QUOTE]
thanks but now i get error saying [ERROR] lua/autorun/ttt_death_notify.lua:23: unexpected symbol near 'and' 1. unknown - lua/autorun/ttt_death_notify.lua:0
For people who can read code better with the lua tag:
[lua]
if ( SERVER ) then
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]
[editline]9th February 2013[/editline]
By the way, you might want to cleanup your code :/
bump
[QUOTE=I Like Cereal;39533844]For people who can read code better with the lua tag:
[lua]
if ( SERVER ) then
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]
[editline]9th February 2013[/editline]
By the way, you might want to cleanup your code :/[/QUOTE]
help please bump!!
Can you stop bumping every 2 hours? Nobody is going to help you.
on line 23 change to
[CODE]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) ),[/CODE]
I know this is really really really late, But I'm just going to post anyways:
Cleaned up code:
[CODE]if ( SERVER ) then
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[/CODE]
Sorry, you need to Log In to post a reply to this thread.