Skip to content

Commit

Permalink
"sv_disableChat" dvar
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Maxxx committed Jun 18, 2017
1 parent 3c21aa2 commit e2e3207
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@ Versions in this file correspond to git tags.
## Unreleased
### Changes
#### Makefiles
Now you can use "sv_disableChat" dvar to disable chat messages on server (commands "$..." still available).
incremental builds are now possible. `make -f makefile2` runs the new build scripts. appveyor and travis continuous integration services have been updated to the new buildprocess.

## 17.3
Expand Down
6 changes: 6 additions & 0 deletions src/g_sv_cmds.c
Expand Up @@ -585,6 +585,12 @@ __cdecl void G_Say(gentity_t *ent, gentity_t *target, int mode, const char *chat
return;
}

if (sv_disableChat->boolean == qtrue)
{
SV_GameSendServerCommand(ent->s.number, 0, "\x67 \"Chat messages disabled on this server\"");
return;
}

switch (mode)
{
default:
Expand Down
1 change: 1 addition & 0 deletions src/server.h
Expand Up @@ -829,6 +829,7 @@ extern cvar_t* sv_hostname;
extern cvar_t* sv_shownet;
extern cvar_t* sv_legacymode;
extern cvar_t* sv_steamgroup;
extern cvar_t* sv_disableChat;

void __cdecl SV_StringUsage_f(void);
void __cdecl SV_ScriptUsage_f(void);
Expand Down
2 changes: 2 additions & 0 deletions src/sv_main.c
Expand Up @@ -130,6 +130,7 @@ cvar_t* sv_shownet;
cvar_t* sv_updatebackendname;
cvar_t* sv_legacymode;
cvar_t* sv_steamgroup;
cvar_t* sv_disableChat;

serverStaticExt_t svse; // persistant server info across maps
permServerStatic_t psvs; // persistant even if server does shutdown
Expand Down Expand Up @@ -3087,6 +3088,7 @@ void SV_InitCvarsOnce(void){
sv_shownet = Cvar_RegisterInt("sv_shownet", -1, -1, 63, 0, "Enable network debugging for a client");
sv_updatebackendname = Cvar_RegisterString("sv_updatebackendname", UPDATE_PROXYSERVER_NAME, CVAR_ARCHIVE, "Hostname for the used clientupdatebackend");
sv_legacymode = Cvar_RegisterBool("sv_legacyguidmode", qfalse, CVAR_ARCHIVE, "outputs pbguid on status command and games_mp.log");
sv_disableChat = Cvar_RegisterBool("sv_disablechat", qfalse, CVAR_ARCHIVE, "Disable chat messages from clients");
}


Expand Down

0 comments on commit e2e3207

Please sign in to comment.