11-20-2021, 08:36 PM
This code is to prevent the user from spamming the chat every x seconds flooding the chat window.
Each chat has a different interval:
You'll need to edit the following files:
Character.h
DoFuncChat.cpp
PC.cpp
1. Character.h
Add these varaibles after
m_shoutPulse;
add this:
int m_sayPulse;
int m_guildPulse;
int m_partyPulse;
int m_lordPulse;
int m_expiditionPulse;
2.DoFuncChat.cpp
after this:
CDratanCastle * pCastle = CDratanCastle::CreateInstance();
switch (chatType)
{
case MSG_CHAT_SAY: // �Ϲ�
write this:
//user can only chat every 2 seconds in this window
if (gserver->m_pulse - ch->m_sayPulse <= 0)
return;
ch->m_sayPulse = gserver->m_pulse + (2 * PULSE_REAL_SEC);
Next case
MSG_CHAT_PARTY
//after this
{
if (ch->IsParty())
{
//Add this
if (gserver->m_pulse - ch->m_partyPulse <= 0)
return;
ch->m_partyPulse = gserver->m_pulse + (3 * PULSE_REAL_SEC);
Next case
MSG_CHAT_EXPEDITION
//after this
if (ch->IsExped())
{
//Add this
if (gserver->m_pulse - ch->m_expiditionPulse <= 0)
return;
ch->m_expiditionPulse = gserver->m_pulse + (3 * PULSE_REAL_SEC);
Next case
case MSG_CHAT_GUILD: // ���
//After this
{
if (ch->m_guildInfo)
{
//Add this
if (gserver->m_pulse - ch->m_guildPulse <= 0)
return;
ch->m_guildPulse = gserver->m_pulse + (3 * PULSE_REAL_SEC);
Next case
case MSG_CHAT_LORD: // ���� ����
//After this
if ( !IS_PC(ch) ) return; //dethunter12
if (CWarCastle::CanLordChat(ch))
{
//Add this
if (gserver->m_pulse - ch->m_lordPulse <= 0)
return;
ch->m_lordPulse = gserver->m_pulse + (2 * PULSE_REAL_SEC);
3.PC.cpp
//After this
m_shoutPulse = gserver->m_pulse;
//Add this
m_sayPulse = gserver->m_pulse;
m_guildPulse = gserver->m_pulse;
m_partyPulse = gserver->m_pulse;
m_lordPulse = gserver->m_pulse;
m_expiditionPulse = gserver->m_pulse;
Again this code is only intended to prevent the user from sending to many messages in 1 chat window per second . If you think this code is useful give it a like.

