Quote:
Originally Posted by justaFluffypanda
I've discovered the problem with server displaying the wrong name next to the map record.
In the csgo/addons/sourcemod/scripting/ckSurf/sql.sp file the line
Code:
char sql_selectMapRecord[] = "SELECT MIN(runtimepro), name, steamid FROM ck_playertimes WHERE mapname = '%s' AND runtimepro > -1.0";
is poorly written and returns the wrong value. In fact, in MySQL >= 5.7 this line will cause MySQL to throw an error. I've changed it to this:
Code:
char sql_selectMapRecord[] = "SELECT runtimepro, name, steamid FROM ck_playertimes WHERE mapname = '%s' AND runtimepro = (SELECT MIN(runtimepro) FROM ck_playertimes) AND runtimepro > -1.0";
There are several more poorly written SQL statements in this file, I will report back once I track them all down. Happy coding.
EDIT:
Don't forget to recompile ckSurf and move the new smx file into your csgo/addons/sourcemod/plugins directory after you make changes to sql.sp ;)
|
I tested your expression in the mysql command line and it returns an empty set for the maps.
-- Your fault seems to be that your second query selects the minimal runtime first and isn't executed upon the first query.
-- Fixing it with minimal change would be:
Code:
SELECT runtimepro, name, steamid FROM ck_playertimes WHERE mapname = '%s' AND runtimepro = (SELECT MIN(runtimepro) FROM ck_playertimes WHERE mapname = '%s' ) AND runtimepro > -1.0;
Though having 2 %s in there means probably usage code needs to be adjusted so not a very good solution.
Code:
mysql Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (x86_64) using readline 6.3