aboutsummaryrefslogtreecommitdiff
path: root/NorthstarDLL/serverchathooks.cpp
diff options
context:
space:
mode:
authorBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-18 00:00:39 +0100
committerBobTheBob9 <for.oliver.kirkham@gmail.com>2022-07-18 00:00:39 +0100
commitb0bef05111a95a4cce6250d2b79e2aa5baa6dd98 (patch)
tree5bdc39717bebfc437adf8683405d58d97e1f43b2 /NorthstarDLL/serverchathooks.cpp
parent6ae30c9b15fcc200c7b642016e7adbfdf9b979f4 (diff)
downloadNorthstarLauncher-b0bef05111a95a4cce6250d2b79e2aa5baa6dd98.tar.gz
NorthstarLauncher-b0bef05111a95a4cce6250d2b79e2aa5baa6dd98.zip
use modular ServerPresence system for registering servers
Diffstat (limited to 'NorthstarDLL/serverchathooks.cpp')
-rw-r--r--NorthstarDLL/serverchathooks.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/NorthstarDLL/serverchathooks.cpp b/NorthstarDLL/serverchathooks.cpp
index 000c6eea..da7d34dd 100644
--- a/NorthstarDLL/serverchathooks.cpp
+++ b/NorthstarDLL/serverchathooks.cpp
@@ -48,10 +48,8 @@ void,, (CServerGameDLL* self, unsigned int senderPlayerId, const char* text, boo
return;
}
- R2::CBasePlayer* sender = R2::UTIL_PlayerByIndex(senderPlayerId - 1);
-
// check chat ratelimits
- if (!g_pServerLimits->CheckChatLimits(sender))
+ if (!g_pServerLimits->CheckChatLimits(&R2::g_pClientArray[senderPlayerId - 1]))
return;
if (g_pServerSquirrel->setupfunc("CServerGameDLL_ProcessMessageStartThread") != SQRESULT_ERROR)
@@ -89,8 +87,7 @@ void ChatBroadcastMessage(int fromPlayerIndex, int toPlayerIndex, const char* te
// Build a new string where the first byte is the message type
char sendText[256];
sendText[0] = (char)messageType;
- strncpy(sendText + 1, text, 255);
- sendText[255] = 0;
+ strncpy_s(sendText + 1, 255, text, 254);
// Anonymous custom messages use playerId=0, non-anonymous ones use a player ID with the first bit set
unsigned int fromPlayerId = fromPlayerIndex < 0 ? 0 : ((fromPlayerIndex + 1) | CUSTOM_MESSAGE_INDEX_BIT);