mirror of
https://github.com/rehlds/rehlds.git
synced 2025-01-28 22:48:05 +03:00
Add: new chatdelay command. (#777)
This commit is contained in:
parent
dc75d828ce
commit
169020067b
@ -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 <number>\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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user