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 [URL="https://bitbucket.org/breakpointservers/bkacjios-glua-modules/src/c2d54eb24ba98c90911c88e01a9a4f6da3660526/gm_cvar3/?at=default"]cvar3[/URL] 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.
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ChatText]GM:ChatText[/url]
[QUOTE=sannys;51811875]Check the message and return true here.
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ChatText]GM:ChatText[/url][/QUOTE]
I don't really know anything about LUA so I wouldn't really know what to do...
[QUOTE=Eliturbo;51811902]I don't really know anything about LUA so I wouldn't really know what to do...[/QUOTE]
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:
[code]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)[/code]
[QUOTE=code_gs;51811916]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:
[code]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)[/code][/QUOTE]
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
[QUOTE=Eliturbo;51811938]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[/QUOTE]
You have to insert the vars you want to disable into the table.
[QUOTE=code_gs;51811955]You have to insert the vars you want to disable into the table.[/QUOTE]
Well, that would be ttt_traitor_pct. Should I just write that at some_var?
[QUOTE=Eliturbo;51811968]Well, that would be ttt_traitor_pct. Should I just write that at some_var?[/QUOTE]
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.
[QUOTE=code_gs;51812049]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.[/QUOTE]
So if I fell in that value, it should disappear? That doesn't seem to be working :/
Sorry, you need to Log In to post a reply to this thread.