From 1c54f685bb080b5409e729ed3bc8fc5ad4e1d774 Mon Sep 17 00:00:00 2001 From: navewindre Date: Thu, 7 Dec 2023 03:30:19 +0100 Subject: kztimer --- sourcemod-1.5-dev/scripting/stats.sp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'sourcemod-1.5-dev/scripting/stats.sp') diff --git a/sourcemod-1.5-dev/scripting/stats.sp b/sourcemod-1.5-dev/scripting/stats.sp index 94f3598..f006f60 100644 --- a/sourcemod-1.5-dev/scripting/stats.sp +++ b/sourcemod-1.5-dev/scripting/stats.sp @@ -143,7 +143,6 @@ new g_LJTopMax[LT_END] = { 0, ... }; new g_statsTOP = 0; new g_playerStats[MAXPLAYERS+1][PlayerStats]; new g_playerTop[STATSTOP_NUM_ENTRIES][PlayerStats]; -new g_displayedStats[MAXPLAYERS+1] = { false, ... }; public OnPluginStart() { CreateTimer( 1.0, Timer_PlaytimeTick, _ ); @@ -265,6 +264,7 @@ public ResetPlayerStates() { public OnClientPutInServer( client ) { ResetPlayerState( client ); + CreateTimer( 10.0, Timer_SendMsg4, client, TIMER_FLAG_NO_MAPCHANGE ); LoadLJDB(); LoadStatsDBForUser( client ); } @@ -590,6 +590,15 @@ public LoadStatsDBCallback( Handle:owner, Handle:hndl, String:error[], any:pack LogMessage( "Loading db for top %s (%s)", g_playerTop[it][plName], steamid ); ++it; } + + if( !pack ) + g_statsTOP = it; + for( new i = 1; i < MaxClients; ++i ) { + if( !IsClientConnected( i ) || IsFakeClient( i ) ) + continue; + + UpdatePlayerPoints( i ); + } } public CreateStatsDBCallback( Handle:owner, Handle:hndl, String:error[], any:pack ) { @@ -920,7 +929,7 @@ public Action:Timer_SendMsg2( Handle: timer, any: client ) { public Action:Timer_SendMsg( Handle: Timer, any: client ) { new String:chatOutput[1024]; - Format( chatOutput, sizeof(chatOutput), "%s{white}Kills {default}: {green}%d {default}(%dpts)\n", chatOutput, g_playerStats[client][plKills], g_playerStats[client][plKills] / 2 ); + Format( chatOutput, sizeof(chatOutput), "%s{white}Player kills {default}: {green}%d {default}(%dpts)\n", chatOutput, g_playerStats[client][plKills], g_playerStats[client][plKills] / 2 ); Format( chatOutput, sizeof(chatOutput), "%s{white}Deaths {default}: {green}%d {default}(-%dpts)\n", chatOutput, g_playerStats[client][plDeaths], g_playerStats[client][plDeaths] / 2 ); new Float:kdScore = GetKDScore( client ); @@ -1038,7 +1047,7 @@ public Action:Command_Stats( client, args ) { GetCmdArg( 1, arg, sizeof(arg) ); new top = StringToInt( arg ); - if( top > 0 && top < g_statsTOP + 1 ) { + if( top > 0 ) { if( top > g_statsTOP ) { CPrintToChat( client, "{fuchsia}There are only {green}%d {fuchsia}players in the database.", g_statsTOP ); return Plugin_Handled; -- cgit v1.2.3