Disable value changes showing in chat

Hello,

Is there any way I can disable messages like “Server cvar ‘sv_cheats’ changed to 0” from showing up in the chat? I want to play TTT with some friends but I have a script running that changes the traitor percentage every time. I don’t want everyone to see that workout having them disable their chat altogether.

Thanks!

You can use cvar3 to remove the FCVAR_NOTIFY flag from sv_cheats.

The sv_cheats was just an example. The command I do need the notification removed from is ttt_traitor_pct. Would that work the same way? I also don’t really have an idea how that works. There isn’t just a simple command to turn it off?

ttt_traitor_pct is not an engine command, so you can just edit the source code, or recreate the convar after the original.

Check the message and return true here.

GM:ChatText

I don’t really know anything about LUA so I wouldn’t really know what to do…

There’s an example at the bottom on how to use the hook. It seems like convar changing messages don’t have a type, so you’ll have to do something hacky like this:


local tBlockedVars = {
   some_var = true,
   some_other_var = true
}

hook.Add("ChatText", "foo", function(_, _, sText)
   if (sText:sub(1, 11) == "Server cvar") then
      local iEnd = sText:find("'", 14, true)
      
      if (iEnd and tBlockedVars[sText:sub(14, iEnd - 1)]) then
         return true
      end
   end
end)

But I guess that I should still enter some stuff into that code? Like I said, I don’t know anything about LUA. The script that changed the t percentage I got from this forum. Sorry for being so noob-ish xD

You have to insert the vars you want to disable into the table.

Well, that would be ttt_traitor_pct. Should I just write that at some_var?

The table will make any vars you set to true as ignored in chat. some_var is an example, so you would do that with any convar you want.

So if I fell in that value, it should disappear? That doesn’t seem to be working :confused: