Commit MetaInfo

Revisiond5c29dd87dd3ad2615b0d62ea15ed11a14c1a2cc (tree)
Time2021-05-01 23:04:43
AuthorAdam Kaminski <kaminskiadam9@gmai...>
CommiterAdam Kaminski

Log Message

Prevented players from sending private messages to themselves using RCON.

Change Summary

Incremental Difference

diff -r 2349f2b3afeb -r d5c29dd87dd3 src/c_console.cpp
--- a/src/c_console.cpp Sat May 01 09:11:20 2021 -0400
+++ b/src/c_console.cpp Sat May 01 10:04:43 2021 -0400
@@ -719,6 +719,12 @@
719719 g_ulRCONPlayer = ulPlayer;
720720 }
721721
722+// [AK] Gets the number of the player currently using RCON.
723+ULONG CONSOLE_GetRCONPlayer( void )
724+{
725+ return g_ulRCONPlayer;
726+}
727+
722728 // [AK] Toggles whether or not a console message gets printed to the player using RCON.
723729 void CONSOLE_ShouldPrintToRCONPlayer( bool enable )
724730 {
diff -r 2349f2b3afeb -r d5c29dd87dd3 src/c_console.h
--- a/src/c_console.h Sat May 01 09:11:20 2021 -0400
+++ b/src/c_console.h Sat May 01 10:04:43 2021 -0400
@@ -75,6 +75,7 @@
7575
7676 // [BC] New function prototypes.
7777 void CONSOLE_SetRCONPlayer( ULONG ulPlayer );
78+ULONG CONSOLE_GetRCONPlayer( void ); // [AK]
7879 void CONSOLE_ShouldPrintToRCONPlayer( bool enable ); // [AK]
7980
8081 void C_InitTicker (const char *label, unsigned int max, bool showpercent=true);
diff -r 2349f2b3afeb -r d5c29dd87dd3 src/chat.cpp
--- a/src/chat.cpp Sat May 01 09:11:20 2021 -0400
+++ b/src/chat.cpp Sat May 01 10:04:43 2021 -0400
@@ -1428,6 +1428,13 @@
14281428 Printf( "You can't send private messages to yourself.\n" );
14291429 return;
14301430 }
1431+
1432+ // [AK] Don't let the player send privates messages to themselves via RCON.
1433+ if ( CONSOLE_GetRCONPlayer( ) == ulReceiver )
1434+ {
1435+ SERVER_PrintfPlayer( ulReceiver, "You can't send private messages to yourself.\n" );
1436+ return;
1437+ }
14311438 }
14321439
14331440 g_ulChatPlayer = ulReceiver;
Show on old repository browser