Wasn't entirely sure where to put this, seems like the best possible place. Feel free to move it if that's wrong. With today's Garry's Mod update, servers running the Trouble in Terrorist Town gamemode will crash whenever a dead player/spectator tries to talk in global chat. I made a quick fix for it for my own server, and figured it would be helpful if I posted it here.
NOTE: May not be compatible with any custom chat boxes. Then again, it also might be. I don't have one :P
[CODE]hook.Add( "PlayerSay", "Stop The Dang Crashing", function( sender, text, teamChat )
if SERVER then
if GetRoundState() == ROUND_ACTIVE and teamChat == false and not sender:Alive() then
sender:PrintMessage( HUD_PRINTTALK, "You can't talk in global chat right now!" )
return false
elseif GetRoundState() == ROUND_ACTIVE and teamChat == false and sender:Team() == TEAM_SPEC then
sender:PrintMessage( HUD_PRINTTALK, "You can't talk in global chat right now!" )
return false
elseif GetRoundState() == ROUND_ACTIVE and teamChat == true and sender:Team() == TEAM_TERROR and sender:GetRole() == ROLE_INNOCENT then
sender:PrintMessage( HUD_PRINTTALK, "You can't talk in team chat right now!" )
return false
end
end
end )[/CODE]
You can just drop that in any file in your lua/autorun directory.
Actually, just download the revert from the GitHub. It's already fixed.
[editline]1st June 2015[/editline]
I'm currently working on a permanent fix while still adding the changes I made before; apparently, PlayerSay team functionality is a bit broken.
Well then let's call this a temporary solution :P
But how would I go about reverting?
[QUOTE=B10H4Z4RD;47857556]Well then let's call this a temporary solution :P
But how would I go about reverting?[/QUOTE]
[url]https://github.com/garrynewman/garrysmod/tree/master/garrysmod/gamemodes/terrortown[/url]
Sorry, you need to Log In to post a reply to this thread.