Raised This Month: $ Target: $400
 0% 

[CS:GO] ckSurf (1.18f, 24.11.2015)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CookieB
Member
Join Date: Apr 2016
Location: Germany
Old 03-22-2017 , 14:00   Re: [CS:GO] ckSurf (1.18f, 24.11.2015)
Reply With Quote #11

Quote:
Originally Posted by justaFluffypanda View Post
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

Last edited by CookieB; 03-22-2017 at 14:17.
CookieB is offline
 



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 01:27.


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