Jackzmc / l4d2-stats-plugin

L4D2 statistics tracking plugin & website
https://stats.jackz.me
MIT License
12 stars 5 forks source link

Some Functions Not Working #34

Closed tonghongte closed 3 months ago

tonghongte commented 3 months ago

Sorry to bother you. I am experiencing issues with certain functions not working properly. I'm not sure if this is due to an installation problem or if there is an issue with the database. Thank you. image image image image image image image image

Jackzmc commented 3 months ago

I'm not sure why the top query is having that error, somehow its returning nothing. I put a manual fix for that.

I also went ahead and removed the playstyle/playrating UI (it required one of my custom scripts), so that should hopefully fix the other errors.

tonghongte commented 3 months ago

Thank you for the update. There are no more error messages, but Summary and Weapon Statistics still cannot work. The stats_weapons_usage in database is still 0. Is this normal?

Jackzmc commented 3 months ago

It's not, but I would need more information. Can you get the HTTP response for the summary queries, and have you checked the game server console for any plugin errors? My guess is that I forgot to update the .sql file with the latest fields and it's complaining about that

tonghongte commented 3 months ago

image image api respond with 500

{
    "message": "Request failed with status code 500",
    "name": "AxiosError",
    "stack": "AxiosError: Request failed with status code 500\n    at settle (webpack-internal:///./node_modules/axios/lib/core/settle.js:24:12)\n    at XMLHttpRequest.onloadend (webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:126:66)",
    "config": {
        "transitional": {
            "silentJSONParsing": true,
            "forcedJSONParsing": true,
            "clarifyTimeoutError": false
        },
        "adapter": [
            "xhr",
            "http"
        ],
        "transformRequest": [
            null
        ],
        "transformResponse": [
            null
        ],
        "timeout": 0,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1,
        "maxBodyLength": -1,
        "env": {},
        "headers": {
            "Accept": "application/json, text/plain, */*",
            "Cache-Control": "no-cache"
        },
        "baseURL": "/",
        "cache": true,
        "method": "get",
        "url": "/api/summary"
    },
    "code": "ERR_BAD_RESPONSE",
    "status": 500
}

SourceMod error log:

L 06/15/2024 - 03:43:35: SourceMod error session started
L 06/15/2024 - 03:43:35: Info (map "l4d2_timemachine_04") (file "d:\program files\steam\l4d2 #0\left4dead2\addons\sourcemod\logs\errors_20240615.log")
L 06/15/2024 - 03:43:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:44:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:45:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:46:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:47:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:48:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:49:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:50:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:51:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:52:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:53:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:54:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:55:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:56:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:57:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:58:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 03:59:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:00:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:01:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:02:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:03:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:04:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:05:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:06:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:07:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:08:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:09:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:10:35: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:11:36: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:12:10: Error log file session closed.
L 06/15/2024 - 04:12:33: SourceMod error session started
L 06/15/2024 - 04:12:33: Info (map "c1m1_hotel") (file "d:\program files\steam\l4d2 #0\left4dead2\addons\sourcemod\logs\errors_20240615.log")
L 06/15/2024 - 04:12:33: [l4d2_stats_recorder.smx] DBCT_Generic returned error: Duplicate entry 'STEAM_1:1:419800123-1718392655' for key 'PRIMARY'
L 06/15/2024 - 04:14:10: Error log file session closed.

When I tried to compile the script:

//// l4d2_stats_recorder.sp
//
// D:\Program Files\Steam\L4D2 #0\left4dead2\addons\sourcemod\scripting\include\jutils.inc(1) : error 010: invalid function or declaration
//
// 1 Error.
//
// Compilation Time: 2.8 sec
// ----------------------------------------

Is this my installation issue? or I don't need to compile the new one?

Jackzmc commented 3 months ago

Alright from the client side it gives no useful error, there should be an error on the server for /api/summary request.

For the sourcemod errors, those steamids are completely invalid, I don't know how that can even happen unless someone spoofs steamids. Is that a steamid that shows up in game?

For the compile errors, what version of SM are you using to compile? It needs to be SM 1.11 or above, 1.10 might work. You shouldn't need to compile, the SMX should be the latest.

tonghongte commented 3 months ago

But I don't see any log in website-api server console, is there any other way to check it?

Jackzmc commented 3 months ago

Okay I looked into the /summary, I think it's hitting a section that doesn't log any error. There is not any official campaign games recorded, and I was just lazy and threw an error.

I pushed a fix for the API server, see if that worked.

tonghongte commented 3 months ago

Thank you, the Summary page is working. The last thing is "stats_weapons_usage" don't have anything. Is it my sql not setting right or what? Sorry to bother you with so many questions.

Jackzmc commented 3 months ago

No worries, I'm not sure why the weapon usage isn't working, the sourcemod errors could be from the weapon usage, its not very clear.

I pushed a change that should log what query the errors belong to, see if those errors show up with DBCT_Generic query `WEAPON_STATS` returned ...

tonghongte commented 3 months ago

The plugin failed to load

L 06/16/2024 - 01:33:13: SourceMod error session started
L 06/16/2024 - 01:33:13: Info (map "c1m1_hotel") (file "d:\program files\steam\l4d2 #0\left4dead2\addons\sourcemod\logs\errors_20240616.log")
L 06/16/2024 - 01:33:13: [SM] Failed to load plugin "l4d2_stats_recorder.smx": Unable to load plugin (bad header).
Jackzmc commented 3 months ago

Try again, messed up the symlink.

tonghongte commented 3 months ago

image Thank you, looks like it is working now.

tonghongte commented 3 months ago

Sorry, the session seems not recorded and I got error like this today:


L 06/17/2024 - 01:47:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:47:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:48:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:48:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:49:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:50:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:50:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:51:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:51:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:52:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:52:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:53:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:53:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:54:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:54:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:55:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
L 06/17/2024 - 01:55:18: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:55:48: [l4d2_stats_recorder.smx] DBCT_Generic query `HEATMAPS` returned error: Duplicate entry 'STEAM_1:0:575087675-1718556424' for key 'PRIMARY'
L 06/17/2024 - 01:56:21: Error log file session closed.
L 06/17/2024 - 02:31:21: SourceMod error session started
L 06/17/2024 - 02:31:21: Info (map "bdp_bunker05a") (file "d:\program files\steam\l4d2 #0\left4dead2\addons\sourcemod\logs\errors_20240617.log")
L 06/17/2024 - 02:31:21: [l4d2_stats_recorder.smx] RecordCampaign, failed to get UUID: Table 'left4dead2.map_info' doesn't exist
L 06/17/2024 - 02:38:53: [l4d2_stats_recorder.smx] [l4d2_stats_recorder] RecordCampaign for 0 failed. UUID  | Query: `INSERT INTO stats_games (`steamid`, `map`, `gamemode`,`campaignID`, `finale_time`, `join_time`,`date_start`,`date_end`, `zombieKills`, `survivorDamage`, `MedkitsUsed`, `PillsUsed`, `MolotovsUsed`, `PipebombsUsed`, `BoomerBilesUsed`, `AdrenalinesUsed`, `DefibrillatorsUsed`, `DamageTaken`, `ReviveOtherCount`, `FirstAidShared`, `Incaps`, `Deaths`, `MeleeKills`, `difficulty`, `ping`,`boomer_kills`,`smoker_kills`,`jockey_kills`,`hunter_kills`,`spitter_kills`,`charger_kills`,`server_tags`,`characterType`,`honks`,`top_weapon`, `SurvivorFFCount`, `SurvivorFFTakenCount`, `SurvivorFFDamage`, `SurvivorFFTakenDamage`) VALUES ('STEAM_1:1:195797958','bdp_bunker05a','coop','',452,1718553207,1718553125,UNIX_TIMESTAMP(),1705,871,16,7,11,3,3,2,0,764,3,2,3,3,390,1,102,23,19,21,17,14,17,'',6,0,'',205,14,215,24)` | Error: Unknown column 'join_time' in 'field list'
L 06/17/2024 - 02:38:53: [l4d2_stats_recorder.smx] [l4d2_stats_recorder] RecordCampaign for 0 failed. UUID  | Query: `INSERT INTO stats_games (`steamid`, `map`, `gamemode`,`campaignID`, `finale_time`, `join_time`,`date_start`,`date_end`, `zombieKills`, `survivorDamage`, `MedkitsUsed`, `PillsUsed`, `MolotovsUsed`, `PipebombsUsed`, `BoomerBilesUsed`, `AdrenalinesUsed`, `DefibrillatorsUsed`, `DamageTaken`, `ReviveOtherCount`, `FirstAidShared`, `Incaps`, `Deaths`, `MeleeKills`, `difficulty`, `ping`,`boomer_kills`,`smoker_kills`,`jockey_kills`,`hunter_kills`,`spitter_kills`,`charger_kills`,`server_tags`,`characterType`,`honks`,`top_weapon`, `SurvivorFFCount`, `SurvivorFFTakenCount`, `SurvivorFFDamage`, `SurvivorFFTakenDamage`) VALUES ('STEAM_1:0:575087675','bdp_bunker05a','coop','',452,1718553220,1718553125,UNIX_TIMESTAMP(),1708,517,20,4,12,6,1,5,0,935,5,4,4,1,129,1,75,18,24,18,17,15,18,'',5,0,'',104,13,129,38)` | Error: Unknown column 'join_time' in 'field list'
L 06/17/2024 - 02:40:30: Error log file session closed.```
Jackzmc commented 3 months ago

Your stats_games table is missing a column, which is strange, as that column has been there since the beginning. I updated the SQL file with all the missing columns in all the tables, but it will require recreating the tables.

About the heatmap errors, that steamid is invalid, I don't know how that even happens, as the RecordCampaign uses the same variable and it's fine. I disabled the heatmaps by default, it's not a very polished feature, I just wanted it for my own sake. You can also just set l4d2_statsrecorder_heatmaps_enabled to 0.