Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HL2MP] Add proper server admin tools #948

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions game/mod_hl2mp/cfg/admin/admins.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"Admins"
{
"[U:1:00000000]"
{
"flags" "z"
}
}
43 changes: 43 additions & 0 deletions src/game/server/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "datacache/imdlcache.h"
#include "basemultiplayerplayer.h"
#include "voice_gamemgr.h"
#include "tier0/icommandline.h"

#ifdef TF_DLL
#include "tf_player.h"
Expand Down Expand Up @@ -249,6 +250,48 @@ void Host_Say( edict_t *pEdict, const CCommand &args, bool teamonly )
bSenderDead = false;
}

if ( !CommandLine()->CheckParm( "-noadmin" ) )
{
if ( Q_strncmp( p, "/kick", strlen( "/kick" ) ) == 0 ||
Q_strncmp( p, "/ban", strlen( "/ban" ) ) == 0 ||
Q_strncmp( p, "/addban", strlen( "/addban" ) ) == 0 ||
Q_strncmp( p, "/unban", strlen( "/unban" ) ) == 0 ||
Q_strncmp( p, "/slap", strlen( "/slap" ) ) == 0 ||
Q_strncmp( p, "/slay", strlen( "/slay" ) ) == 0 ||
Q_strncmp( p, "/noclip", strlen( "/noclip" ) ) == 0 ||
Q_strncmp( p, "/team", strlen( "/team" ) ) == 0 ||
Q_strncmp( p, "/gag", strlen( "/gag" ) ) == 0 ||
Q_strncmp( p, "/ungag", strlen( "/ungag" ) ) == 0 ||
Q_strncmp( p, "/mute", strlen( "/mute" ) ) == 0 ||
Q_strncmp( p, "/unmute", strlen( "/unmute" ) ) == 0 ||
Q_strncmp( p, "/bring", strlen( "/bring" ) ) == 0 ||
Q_strncmp( p, "/goto", strlen( "/goto" ) ) == 0 ||
Q_strncmp( p, "/map", strlen( "/map" ) ) == 0 ||
Q_strncmp( p, "/cvar", strlen( "/cvar" ) ) == 0 ||
Q_strncmp( p, "/exec", strlen( "/exec" ) ) == 0 ||
Q_strncmp( p, "/rcon", strlen( "/rcon" ) ) == 0 ||
Q_strncmp( p, "/say", strlen( "/say" ) ) == 0 ||
Q_strncmp( p, "/csay", strlen( "/csay" ) ) == 0 ||
Q_strncmp( p, "/psay", strlen( "/psay" ) ) == 0 ||
Q_strncmp( p, "/chat", strlen( "/chat" ) ) == 0 )
{
if ( args.ArgC() > 1 )
{
return;
}
}

if ( FStrEq( p, "/sa" ) ||
FStrEq( p, "/credits" ) ||
FStrEq( p, "/version" ) ||
FStrEq( p, "/help" ) ||
FStrEq( p, "/reloadadmins" ) )
return;
}

if ( pPlayer && pPlayer->IsGagged() )
return;

const char *pszFormat = NULL;
const char *pszPrefix = NULL;
const char *pszLocation = NULL;
Expand Down
3 changes: 3 additions & 0 deletions src/game/server/gameinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
#include "particle_parse.h"
#ifndef NO_STEAM
#include "steam/steam_gameserver.h"
#include "hl2mp/admin/hl2mp_serveradmin.h"
#endif
#include "tier3/tier3.h"
#include "serverbenchmark_base.h"
Expand Down Expand Up @@ -967,6 +968,8 @@ bool CServerGameDLL::LevelInit( const char *pMapName, char const *pMapEntities,
pItemSchema->BInitFromDelayedBuffer();
}
#endif // USES_ECON_ITEMS

CHL2MP_Admin::InitAdminSystem();

ResetWindspeed();
UpdateChapterRestrictions( pMapName );
Expand Down
2 changes: 1 addition & 1 deletion src/game/server/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#pragma once
#endif


#define VERSION "1.0"
extern Vector g_vecAttackDir;
extern int g_iSkillLevel;
extern bool g_fGameOver;
Expand Down
Loading