aboutsummaryrefslogtreecommitdiff
path: root/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut
diff options
context:
space:
mode:
authorEmma Miler <27428383+emma-miler@users.noreply.github.com>2022-04-12 22:52:32 +0200
committerGeckoEidechse <gecko.eidechse+git@pm.me>2022-04-12 23:12:28 +0200
commita2772aa6ba1541a31b4badf839c6c7c67b20fc2d (patch)
tree3c8901c438496f1a6cd83d5b416fbe3870f0d3b6 /Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut
parent4f69b13b09a272bbbd818e182816b7ac4d0e73ee (diff)
downloadNorthstarMods-a2772aa6ba1541a31b4badf839c6c7c67b20fc2d.tar.gz
NorthstarMods-a2772aa6ba1541a31b4badf839c6c7c67b20fc2d.zip
Restrict and log message sending on connect (#299)v1.6.3-rc1v1.6.3
* Restrict message sending on connect Restricts users from sending messages until they are fully connected. This is related to a bug where if a player joins the server, send a message, and disconnects quickly enough the join message will not show up in the chat. * Log messages on receive * Fix issue with private lobbies
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut')
-rw-r--r--Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut5
1 files changed, 3 insertions, 2 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut
index 9e46f99a..4a7f8189 100644
--- a/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut
+++ b/Northstar.CustomServers/mod/scripts/vscripts/_custom_codecallbacks.gnut
@@ -22,10 +22,11 @@ void function CServerGameDLL_ProcessMessageStartThread(int playerIndex, string m
void function CServerGameDLL_OnReceivedSayTextMessageCallback(int playerIndex, string message, bool isTeam)
{
entity player = GetPlayerByIndex(playerIndex)
- if (player == null) {
+ if (player == null || !player.hasConnected) {
print("Ignored chat message from invalid player index " + playerIndex + ": " + message)
return
}
+ print("Received message from " + player + "(" + player.GetUID() + "): " + message)
ClServer_MessageStruct localMessage
localMessage.message = message
@@ -55,4 +56,4 @@ void function AddCallback_OnReceivedSayTextMessage( ClServer_MessageStruct funct
void function NSSetupChathooksServer() {
getroottable().rawset("CServerGameDLL_ProcessMessageStartThread", CServerGameDLL_ProcessMessageStartThread)
-} \ No newline at end of file
+}