Skip to content

Commit

Permalink
added sv_forceGear
Browse files Browse the repository at this point in the history
Allow server admins to set a specific gear for all players.

Co-Authored-By: Taras Mykhailovych <6552671+tarquas@users.noreply.github.com>
  • Loading branch information
BidyBiddle and tarquas committed Dec 22, 2021
1 parent 713df41 commit ae6184b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions code/server/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ extern cvar_t *sv_sayprefix;
extern cvar_t *sv_tellprefix;
extern cvar_t *sv_teamSwitch; // allow players to switch teams (0, Default = players must wait 5 seconds, 1 = no restriction)
extern cvar_t *sv_substitute; // allow players to use /sub in matchmode (1, Default = substitutes enabled, 0 = disabled)
extern cvar_t *sv_forceGear; // Every client's gear will be set to this value ("", Default = empty string meaning no restriction)

#ifdef USE_VOIP
extern cvar_t *sv_voip;
Expand Down
8 changes: 8 additions & 0 deletions code/server/sv_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,10 @@ void SV_UpdateUserinfo_f( client_t *cl ) {

Q_strncpyz( cl->userinfo, Cmd_Argv(1), sizeof(cl->userinfo) );

if (sv_forceGear && Q_stricmp(sv_forceGear->string, "")) {
Info_SetValueForKey(cl->userinfo, "gear", sv_forceGear->string);
}

SV_UserinfoChanged( cl );
// call prog code to allow overrides
VM_Call( gvm, GAME_CLIENT_USERINFO_CHANGED, cl - svs.clients );
Expand Down Expand Up @@ -1399,6 +1403,10 @@ void SV_ClientThink (client_t *cl, usercmd_t *cmd) {
return; // may have been kicked during the last usercmd
}

if (sv_forceGear && Q_stricmp(sv_forceGear->string, "")) {
Info_SetValueForKey(cl->userinfo, "gear", sv_forceGear->string);
}

#ifdef USE_SKEETMOD
SV_SkeetBackupPowerups(cl);
#endif
Expand Down
1 change: 1 addition & 0 deletions code/server/sv_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,7 @@ void SV_Init (void)
sv_tellprefix = Cvar_Get ("sv_tellprefix", "console_tell: ", CVAR_ARCHIVE );
sv_teamSwitch = Cvar_Get("sv_teamSwitch", "0", CVAR_ARCHIVE );
sv_substitute = Cvar_Get ("sv_substitute", "1", CVAR_ARCHIVE );
sv_forceGear = Cvar_Get ("sv_forceGear", "", CVAR_ARCHIVE );
sv_extraPaks = Cvar_Get ("sv_extraPaks", "", CVAR_ARCHIVE | CVAR_LATCH);
sv_extraPure = Cvar_Get ("sv_extraPure", "0", CVAR_ARCHIVE | CVAR_LATCH);

Expand Down
1 change: 1 addition & 0 deletions code/server/sv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ cvar_t *sv_tellprefix;
cvar_t *sv_sayprefix;
cvar_t *sv_teamSwitch; // allow players to switch teams (0, Default = players must wait 5 seconds to switch, 1 = no restriction)
cvar_t *sv_substitute; // allow players to use /sub in matchmode (1, Default = substitutes enabled, 0 = disabled)
cvar_t *sv_forceGear; // Every client's gear will be set to this value ("", Default = empty string meaning no restriction)

#ifdef USE_VOIP
cvar_t *sv_voip;
Expand Down

0 comments on commit ae6184b

Please sign in to comment.