Raised This Month: $51 Target: $400
 12% 

[L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]


Post New Thread Reply   
 
Thread Tools Display Modes
eyal282
Veteran Member
Join Date: Aug 2011
Old 06-12-2022 , 12:22   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #41

Quote:
Originally Posted by VYRNACH_GAMING View Post
do you have a version of the plugin with this change? I've had players complaining their rank and shop points have been reset and it might be the case you mentioned
All versions of the plugin use this.

If a player_death event resets your stats, your stats plugin is broken.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Groven
AlliedModders Donor
Join Date: Apr 2011
Location: Sweden
Old 08-08-2022 , 13:41   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #42

Any updates so it wont reset?

Edit: It's broken with ABM and sometimes don't spawn people etc.

Code:
A Survivor Bot Can't Be Spawned Right Now
__________________

Last edited by Groven; 08-09-2022 at 10:39.
Groven is offline
Balloons
Member
Join Date: Feb 2020
Old 09-21-2022 , 19:58   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #43

Quote:
Originally Posted by pan0s View Post
Description:
figure 2:
Attachment 189965
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.

Last edited by Balloons; 09-22-2022 at 13:58. Reason: Added solution
Balloons is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 09-21-2022 , 20:43   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #44

Maybe should check if "clients[X]" is connected before using %N
__________________

Last edited by Marttt; 09-21-2022 at 20:47.
Marttt is offline
Balloons
Member
Join Date: Feb 2020
Old 09-22-2022 , 13:57   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #45

Quote:
Originally Posted by Marttt View Post
Maybe should check if "clients[X]" is connected before using %N
This did the trick. Thank you Marttt!
Balloons is offline
kochifish
Junior Member
Join Date: Feb 2016
Old 10-05-2022 , 06:32   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #46

Hi Panos, Thanks for the awesome plugin release, i have question, is it possible to use MYSQL instead? because i host the database on web server. Thank you
kochifish is offline
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
pan0s
Senior Member
Join Date: Nov 2017
Old 10-08-2022 , 06:23   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #48

Quote:
Originally Posted by kochifish View Post
Hi Panos, Thanks for the awesome plugin release, i have question, is it possible to use MYSQL instead? because i host the database on web server. Thank you
You may try changing here to MYSQL database name directly?
#define DATABASE "clientprefs" //SQLITE
__________________

Last edited by pan0s; 10-08-2022 at 06:46.
pan0s is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 10-08-2022 , 06:43   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #49

Quote:
Originally Posted by Groven View Post
Any updates so it wont reset?

Edit: It's broken with ABM and sometimes don't spawn people etc.

Code:
A Survivor Bot Can't Be Spawned Right Now
Do you have any plugin that reset player's data?

Just like eyal282 mentioned,

The solution is that you need to create a buffer attribute
Code:
Player g_playersBuffer[MAXPLAYERS + 1];
when you see g_players[?] += ?? (or any other changes) , you need to also add g_playersBuffer[?] += ?? (or any other changes)
and the SQL statement will need to use column = column + value instead of column = value, as well as replacing g_players to g_playersBuffer. After saving it into db, g_playersBuffer[?] need to be reset.

The another problem, you can try turnning off the SpawnCI function, just comment all the codes in that block.
__________________

Last edited by pan0s; 10-08-2022 at 06:49.
pan0s is offline
kochifish
Junior Member
Join Date: Feb 2016
Old 10-22-2022 , 21:48   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #50

Quote:
Originally Posted by pan0s View Post
You may try changing here to MYSQL database name directly?
#define DATABASE "clientprefs" //SQLITE
hello, ive tried change the database to mysql, but its error, here is my database.cfg:

Tried both version of MySql

- MYSQL 5.7.33
- MYSQL 8.0.30

database.cfg
PHP Code:
    "l4d2_srs"
    
{
        
"driver"            "default"
        "host"                "localhost"
        "database"            "l4d2_srs"
        "user"                "root"
        "pass"                ""
    

Plugins Error:
PHP Code:
L 10/23/2022 08:32:01: [l4d2_srs.smx] [CREATE]: Failed to Create SRS table"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('now','localtime')),LastUpdatedDate DATE DEFAULT (datetime('now','localtime')),' at line 1"
L 10/23/2022 08:32:11: [l4d2_srs.smx] [LOAD]: Failed to load TOP10"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Rank , * FROM SRS LIMIT 0,10' at line 1" 
Could you help me? Thank you!
kochifish is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:08.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode