diff options
| author | 12pm <30786226+12pm@users.noreply.github.com> | 2019-04-03 15:41:57 +0200 |
|---|---|---|
| committer | 12pm <30786226+12pm@users.noreply.github.com> | 2019-04-03 15:41:57 +0200 |
| commit | 8fdad7141b023ea77cc7e4ae5e41b8685d901cf9 (patch) | |
| tree | e71434c4d99a27c8207131b070e396dc74e4f3b6 | |
| parent | 012cda5afd013e27e529026b67722609ecd61d41 (diff) | |
| download | zcatch-8fdad7141b023ea77cc7e4ae5e41b8685d901cf9.tar.gz zcatch-8fdad7141b023ea77cc7e4ae5e41b8685d901cf9.zip | |
Add playerflags in status
| -rw-r--r-- | src/engine/server.h | 7 | ||||
| -rw-r--r-- | src/engine/server/server.cpp | 13 | ||||
| -rw-r--r-- | src/engine/server/server.h | 20 | ||||
| -rw-r--r-- | src/game/server/player.cpp | 19 |
4 files changed, 37 insertions, 22 deletions
diff --git a/src/engine/server.h b/src/engine/server.h index e250df88..1713b340 100644 --- a/src/engine/server.h +++ b/src/engine/server.h @@ -52,6 +52,7 @@ public: virtual void SetClientClan(int ClientID, char const *pClan) = 0; virtual void SetClientCountry(int ClientID, int Country) = 0; virtual void SetClientScore(int ClientID, int Score) = 0; + virtual void SetClientFlags(int ClientID, int Flags) = 0; virtual int SnapNewID() = 0; virtual void SnapFreeID(int ID) = 0; @@ -72,12 +73,12 @@ public: virtual bool DemoRecorder_IsRecording() = 0; //zCatch virtual void MapReload() = 0; - + virtual int GetInfoTextIntervalPause() = 0; virtual int GetInfoTextMsgInterval() = 0; virtual int GetInfoTextInterval() = 0; virtual std::string GetNextInfoText() = 0; - + virtual int GetNumLoggedInAdmins() = 0; }; @@ -111,7 +112,7 @@ public: virtual const char *NetVersion() = 0; virtual bool IsClientAimBot(int ClientID) = 0; - + virtual void InformPlayers(const char *pText) = 0; }; diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 37c6f430..75a95f59 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -490,6 +490,15 @@ void CServer::SetClientScore(int ClientID, int Score) m_aClients[ClientID].m_Score = Score; } +void CServer::SetClientFlags(int ClientID, int Flags) +{ + if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State < CClient::STATE_READY) + return; + + if(Flags > m_aClients[ClientID].m_Flags) + m_aClients[ClientID].m_Flags = Flags; +} + void CServer::Kick(int ClientID, const char *pReason) { if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State == CClient::STATE_EMPTY) @@ -2045,8 +2054,8 @@ void CServer::ConStatus(IConsole::IResult *pResult, void *pUser) pThis->m_aClients[i].m_Authed == CServer::AUTHED_SUBADMIN ? bBuf : pThis->m_aClients[i].m_Authed == CServer::AUTHED_MOD ? "(Mod)" : ""; const char *pAimBotStr = pThis->GameServer()->IsClientAimBot(i) ? "[aimbot]" : ""; - str_format(aBuf, sizeof(aBuf), "id=%d addr=%s name='%s' score=%d %s %s client=%d", i, aAddrStr, - pThis->m_aClients[i].m_aName, pThis->m_aClients[i].m_Score, pAuthStr, pAimBotStr, ((CGameContext *)(pThis->GameServer()))->m_apPlayers[i]->m_ClientVersion); + str_format(aBuf, sizeof(aBuf), "id=%d addr=%s name='%s' score=%d %s %s client=%d flags=%d", i, aAddrStr, + pThis->m_aClients[i].m_aName, pThis->m_aClients[i].m_Score, pAuthStr, pAimBotStr, ((CGameContext *)(pThis->GameServer()))->m_apPlayers[i]->m_ClientVersion, pThis->m_aClients[i].m_Flags); } else str_format(aBuf, sizeof(aBuf), "id=%d addr=%s connecting", i, aAddrStr); diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 23c6ae5e..86f31ae6 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -68,11 +68,11 @@ class CServer : public IServer class IGameServer *m_pGameServer; class IConsole *m_pConsole; class IStorage *m_pStorage; - + // keep track of how many admins are logged in int m_numLoggedInAdmins; void UpdateLoggedInAdmins(); - + // info messages void UpdateInfoTexts(); struct CInfoText @@ -87,7 +87,7 @@ class CServer : public IServer int m_InfoTextInterval; int m_InfoTextMsgInterval; int m_InfoTextIntervalPause; - + public: class IGameServer *GameServer() { return m_pGameServer; } class IConsole *Console() { return m_pConsole; } @@ -149,6 +149,7 @@ public: std::string m_SubAdminAuthName; std::string m_SubAdminAuthPass; int m_SubAdminCommandPassFails; + int m_Flags; const IConsole::CCommandInfo *m_pRconCmdToSend; @@ -195,6 +196,7 @@ public: virtual void SetClientClan(int ClientID, char const *pClan); virtual void SetClientCountry(int ClientID, int Country); virtual void SetClientScore(int ClientID, int Score); + virtual void SetClientFlags(int ClientID, int Flags); void Kick(int ClientID, const char *pReason); @@ -267,10 +269,10 @@ public: virtual void SnapFreeID(int ID); virtual void *SnapNewItem(int Type, int ID, int Size); void SnapSetStaticsize(int ItemType, int Size); - + //zCatch virtual void MapReload(); - + // voteban system // struct CVotebanAddr // { @@ -300,7 +302,7 @@ public: static void ConVotebans(IConsole::IResult *pResult, void *pUser); static void ConAddLogin(IConsole::IResult *pResult, void *pUser); static void ConRemoveLogin(IConsole::IResult *pResult, void *pUser); - + // info messages static void ConAddInfo(IConsole::IResult *pResult, void *pUser); static void ConRemoveInfo(IConsole::IResult *pResult, void *pUser); @@ -309,13 +311,13 @@ public: int GetInfoTextMsgInterval() { return m_InfoTextMsgInterval; } int GetInfoTextInterval() { return m_InfoTextInterval; } std::string GetNextInfoText(); - + virtual int GetNumLoggedInAdmins() { return m_numLoggedInAdmins; } - + // logins typedef std::map<std::string,std::string>::iterator loginiterator; std::map<std::string,std::string> logins; - + // log some client out of the rcon void rconLogClientOut(int ClientID, const char *msg = "Logout successful."); }; diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 2081ad4a..bb227dcc 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -21,7 +21,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team) m_SpectatorID = SPEC_FREEVIEW; m_LastActionTick = Server()->Tick(); m_TeamChangeTick = Server()->Tick(); - + //zCatch m_CaughtBy = ZCATCH_NOT_CAUGHT; m_SpecExplicit = false; @@ -31,12 +31,12 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team) m_TicksSpec = 0; m_TicksIngame = 0; m_ChatTicks = 0; - + // zCatch/TeeVi m_ZCatchVictims = NULL; m_zCatchNumVictims = 0; m_zCatchNumKillsInARow = 0; - + // bot detection m_IsAimBot = 0; m_AimBotIndex = 0; @@ -59,7 +59,7 @@ CPlayer::~CPlayer() m_ZCatchVictims = tmp->prev; delete tmp; } - + delete m_pCharacter; m_pCharacter = 0; @@ -75,14 +75,14 @@ void CPlayer::Tick() return; Server()->SetClientScore(m_ClientID, m_Score); - + /* begin zCatch*/ - + if(m_Team == TEAM_SPECTATORS) m_TicksSpec++; else m_TicksIngame++; - + if(m_ChatTicks > 0) m_ChatTicks--; @@ -142,7 +142,7 @@ void CPlayer::Tick() ++m_LastActionTick; ++m_TeamChangeTick; } - + // bot detection m_LastTarget = m_CurrentTarget; m_CurrentTarget.x = m_LatestActivity.m_TargetX; @@ -245,6 +245,9 @@ void CPlayer::OnPredictedInput(CNetObj_PlayerInput *NewInput) void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput) { + if(NewInput->m_PlayerFlags) + Server()->SetClientFlags(m_ClientID, NewInput->m_PlayerFlags); + if(NewInput->m_PlayerFlags&PLAYERFLAG_CHATTING) { // skip the input if chat is active |