@@ -240,29 +240,46 @@ void RoundEndDisplayStats()
240240{
241241 AuthIdType authType = view_as <AuthIdType >(g_hCvarsList .CVAR_ROUNDEND_AUTHID_TYPE .IntValue );
242242
243+ int count = 0 ;
244+
243245 for (int player = 1 ; player <= MaxClients ; player ++ )
244246 {
245247 if (! IsClientInGame (player ) || (IsFakeClient (player ) && ! IsClientSourceTV (player )))
246248 continue ;
247249
248- static char sPlayerID [8 ];
249- static char sPlayerName [MAX_NAME_LENGTH + 2 ];
250+ count ++ ;
251+ }
252+
253+ APIOnRoundEndStats (count );
254+
255+ // Print to console and log
256+ for (int player = 1 ; player <= MaxClients ; player ++ )
257+ {
258+ if (! IsClientInGame (player ) || (IsFakeClient (player ) && ! IsClientSourceTV (player )))
259+ continue ;
260+
261+ int userid = GetClientUserId (player );
262+
263+ static char sPlayerName [MAX_NAME_LENGTH + 1 ];
264+ static char sPlayerNameQuoted [MAX_NAME_LENGTH + 3 ];
250265 static char sPlayerAuth [24 ];
251266 static char sPlayerTeam [8 ];
252267 static char sPlayerState [8 ];
253268
254- FormatEx (sPlayerID , sizeof (sPlayerID ), " %d " , GetClientUserId ( player ) );
255- FormatEx (sPlayerName , sizeof (sPlayerName ), " \" %N \" " , player );
269+ FormatEx (sPlayerName , sizeof (sPlayerName ), " %N " , player );
270+ FormatEx (sPlayerNameQuoted , sizeof (sPlayerNameQuoted ), " \" %s \" " , sPlayerName );
256271
257272 if (! GetClientAuthId (player , authType , sPlayerAuth , sizeof (sPlayerAuth )))
258273 FormatEx (sPlayerAuth , sizeof (sPlayerAuth ), " STEAM_ID_PENDING" );
259274
260- if (IsPlayerAlive (player ))
275+ bool alive = IsPlayerAlive (player );
276+ if (alive )
261277 FormatEx (sPlayerState , sizeof (sPlayerState ), " alive" );
262278 else
263279 FormatEx (sPlayerState , sizeof (sPlayerState ), " dead" );
264280
265- if (InfectIsClientInfected (player ))
281+ bool zombie = InfectIsClientInfected (player );
282+ if (zombie )
266283 FormatEx (sPlayerTeam , sizeof (sPlayerTeam ), " zombie" );
267284 else
268285 FormatEx (sPlayerTeam , sizeof (sPlayerTeam ), " human" );
@@ -272,12 +289,12 @@ void RoundEndDisplayStats()
272289 if (! IsClientInGame (client ))
273290 continue ;
274291
275- PrintToConsole (client , " # %8s %40s %24s %5s %6s " ,
276- sPlayerID , sPlayerName , sPlayerAuth , sPlayerState , sPlayerTeam );
292+ PrintToConsole (client , " # %8d %40s %24s %5s %6s " , userid , sPlayerNameQuoted , sPlayerAuth , sPlayerState , sPlayerTeam );
277293 }
278294
279- LogMessage (" # %8s %40s %24s %5s %6s " ,
280- sPlayerID , sPlayerName , sPlayerAuth , sPlayerState , sPlayerTeam );
295+ LogMessage (" # %8d %40s %24s %5s %6s " , userid , sPlayerNameQuoted , sPlayerAuth , sPlayerState , sPlayerTeam );
296+
297+ APIOnRoundEndPlayer (userid , sPlayerName , sPlayerAuth , alive , zombie );
281298 }
282299}
283300
0 commit comments