Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Client/mods/deathmatch/logic/CPacketHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1412,7 +1412,8 @@ void CPacketHandler::Packet_ChatEcho(NetBitStreamInterface& bitStream)
bitStream.Read(szMessage, iNumberOfBytesUsed);
szMessage[iNumberOfBytesUsed] = 0;
// actual limits enforced on the remote client, this is the maximum a string can be to be printed.
if (MbUTF8ToUTF16(szMessage).size() <=
SString textToProcess = bColorCoded ? RemoveColorCodes(szMessage) : szMessage;
if (MbUTF8ToUTF16(textToProcess).size() <=
MAX_CHATECHO_LENGTH + 6) // Extra 6 characters to fix #7125 (Teamsay + long name + long message = too long message)
{
// Strip it for bad characters
Expand Down
38 changes: 23 additions & 15 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,21 +260,27 @@ bool CStaticFunctionDefinitions::ClearChatBox()

bool CStaticFunctionDefinitions::OutputChatBox(const char* szText, unsigned char ucRed, unsigned char ucGreen, unsigned char ucBlue, bool bColorCoded)
{
if (strlen(szText) <= MAX_OUTPUTCHATBOX_LENGTH)
{
CLuaArguments Arguments;
Arguments.PushString(szText);
Arguments.PushNumber(ucRed);
Arguments.PushNumber(ucGreen);
Arguments.PushNumber(ucBlue);
if (!szText || !*szText)
return false;

SString textToProcess = bColorCoded ? RemoveColorCodes(szText) : szText;

if (strlen(textToProcess.c_str()) > MAX_OUTPUTCHATBOX_LENGTH) {
return false;
}

bool bCancelled = !g_pClientGame->GetRootEntity()->CallEvent("onClientChatMessage", Arguments, false);
if (!bCancelled)
{
m_pCore->ChatPrintfColor("%s", bColorCoded, ucRed, ucGreen, ucBlue, szText);
return true;
}
CLuaArguments Arguments;
Arguments.PushString(szText);
Arguments.PushNumber(ucRed);
Arguments.PushNumber(ucGreen);
Arguments.PushNumber(ucBlue);

bool bCancelled = !g_pClientGame->GetRootEntity()->CallEvent("onClientChatMessage", Arguments, false);
if (!bCancelled) {
m_pCore->ChatPrintfColor("%s", bColorCoded, ucRed, ucGreen, ucBlue, szText);
return true;
}

return false;
}

Expand Down Expand Up @@ -1741,7 +1747,7 @@ bool CStaticFunctionDefinitions::GetPedClothes(CClientPed& Ped, unsigned char uc
return false;
}

bool CStaticFunctionDefinitions::GetPedControlState(CClientPed& const ped, const std::string control, bool& state) noexcept
bool CStaticFunctionDefinitions::GetPedControlState(CClientPed& ped, const std::string control, bool& state) noexcept
{
if (&ped == GetLocalPlayer())
return GetControlState(control.c_str(), state);
Expand Down Expand Up @@ -2396,13 +2402,15 @@ bool CStaticFunctionDefinitions::RemovePedClothes(CClientEntity& Entity, unsigne
return false;
}

bool CStaticFunctionDefinitions::SetPedControlState(CClientPed& const ped, const std::string control, const bool state) noexcept
bool CStaticFunctionDefinitions::SetPedControlState(CClientPed& ped, const std::string control, const bool state) noexcept
{
if (&ped == GetLocalPlayer())
return SetControlState(control.c_str(), state);

if (ped.m_Pad.SetControlState(control.c_str(), state))
return true;

return false;
}

bool CStaticFunctionDefinitions::SetPedDoingGangDriveby(CClientEntity& Entity, bool bGangDriveby)
Expand Down