I was trying to find the root of my problems that was causing dead players to be able to use global chat in TTT. I was wondering how to alter this so I could still use this (death notifier) but not create the bug. This is the code from the ttt_notifier.lua file:
[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 this
[code]hook.Add( "PlayerSay", 0, function( ply, text, team )
if not ply:Alive() then return false end
end )[/code]
He just gave a chunk from TTT, no one's bothered to convert it so far.
Also, that won't work, since spectators are still technically alive in TTT, if I remember correctly. I think there's a custom function for checking if they're spectating:
[lua]hook.Add( "PlayerSay", 0, function( ply, text, team )
return not ply:IsSpec()
end )[/lua]
That won't work either because they can be alive but not a spectator; are spectators seriously alive in TTT? I find that hard to believe. Anyways, this should work:
[code]hook.Add( "PlayerSay", 0, function( ply, text, team )
if not ply:Alive() or ply:IsSpec() then return false end
end )[/code]
[QUOTE=code_gs;44578477]That won't work either because they can be alive but not a spectator; are spectators seriously alive in TTT? I find that hard to believe. Anyways, this should work:
[code]hook.Add( "PlayerSay", 0, function( ply, text, team )
if not ply:Alive() or ply:IsSpec() then return false end
end )[/code][/QUOTE]
Do i just replace that with the previous hook?
No just drop it at the bottom init.lua, should be fine there.
[QUOTE=Internet1001;44578536]No just drop it at the bottom init.lua, should be fine there.[/QUOTE]
so just at the bottom of \garrysmod\gamemodes\terrortown\gamemode\init.lua?
done this and dead players killed by world still show in global chat, any suggestions?
[QUOTE=code_gs;44578477]That won't work either because they can be alive but not a spectator; are spectators seriously alive in TTT? I find that hard to believe. Anyways, this should work:
[code]hook.Add( "PlayerSay", 0, function( ply, text, team )
if not ply:Alive() or ply:IsSpec() then return false end
end )[/code][/QUOTE]
Just so you know, it doesn't think its dead.
IF you have ULX, it is usually the reason players can chat while dead. I'd recommend removing ULX and using a different admin mod.
you're all forgetting to check if the killer was a player
it's trying to call player functions on the world (fall damage?), creating an error and not properly killing the player
I scripted a new notifier and the problem fixed itself
In TTT use :IsTerror()
Sorry, you need to Log In to post a reply to this thread.