View Single Post
pan0s
Senior Member
Join Date: Nov 2017
Old 10-08-2022 , 06:10   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #47

Quote:
Originally Posted by Balloons View Post
I managed to recreate the Score list using natives and Marttt's Scripted HUD, but I am flooded with these errors:
HTML Code:
L 09/11/2022 - 10:29:50: [SM] Exception reported: Client index 2 is invalid (arg 7)
L 09/11/2022 - 10:29:50: [SM] Blaming: scripted_hud_srs.smx
L 09/11/2022 - 10:29:50: [SM] Call stack trace:
L 09/11/2022 - 10:29:50: [SM]   [0] FormatEx
L 09/11/2022 - 10:29:50: [SM]   [1] Line 1403, plugin.sp::GetHUD3_Text
L 09/11/2022 - 10:29:50: [SM]   [2] Line 1304, plugin.sp::GetHUD_Texts
L 09/11/2022 - 10:29:50: [SM]   [3] Line 1041, plugin.sp::UpdateHUD
L 09/11/2022 - 10:29:50: [SM]   [4] Line 1032, plugin.sp::TimerUpdateHUD
L 09/11/2022 - 10:29:50: [SM] Exception reported: Client index 2 is invalid (arg 7)
L 09/11/2022 - 10:29:50: [SM] Blaming: scripted_hud_srs.smx
L 09/11/2022 - 10:29:50: [SM] Call stack trace:
L 09/11/2022 - 10:29:50: [SM]   [0] FormatEx
L 09/11/2022 - 10:29:50: [SM]   [1] Line 1403, plugin.sp::GetHUD3_Text
L 09/11/2022 - 10:29:50: [SM]   [2] Line 1304, plugin.sp::GetHUD_Texts
L 09/11/2022 - 10:29:50: [SM]   [3] Line 1041, plugin.sp::UpdateHUD
L 09/11/2022 - 10:29:50: [SM]   [4] Line 1032, plugin.sp::TimerUpdateHUD
L 09/11/2022 - 10:29:50: [SM] Exception reported: Client index 2 is invalid (arg 7)
L 09/11/2022 - 10:29:50: [SM] Blaming: scripted_hud_srs.smx
L 09/11/2022 - 10:29:50: [SM] Call stack trace:
L 09/11/2022 - 10:29:50: [SM]   [0] FormatEx
L 09/11/2022 - 10:29:50: [SM]   [1] Line 1403, plugin.sp::GetHUD3_Text
L 09/11/2022 - 10:29:50: [SM]   [2] Line 1304, plugin.sp::GetHUD_Texts
L 09/11/2022 - 10:29:50: [SM]   [3] Line 1041, plugin.sp::UpdateHUD
L 09/11/2022 - 10:29:50: [SM]   [4] Line 1032, plugin.sp::TimerUpdateHUD
L 09/11/2022 - 10:29:50: [SM] Exception reported: Client index 2 is invalid (arg 7)
L 09/11/2022 - 10:29:50: [SM] Blaming: scripted_hud_srs.smx
L 09/11/2022 - 10:29:50: [SM] Call stack trace:
L 09/11/2022 - 10:29:50: [SM]   [0] FormatEx
L 09/11/2022 - 10:29:50: [SM]   [1] Line 1403, plugin.sp::GetHUD3_Text
L 09/11/2022 - 10:29:50: [SM]   [2] Line 1304, plugin.sp::GetHUD_Texts
L 09/11/2022 - 10:29:50: [SM]   [3] Line 1041, plugin.sp::UpdateHUD
L 09/11/2022 - 10:29:50: [SM]   [4] Line 1032, plugin.sp::TimerUpdateHUD
L 09/11/2022 - 10:29:50: [SM] Exception reported: Client index 2 is invalid (arg 7)
L 09/11/2022 - 10:29:50: [SM] Blaming: scripted_hud_srs.smx
L 09/11/2022 - 10:29:50: [SM] Call stack trace:
L 09/11/2022 - 10:29:50: [SM]   [0] FormatEx
L 09/11/2022 - 10:29:50: [SM]   [1] Line 1403, plugin.sp::GetHUD3_Text
L 09/11/2022 - 10:29:50: [SM]   [2] Line 1304, plugin.sp::GetHUD_Texts
L 09/11/2022 - 10:29:50: [SM]   [3] Line 1041, plugin.sp::UpdateHUD
L 09/11/2022 - 10:29:50: [SM]   [4] Line 1032, plugin.sp::TimerUpdateHUD
Here is my code:
PHP Code:
void GetHUD3_Text(char[] outputint size)
{
    
FormatEx(outputsize"\0");

    for (
int client 1client <= MaxClientsclient++)
    {
        
int clients[23];
        
float scores[23];
        
        
SRS_GetMvp(clientsscores);

        if (
output[0] == 0)
            
FormatEx(outputsize"# | Top Score\n1  | %.1f  %N\n2 | %.1f  %N\n3 | %.1f  %N\n4 | %.1f  %N"scores[0], clients[0], scores[1], clients[1], scores[2], clients[2], scores[3], clients[3]);
        else
            
Format(outputsize"# | Top Score\n1  | %.1f  %N\n2 | %.1f  %N\n3 | %.1f  %N\n4 | %.1f  %N"scores[0], clients[0], scores[1], clients[1], scores[2], clients[2], scores[3], clients[3]);
    }

Edit: Simple solution was to add checks if client(s) are connected and in game. Special thanks to Marttt.
It is my edited version for your reference.
#1 is highlighted.

But I have no idea why I recompile it by new version sourcemod, the display has some problems.
In fact, compiling it by old sm version work perfectly, I haven't changed it anymore as well. Then, I ignore that problem lol.
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_scripted_hud.sp - 51 views - 86.1 KB)
File Type: smx l4d2_scripted_hud.smx (21.1 KB, 57 views)
__________________

Last edited by pan0s; 10-08-2022 at 06:11.
pan0s is offline