CClient improvements

Mapped out new fields in CClient
This commit is contained in:
Kawe Mazidjatari 2022-06-14 21:41:35 +02:00
parent ebf4921063
commit e5f412bcb2
3 changed files with 39 additions and 9 deletions

View File

@ -22,7 +22,15 @@ CClient* CClient::GetClient(int nIndex) const
//---------------------------------------------------------------------------------
// Purpose: gets the userID of this client
//---------------------------------------------------------------------------------
int32_t CClient::GetUserID(void) const
uint16_t CClient::GetHandle(void) const
{
return m_nHandle;
}
//---------------------------------------------------------------------------------
// Purpose: gets the userID of this client
//---------------------------------------------------------------------------------
uint32_t CClient::GetUserID(void) const
{
return m_nUserID;
}
@ -59,6 +67,22 @@ CNetChan* CClient::GetNetChan(void) const
return m_NetChannel;
}
//---------------------------------------------------------------------------------
// Purpose: gets the server name of this client (name is managed by server!)
//---------------------------------------------------------------------------------
const char* CClient::GetServerName(void) const
{
return m_szServerName;
}
//---------------------------------------------------------------------------------
// Purpose: gets the server name of this client (as obtained from the connectionless packet)
//---------------------------------------------------------------------------------
const char* CClient::GetClientName(void) const
{
return m_szClientName;
}
//---------------------------------------------------------------------------------
// Purpose: sets the userID of this client
//---------------------------------------------------------------------------------

View File

@ -16,11 +16,14 @@ class CClient : INetChannelHandler, IClientMessageHandler
{
public:
CClient* GetClient(int nIndex) const;
int32_t GetUserID(void) const;
uint16_t GetHandle(void) const;
uint32_t GetUserID(void) const;
uint64_t GetOriginID(void) const;
SIGNONSTATE GetSignonState(void) const;
PERSISTENCE GetPersistenceState(void) const;
CNetChan* GetNetChan(void) const;
const char* GetServerName(void) const;
const char* GetClientName(void) const;
void SetUserID(int32_t nUserID);
void SetOriginID(uint64_t nOriginID);
void SetSignonState(SIGNONSTATE nSignonState);
@ -39,10 +42,13 @@ public:
static void VClear(CClient* pBaseClient);
private:
int32_t m_nUserID; //0x0010
char pad_0014[68]; //0x0014
uint32_t m_nUserID; //0x0010
uint16_t m_nHandle; //0x0014
char m_szServerName[64]; //0x0016
int64_t m_nReputation; //0x0058
char pad_0015[768]; //0x0060
char pad_0014[182]; //0x0060
char m_szClientName[64]; //0x0116
char pad_0015[522]; //0x0156
KeyValues* m_ConVars; //0x0360
char pad_0368[8]; //0x0368
CServer* m_pServer; //0x0370

View File

@ -140,9 +140,9 @@ void Host_KickID_f(const CCommand& args)
continue;
}
}
else // If its not try by userID.
else // If its not try by handle.
{
int64_t nClientID = static_cast<int64_t>(pClient->GetUserID() + 1); // Get userID + 1.
uint64_t nClientID = static_cast<uint64_t>(pClient->GetHandle());
if (nClientID != nTargetID)
{
continue;
@ -249,9 +249,9 @@ void Host_BanID_f(const CCommand& args)
continue;
}
}
else // If its not try by userID.
else // If its not try by handle.
{
int64_t nClientID = static_cast<int64_t>(pClient->GetUserID() + 1); // Get UserID + 1.
uint64_t nClientID = static_cast<uint64_t>(pClient->GetHandle());
if (nClientID != nTargetID)
{
continue;