This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG).
Revision | 47d69cebabc15bdb02752f3691132b97cbb2bf9b (tree) |
---|---|
Time | 2022-02-04 23:52:21 |
Author | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
SERVER_KickPlayer now uses FString instead of C-style char arrays.
@@ -3758,23 +3758,23 @@ | ||
3758 | 3758 | // |
3759 | 3759 | void SERVER_KickPlayer( ULONG ulPlayer, const char *pszReason ) |
3760 | 3760 | { |
3761 | - ULONG ulIdx; | |
3762 | - char szKickString[512]; | |
3763 | - char szName[64]; | |
3761 | + ULONG ulIdx; | |
3762 | + FString kickString; | |
3763 | + FString playerName; | |
3764 | 3764 | |
3765 | 3765 | // Make sure the target is valid and applicable. |
3766 | 3766 | if (( ulPlayer >= MAXPLAYERS ) || ( !playeringame[ulPlayer] )) |
3767 | 3767 | return; |
3768 | 3768 | |
3769 | - sprintf( szName, "%s", players[ulPlayer].userinfo.GetName() ); | |
3770 | - V_RemoveColorCodes( szName ); | |
3769 | + playerName = players[ulPlayer].userinfo.GetName(); | |
3770 | + V_RemoveColorCodes( playerName ); | |
3771 | 3771 | |
3772 | 3772 | // Build the full kick string. |
3773 | - sprintf( szKickString, TEXTCOLOR_ORANGE "%s" TEXTCOLOR_ORANGE " was kicked from the server! Reason: %s\n", szName, pszReason ); | |
3774 | - Printf( "%s", szKickString ); | |
3773 | + kickString.Format( TEXTCOLOR_ORANGE "%s was kicked from the server! Reason: %s\n", playerName.GetChars(), pszReason ); | |
3774 | + Printf( "%s", kickString.GetChars() ); | |
3775 | 3775 | |
3776 | 3776 | // Rebuild the string that will be displayed to clients. This time, color codes are allowed. |
3777 | - sprintf( szKickString, TEXTCOLOR_ORANGE "%s" TEXTCOLOR_ORANGE " was kicked from the server! Reason: %s\n", players[ulPlayer].userinfo.GetName(), pszReason ); | |
3777 | + kickString.Format( TEXTCOLOR_ORANGE "%s" TEXTCOLOR_ORANGE " was kicked from the server! Reason: %s\n", players[ulPlayer].userinfo.GetName(), pszReason ); | |
3778 | 3778 | |
3779 | 3779 | // Send the message out to all clients. |
3780 | 3780 | for ( ulIdx = 0; ulIdx < MAXPLAYERS; ulIdx++ ) |
@@ -3782,7 +3782,7 @@ | ||
3782 | 3782 | if ( SERVER_IsValidClient( ulIdx ) == false ) |
3783 | 3783 | continue; |
3784 | 3784 | |
3785 | - SERVER_PrintfPlayer( PRINT_HIGH, ulIdx, "%s", szKickString ); | |
3785 | + SERVER_PrintfPlayer( PRINT_HIGH, ulIdx, "%s", kickString.GetChars() ); | |
3786 | 3786 | } |
3787 | 3787 | |
3788 | 3788 | // If we're kicking a bot, just remove him. |