Raised This Month: $32 Target: $400
 8% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 03-17-2022 , 14:53   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #31

Got this error today
L 03/17/2022 - 1160: SourceMod error session started
L 03/17/2022 - 1160: Info (map "fnaf1_n3") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220317.log")
L 03/17/2022 - 1160: [SM] Exception reported: Client index 2 is invalid (arg 2)
L 03/17/2022 - 1160: [SM] Blaming: l4d2_srs.smx
L 03/17/2022 - 1160: [SM] Call stack trace:
L 03/17/2022 - 1160: [SM] [0] LogMessage
L 03/17/2022 - 1160: [SM] [1] Line 551, l4d2_srs.sp::OnSelectRow
L 03/17/2022 - 117:41: Error log file session closed.
Krufftys Killers is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 03-18-2022 , 00:07   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #32

Quote:
Originally Posted by Krufftys Killers View Post
Got this error today
L 03/17/2022 - 1160: SourceMod error session started
L 03/17/2022 - 1160: Info (map "fnaf1_n3") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220317.log")
L 03/17/2022 - 1160: [SM] Exception reported: Client index 2 is invalid (arg 2)
L 03/17/2022 - 1160: [SM] Blaming: l4d2_srs.smx
L 03/17/2022 - 1160: [SM] Call stack trace:
L 03/17/2022 - 1160: [SM] [0] LogMessage
L 03/17/2022 - 1160: [SM] [1] Line 551, l4d2_srs.sp::OnSelectRow
L 03/17/2022 - 117:41: Error log file session closed.
Try this.
PHP Code:
public void CallDBAgent(SRS_DBA actionint client)
{
    if(!
IsValidClient(client) && (action == DBA_LOAD || action == DBA_SAVE || action == DBA_INSERT)) return;

    if (
g_db != null)
    {
        
char steamId[32];
        
char name[MAX_NAME_LENGTH];
        
char query[1024];
        if(
IsValidClient(client))
        {
            
GetClientAuthId(clientAuthId_Steam2steamIdsizeof(steamId));
            
GetClientName(clientnamesizeof(name));
            
Format(g_players[client].steamIdsizeof(steamId), steamId);
            
Format(g_players[client].namesizeof(name), name);

            
ReplaceString(namesizeof(name), "'""''"false);
        }
        switch(
action)
        {
            case 
DBA_CREATE:
            {
                
char longQuery[8194];
                
Format(longQuerysizeof(longQuery), "CREATE TABLE IF NOT EXISTS SRS(CreatedDate DATE DEFAULT (datetime('now','localtime')),LastUpdatedDate DATE DEFAULT (datetime('now','localtime')),SteamId TEXT,Name TEXT NOT NULL,Score REAL DEFAULT 0.0,MaxScore REAL DEFAULT 0.0,PlayedTime REAL DEFAULT 0.0,ComboSound INTEGER DEFAULT 1,ComboEffect INTEGER DEFAULT 1");
                for(
int i 0sizeof(g_sSRSCode); i++)
                    
Format(longQuerysizeof(longQuery), "%s,%s INTEGER DEFAULT 0"longQueryg_sSRSCode[i]);
                
Format(longQuerysizeof(longQuery), "%s,Auto_Open INTEGER DEFAULT 1"longQuery);
                
Format(longQuerysizeof(longQuery), "%s,PRIMARY KEY (steamId))"longQuery);
                
g_db.Query(OnCreateTablelongQuery);
            }
            case 
DBA_DROP:
            {
                
g_db.Query(OnUpdateRow"DROP TABLE SRS");
                
CallDBAgent(DBA_CREATE0);
                
CPrintToChat(client"SRS has been rebuilt successfully.")
            }
            case 
DBA_ALTER:
            {
                
g_db.Query(OnUpdateRow"ALTER TABLE SRS ADD COLUMN Auto_Open INTEGER DEFAULT 1");
                
CPrintToChat(client"[SRS] Updated.");
                
// g_db.Query(OnCreateTable, "ALTER TABLE SRS ADD COLUMN MaxScore REAL DEFAULT 0.0");
            
}
            case 
DBA_TOP10:
            {
                
Format(querysizeof(query), "SELECT ROW_NUMBER () OVER (ORDER BY score  DESC) Rank , * FROM SRS LIMIT 0,10");
                
g_db.Query(OnSelectTop10Rowqueryclient);
            }
            case 
DBA_LOAD:
            {
                
Format(querysizeof(query), "SELECT * FROM (SELECT RANK() OVER(ORDER BY t.score DESC, t.CreatedDate DESC) AS globalRank, * FROM (SELECT * FROM srs GROUP BY steamId) AS t) AS rt WHERE rt.steamId = '%s'"steamId);
                
g_db.Query(OnSelectRowqueryclient);
            }

            case 
DBA_SAVE:
            {
                
char longQuery[4096];
                
Format(longQuerysizeof(longQuery), "UPDATE SRS SET Name='%s',Score=%.3f,MaxScore=%.3f,PlayedTime=%.1f,LastUpdatedDate=datetime('now','localtime'),ComboSound=%b,ComboEffect=%b,Auto_Open=%b"nameg_players[client].fScore[SRS_TYPE_DB],g_players[client].fMaxScore,g_players[client].fPlayedTime[SRS_TYPE_DB],g_players[client].combo.bSound,g_players[client].combo.bEff,g_players[client].bAutoOpen);
                
// PrintToServer(longQuery);
                
for(int i=0i<sizeof(g_sSRSCode); i++) Format(longQuerysizeof(longQuery), "%s,%s=%d"longQueryg_sSRSCode[i], g_iSRSs[client][SRS_TYPE_DB][i]);
                
Format(longQuerysizeof(longQuery), "%s WHERE steamId='%s'"longQuerysteamIdname);

                
// DataPack pack = new DataPack();
                // g_db.Query(OnUpdateRow, longQuery, pack);
                
g_db.Query(OnUpdateRowlongQueryclient);
                
LogMessage("[UPDATE]: \"%L\" saved. Score: %.1f"clientg_players[client].fScore[SRS_TYPE_DB]);

                
// pack.WriteFloat(g_players[client].fScore[SRS_TYPE_DB]);
                // pack.WriteString(name);
                // pack.WriteString(steamId);

                // DBResultSet rs = SQL_Query(g_db, longQuery, sizeof(longQuery));
                // if(rs.AffectedRows>0)
                //     LogMessage("[UPDATE]: \"%L\" saved. Score: %.1f", client, g_players[client].fScore[SRS_TYPE_DB]);
                // else
                //     LogError("[UPDATE]: Failed to save \"%L\"", client);
            
}
            case 
DBA_INSERT:
            {
                
// PrintToServer("[SRS] ==========DBA_INSERT(1) %s=======================", steamId)
                
if(strcmp("STEAM_ID_STOP_IGNORING_RETVALS"steamIdfalse) == 0) return;
                
Format(querysizeof(query), "INSERT INTO SRS(steamId, name) VALUES('%s', '%s')"steamIdname);
                
g_db.Query(OnInsertRowqueryclient);
                
// PrintToServer("[SRS] ==========DBA_INSERT(2)=======================")
            
}
        }
    }


Last edited by pan0s; 03-18-2022 at 15:22. Reason: fixed bug
pan0s is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 03-23-2022 , 12:45   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #33

got this today
L 03/22/2022 - 2335: SourceMod error session started
L 03/22/2022 - 2335: Info (map "dw_woods") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220322.log")
L 03/22/2022 - 2335: [SM] Exception reported: Client index 3 is invalid (arg 2)
L 03/22/2022 - 2335: [SM] Blaming: l4d2_srs.smx
L 03/22/2022 - 2335: [SM] Call stack trace:
L 03/22/2022 - 2335: [SM] [0] LogMessage
L 03/22/2022 - 2335: [SM] [1] Line 550, C:\Users\kruff\Desktop\l4d2_srs_v2.5\sourcemo d\scripting\l4d2_srs.sp::OnSelectRow
L 03/23/2022 - 00:06:22: Error log file session closed.

L 03/23/2022 - 12:40:40: SourceMod error session started
L 03/23/2022 - 12:40:40: Info (map "m1_beach") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220323.log")
L 03/23/2022 - 12:40:40: [SM] Exception reported: Invalid edict (144 - 144)
L 03/23/2022 - 12:40:40: [SM] Blaming: l4d2_srs.smx
L 03/23/2022 - 12:40:40: [SM] Call stack trace:
L 03/23/2022 - 12:40:40: [SM] [0] GetEdictClassname
L 03/23/2022 - 12:40:40: [SM] [1] Line 673, C:\Users\kruff\Desktop\l4d2_srs_v2.5\sourcemo d\scripting\l4d2_srs.sp:eleteParticles
L 03/23/2022 - 12:40:40: [SM] Exception reported: Invalid edict (143 - 143)
L 03/23/2022 - 12:40:40: [SM] Blaming: l4d2_srs.smx
L 03/23/2022 - 12:40:40: [SM] Call stack trace:
L 03/23/2022 - 12:40:40: [SM] [0] GetEdictClassname
L 03/23/2022 - 12:40:40: [SM] [1] Line 673, C:\Users\kruff\Desktop\l4d2_srs_v2.5\sourcemo d\scripting\l4d2_srs.sp:eleteParticles
L 03/23/2022 - 12:40:52: Error log file session closed.

Last edited by Krufftys Killers; 03-23-2022 at 16:00.
Krufftys Killers is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 03-24-2022 , 13:56   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #34

today error
L 03/24/2022 - 122:08: SourceMod error session started
L 03/24/2022 - 122:08: Info (map "fnaf1_survival_n6") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220324.log")
L 03/24/2022 - 122:08: [SM] Exception reported: Entity -1 (-1) is invalid
L 03/24/2022 - 122:08: [SM] Blaming: l4d2_srs.smx
L 03/24/2022 - 122:08: [SM] Call stack trace:
L 03/24/2022 - 122:08: [SM] [0] GetEntPropString
L 03/24/2022 - 122:08: [SM] [1] Line 505, C:\Users\kruff\Desktop\sm1.11 scripting\include\pan0s.inc::SetNameToPure
L 03/24/2022 - 122:08: [SM] [2] Line 1464, C:\Users\kruff\Desktop\l4d2_srs_v2.5\sourcemo d\scripting\l4d2_srs.sp::Event_PlayerDeath
Krufftys Killers is offline
laurauwu
Member
Join Date: Feb 2022
Location: Curitiba / PR - Brazil
Old 03-25-2022 , 18:48   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #35

BUG:
It won't let me close the ranking menu, I try to open another purchase menu, or any menu and it won't let me open, this menu simply crashes and doesn't leave my screen, I can't use the store and any other server menu because of that

laurauwu is offline
pan0s
Senior Member
Join Date: Nov 2017
Old 03-26-2022 , 00:27   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #36

Quote:
Originally Posted by Krufftys Killers View Post
today error
L 03/24/2022 - 122:08: SourceMod error session started
L 03/24/2022 - 122:08: Info (map "fnaf1_survival_n6") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220324.log")
L 03/24/2022 - 122:08: [SM] Exception reported: Entity -1 (-1) is invalid
L 03/24/2022 - 122:08: [SM] Blaming: l4d2_srs.smx
L 03/24/2022 - 122:08: [SM] Call stack trace:
L 03/24/2022 - 122:08: [SM] [0] GetEntPropString
L 03/24/2022 - 122:08: [SM] [1] Line 505, C:\Users\kruff\Desktop\sm1.11 scripting\include\pan0s.inc::SetNameToPure
L 03/24/2022 - 122:08: [SM] [2] Line 1464, C:\Users\kruff\Desktop\l4d2_srs_v2.5\sourcemo d\scripting\l4d2_srs.sp::Event_PlayerDeath
Do these errors affect something? If no, you can just ignore it.

Quote:
Originally Posted by laurauwu View Post
BUG:
It won't let me close the ranking menu, I try to open another purchase menu, or any menu and it won't let me open, this menu simply crashes and doesn't leave my screen, I can't use the store and any other server menu because of that

First if you want to type command to close it, you need to add the command into the source (if adding it into .cfg doesn't work) or .cfg, the value name is srs_command_white_list.

Second, which version are you using for the non-closable SRS panel?
__________________

Last edited by pan0s; 03-26-2022 at 00:27.
pan0s is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-19-2022 , 15:48   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #37

Quote:
Originally Posted by pan0s View Post
Do these errors affect something? If no, you can just ignore it.




First if you want to type command to close it, you need to add the command into the source (if adding it into .cfg doesn't work) or .cfg, the value name is srs_command_white_list.

Second, which version are you using for the non-closable SRS panel?
Some special interactions will reset a player's database entry.

Please don't save when a player disconnects, instead opt into using "SET column = column + value" wherever ranks and points and etc are gained.

Whether or not the errors are to blame ( as the situation is unrelated ) I don't believe in saving after disconnection, and I had plugins reset databases every time I used these.

Also, feel free to connect to my karma plugin without even using an include

https://github.com/eyal282/l4d2-poin...emAPI.sp#L1024

If player_death fires with "headshot" set to 2 ( which is a boolean being set to 2 ) then it's a karma kill.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 05-20-2022 at 09:25.
eyal282 is offline
alasfourom
Senior Member
Join Date: Feb 2022
Location: Saudi Arabia
Old 06-09-2022 , 01:39   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #38

I would suggest adding command, like sm_place

So you can display your current rank + score + comparing your rank like this 20 of 958.

so it looks like something like this:

PHP Code:
RegConsoleCmd("sm_place"Command_Place);

public 
Action Command_Place(int clientint args)
{
    
PrintToChatAll("\x04[Rank] \x01Player \x03%N \x01is currently ranked as number \x05%d\x01."clientg_players[client]);
    return 
Plugin_Handled

Will be really cool

Last edited by alasfourom; 07-30-2022 at 22:16.
alasfourom is offline
VYRNACH_GAMING
Member
Join Date: Sep 2021
Old 06-12-2022 , 10:10   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #39

Quote:
Originally Posted by eyal282 View Post
Some special interactions will reset a player's database entry.

Please don't save when a player disconnects, instead opt into using "SET column = column + value" wherever ranks and points and etc are gained.

Whether or not the errors are to blame ( as the situation is unrelated ) I don't believe in saving after disconnection, and I had plugins reset databases every time I used these.

Also, feel free to connect to my karma plugin without even using an include

https://github.com/eyal282/l4d2-poin...emAPI.sp#L1024

If player_death fires with "headshot" set to 2 ( which is a boolean being set to 2 ) then it's a karma kill.
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
__________________
VYRNACH_GAMING is offline
Hawkins
Senior Member
Join Date: Jul 2021
Old 06-12-2022 , 10:42   Re: [L4D2] Statistic and Ranking System (SRS) [v2.5 | 17 March 2022]
Reply With Quote #40

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
It happened for me with v.2.2

Last edited by Hawkins; 06-12-2022 at 10:42.
Hawkins 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:45.


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