• TTT death notifier
    15 replies, posted
i know there is lots of these, however the only ones that work on my server cause the dead players in global chat bug. Can somebody please give me one that will both work and not mess up the player death hooks.
No. Okay fine: [lua] ply:ChatPrint("You were killed by "..attacker:Nick().." who is a/an"..attacker:GetRole().."")[/lua] Just something simple like that.
That's probably because you're overriding default functions. Also, this can be fixed by just retuning false of the player isn't alive.
[QUOTE=code_gs;44579020]That's probably because you're overriding default functions. Also, this can be fixed by just retuning false of the player isn't alive.[/QUOTE] I'm very new to lua, how would I do that?
Maybe you should look in your other thread where I already posted the solution.
[QUOTE=code_gs;44579119]Maybe you should look in your other thread where I already posted the solution.[/QUOTE] That didnt work
Then you are overriding a function somewhere and you need to make it into a hook.
[QUOTE=code_gs;44579163]Then you are overriding a function somewhere and you need to make it into a hook.[/QUOTE] how do i do this? [editline]18th April 2014[/editline] It fixes when I take the killer notifier away [editline]18th April 2014[/editline] It fixes when I take the killer notifier away
[QUOTE=OnyxServers;44579210]how do i do this? [editline]18th April 2014[/editline] It fixes when I take the killer notifier away [editline]18th April 2014[/editline] It fixes when I take the killer notifier away[/QUOTE] Post your kill notifier.
[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]
Try [URL="http://facepunch.com/showthread.php?t=1273031&p=40769395&viewfull=1#post40769395"]this[/URL]: [code]function TTTDeath(ply, attacker, dmginfo) local role_color = { [ROLE_TRAITOR] = Color(255,0,0,255), [ROLE_INNOCENT] = Color(0,255,0,255), [ROLE_DETECTIVE] = Color(0,0,255,255) } if IsValid(attacker) and attacker:IsPlayer() then ply:ChatPrint(role_color[attacker:GetRole()],"You were killed by "..attacker:Nick().." who is a"..attacker:GetRoleString()..".") end end hook.Add("DoPlayerDeath", "TTTDeaths", TTTDeath)[/code]
[QUOTE=code_gs;44581043]User messages are deprecated. Try [URL="http://facepunch.com/showthread.php?t=1273031&p=40769395&viewfull=1#post40769395"]this[/URL]: [code]function TTTDeath(ply, attacker, dmginfo) local role_color = { [ROLE_TRAITOR] = Color(255,0,0,255), [ROLE_INNOCENT] = Color(0,255,0,255), [ROLE_DETECTIVE] = Color(0,0,255,255) } if IsValid(attacker) and attacker:IsPlayer() then ply:ChatPrint(role_color[attacker:GetRole()],"You were killed by "..attacker:Nick().." who is a"..attacker:GetRoleString()..".") end end hook.Add("DoPlayerDeath", "TTTDeaths", TTTDeath)[/code][/QUOTE] This doesn't work as a notifier and it also makes the bodies dissapear after they're killed.
Change DoPlayerDeath to PlayerDeath and dmginfo to victim.
[QUOTE=code_gs;44581506]Change DoPlayerDeath to PlayerDeath and dmginfo to victim.[/QUOTE] Still nothing shown in chat
Where are you placing it? Did you restart the server?
[URL="http://facepunch.com/showthread.php?t=1386772"]http://facepunch.com/showthread.php?t=1386772[/URL]
Sorry, you need to Log In to post a reply to this thread.