TTT: Player and spectator chat channels #977

Merged
merged 6 commits into from Jun 3, 2015

Projects

None yet
@Kefta
Contributor
Kefta commented Jun 3, 2015

No more shitty redirects, no more tag ghosting. Uses a series of checks in PlayerCanSeePlayersChat (thanks Robot) to direct who can view chat. Tested extensively for the past two days with multiple people.

@comedinha
Contributor

It is possible traitors talk only with traitors and traitors talk with innocent?

@Kefta
Contributor
Kefta commented Jun 3, 2015

Yes. Everyone can see normal chat, but only traitors/detectives and see their respective team chats. Innocent team chat will just redirect to the main chat without a team tag to prevent metagaming.

@bmwalters bmwalters and 1 other commented on an outdated diff Jun 3, 2015
garrysmod/gamemodes/terrortown/gamemode/gamemsg.lua
end
-
+
@bmwalters
bmwalters Jun 3, 2015 Contributor

hnng

@Kefta
Kefta Jun 3, 2015 Contributor

Sorry there, pal

@bmwalters
bmwalters Jun 3, 2015 Contributor

you ought to fix that, pal
(ง'̀-'́)ง

@Kefta
Kefta Jun 3, 2015 Contributor

Submit your own PR; I'm not adding another commit, pal 🌜

@robotboy655 robotboy655 added the TTT label Jun 3, 2015
@svdm svdm merged commit 39638ba into garrynewman:master Jun 3, 2015
@comedinha
Contributor

2015-06-03_00001
When innocents say on the team chat show (TEAM) message

@comedinha
Contributor

This make the player has proven

@Kefta
Contributor
Kefta commented Jun 3, 2015

Can you check if that chatbox overrides the OnPlayerChat hook? I made it so that it doesn't on the default one

@meepdarknessmeep
Contributor

that might be because of your overridden chatbox addon not properly handling it

@comedinha
Contributor
net.Receive("atlaschat.chatText", function(bits)
    local text = net.ReadString()
    local player = net.ReadEntity()
    local team = util.tobool(net.ReadBit())
    local dead = IsValid(player) and !player:Alive() or false

    hook.Run("OnPlayerChat", player, text, team, dead)
end)

Team is bool

@Kefta
Contributor
Kefta commented Jun 3, 2015

What's the net.Send code that's attached to it?

@meepdarknessmeep
Contributor

local player = net.ReadEntity()

pls no

@Chewgum
Contributor
Chewgum commented Jun 3, 2015

What is the issue with that @meepdarknessmeep ?

@meepdarknessmeep
Contributor

net.WriteString("!ban ^ 0 you are a BITCH")
net.WriteEntity(admin)
net.WriteBit(0)

@Chewgum
Contributor
Chewgum commented Jun 3, 2015

What?

@willox
Collaborator
willox commented Jun 3, 2015

Meep's dumb.

@meepdarknessmeep
Contributor

nevermind it's a clientside hook /suicide

@Chewgum
Contributor
Chewgum commented Jun 3, 2015

My chatbox does not override anything and it uses whatever the OnPlayerChat hook passes onto chat.AddText. I also run the "PlayerSay" hook for the text and the "PlayerCanSeePlayersChat" hook when I build my filter. Either comedinha is using some very old version or he/she has some other addon that is messing with chat. I did have to update my chat with the removal of "LANG.Msg("spec_teamchat_hint")" though, but that shouldn't cause this issue..

net.Receive("atlaschat.chat", function(bits, player)
if (player.nextMessageAtlas > CurTime()) then return end

player.nextMessageAtlas = CurTime() +0.25

local text = net.ReadString()
local team = util.tobool(net.ReadBit())

text = string.sub(text, 0, 127)

local newText = hook.Run("PlayerSay", player, text, team, !player:Alive())

-- A workaround for dumb coders that return a boolean in the PlayerSay hook.
if (isstring(newText)) then
    text = newText
elseif (not newText) then
    text = ""
end

if (text != "") then
    if (game.IsDedicated()) then
        ServerLog(player:Nick() .. ": " .. text .. "\n")
    end

    local filter = {}
    local players = util.GetPlayers()

    for i = 1, #players do
        local target = players[i]

        if (IsValid(target)) then
            local canSee = hook.Run("PlayerCanSeePlayersChat", text, team, target, player)

            if (canSee or target == player) then
                table.insert(filter, target)
            end
        end
    end

    net.Start("atlaschat.chatText")
        net.WriteString(text)
        net.WriteEntity(player)
        net.WriteBit(team)
    net.Send(filter)
end
end)

net.Receive("atlaschat.chatText", function(bits)
    local text = net.ReadString()
    local player = net.ReadEntity()
    local team = util.tobool(net.ReadBit())
    local dead = IsValid(player) and !player:Alive() or false

    hook.Run("OnPlayerChat", player, text, team, dead)
end)
@comedinha
Contributor
@CSchulz
Contributor
CSchulz commented Jun 20, 2015

Pressing y as spectator results in "[ERROR: Translation of spec_teamchat_hint not found]".

@Kefta
Contributor
Kefta commented Jun 20, 2015

@CSchulz Cannot replicate. Can you please download the terrortown gamemode from the master branch and report back if the error is still occuring?

@CSchulz
Contributor
CSchulz commented Jun 20, 2015

So Translations aren't synchronized from the server to the client?

@Kefta
Contributor
Kefta commented Jun 20, 2015

@CSchulz No, I removed that translation since it isn't used anymore with this change. That's why I asked you to redownload the gamemode since it seems you have outdated language files.

@willox
Collaborator
willox commented Jun 20, 2015

Could be the custom chatbox mentioned above (or another).

@CSchulz
Contributor
CSchulz commented Jun 20, 2015

Alright so nevermind, I hoped the files are synchronized. So I need to wait til the new client is available.

@Chewgum
Contributor
Chewgum commented Jun 20, 2015

The current version of my chatbox is still using "spec_teamchat_hint" since the version of TTT on gmod still has that. If you're using my chatbox (atlaschat) CShulz, you'll get that errror.

@boyraad300

dude this caused errors for my server [ERROR: Translation of spec_teamchat_hint not found] where'd u expect ttt to get those lines of language from if you deleted it???

Contributor

@boyraad300 Are you using AtlasChat?

@Kefta nope using default chat

Contributor
Bo98 replied Jun 23, 2015

The TTT gamemode doesn't use spec_teamchat_hint anymore which is why it was removed. If you are getting that error then some addon must still be trying to use it. It could be another TTT chat addon that's not AtlasChat (idk which).

This is pretty weird ever since updating ttt ive been having all sorts of problems, binds still work when players are dead, this one and i dont think i have any addons installed that would mess with the default ttt gamemode

What fixed it for me was completely re-downloading the terrortown-folder from github.

Contributor
Bo98 replied Jun 26, 2015

The TTT gamemode doesn't use spec_teamchat_hint anymore which is why it was removed. If you are getting that error then some addon must still be trying to use it.

Contributor

You can check the latest files yourself; the translation isn't called ANYWHERE

@doctorluk
Contributor

Can confirm the problem @comedinha has reported.

In TTT, when you're innocent, you can use the Team chat, which everyone can see, but Traitors cannot use. This automatically results in this player being prooven innocent, which essentially breaks the game.
This change made it into the 07/02/15 update and is now stressing me and my moderators out.

@Kefta
Contributor
Kefta commented Jul 3, 2015

@doctorluk We have already traced the problem down to outdated addons. Remove them

@doctorluk
Contributor

I do not use the addon mentioned above, I'll try to track it down in the ULX forums. Thanks for the hint!

EDIT: It's this addon: Player Chat Tags [2.58v] http://forums.ulyssesmod.net/index.php/topic,6196.0.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment