diff --git a/rehlds/HLTV/Proxy/src/Proxy.cpp b/rehlds/HLTV/Proxy/src/Proxy.cpp index cb842f4..ce850e9 100644 --- a/rehlds/HLTV/Proxy/src/Proxy.cpp +++ b/rehlds/HLTV/Proxy/src/Proxy.cpp @@ -80,6 +80,7 @@ Proxy::LocalCommandID_s Proxy::m_LocalCmdReg[] = { { "maxloss", CMD_ID_MAXLOSS, &Proxy::CMD_MaxLoss }, { "protocol", CMD_ID_PROTOCOL, &Proxy::CMD_Protocol }, { "region", CMD_ID_REGION, &Proxy::CMD_Region }, + { "chatdelay", CMD_ID_CHATDELAY, &Proxy::CMD_ChatDelay }, }; #ifndef HOOK_HLTV @@ -188,6 +189,7 @@ bool Proxy::Init(IBaseSystem *system, int serial, char *name) m_MaxClients = 128; m_MaxQueries = 100; m_Region = 255; + m_ChatDelay = 6; const int maxRouteAblePacketSize = 1400; m_InfoInfo.Resize(maxRouteAblePacketSize); @@ -2774,3 +2776,28 @@ const char *Proxy::GetDescription() return "Private Server"; } + +void Proxy::CMD_ChatDelay(char *cmdLine) +{ + enum { param_ChatDelay = 1 }; + + TokenLine params(cmdLine); + if (params.CountToken() != 2) + { + m_System->Printf("Syntax: chatdelay \n"); + m_System->Printf("Current clients chat delay is %i.\n", GetChatDelay()); + return; + } + + SetChatDelay(Q_atoi(params.GetToken(param_ChatDelay))); +} + +void Proxy::SetChatDelay(int delay) +{ + m_ChatDelay = delay; +} + +int Proxy::GetChatDelay() const +{ + return m_ChatDelay; +} diff --git a/rehlds/HLTV/Proxy/src/Proxy.h b/rehlds/HLTV/Proxy/src/Proxy.h index a7ab781..d8fb4fd 100644 --- a/rehlds/HLTV/Proxy/src/Proxy.h +++ b/rehlds/HLTV/Proxy/src/Proxy.h @@ -130,6 +130,8 @@ public: EXT_FUNC int GetDispatchMode(); EXT_FUNC unsigned char GetRegion(); EXT_FUNC bool WriteSignonData(int type, BitBuffer *stream); + EXT_FUNC void SetChatDelay(int delay); + EXT_FUNC int GetChatDelay() const; void ReconnectClients(); void ExecuteRcon(NetAddress *from, char *command); @@ -229,7 +231,8 @@ private: CMD_ID_CLEARBANNS, CMD_ID_MAXLOSS, CMD_ID_PROTOCOL, - CMD_ID_REGION + CMD_ID_REGION, + CMD_ID_CHATDELAY }; void CMD_Rcon(char *cmdLine); @@ -284,6 +287,7 @@ private: void CMD_MaxLoss(char *cmdLine); void CMD_Protocol(char *cmdLine); void CMD_Region(char *cmdLine); + void CMD_ChatDelay(char *cmdLine); struct LocalCommandID_s { char *name; @@ -373,6 +377,7 @@ protected: float m_CurrentLoss; ObjectList m_BannList; unsigned char m_Region; + int m_ChatDelay; textmessage_t m_LocalMessage; textmessage_t m_CommentatorMessage; diff --git a/rehlds/HLTV/Proxy/src/ProxyClient.cpp b/rehlds/HLTV/Proxy/src/ProxyClient.cpp index 40bd5b3..82bdd27 100644 --- a/rehlds/HLTV/Proxy/src/ProxyClient.cpp +++ b/rehlds/HLTV/Proxy/src/ProxyClient.cpp @@ -126,7 +126,7 @@ void ProxyClient::CMD_Say(TokenLine *cmd) return; } - if (m_SystemTime >= m_LastChatTime + 6) { + if (m_SystemTime >= m_LastChatTime + m_Proxy->GetChatDelay()) { m_Proxy->ChatSpectator(m_ClientName, chatText); m_LastChatTime = float(m_SystemTime); return; diff --git a/rehlds/public/HLTV/IProxy.h b/rehlds/public/HLTV/IProxy.h index 68f0d75..7313a26 100644 --- a/rehlds/public/HLTV/IProxy.h +++ b/rehlds/public/HLTV/IProxy.h @@ -102,6 +102,7 @@ public: virtual unsigned char GetRegion() = 0; virtual IObjectContainer *GetClients() = 0; virtual bool WriteSignonData(int type, BitBuffer *stream) = 0; + virtual int GetChatDelay() const = 0; }; #define PROXY_INTERFACE_VERSION "proxy001"