From fa5db1f7155b96ab44d64b28e359be80785d29bf Mon Sep 17 00:00:00 2001 From: qawery-just-sad <53490397+qawery-just-sad@users.noreply.github.com> Date: Wed, 3 Jun 2020 10:56:04 +0200 Subject: [PATCH] get sm_server_tier to mapchooser & updated readme --- README.md | 26 +++++++++++++++++------ addons/sourcemod/scripting/mapchooser.sp | 4 +++- addons/sourcemod/scripting/nominations.sp | 5 ++--- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6cb4cb4..2b84bb3 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,28 @@ ## About -This is a edit of the default SourceMod mapchooser and nomination plugin, it provides functionality for any ckSurf based timer to display tiers of maps in the nominate and vote menus +This is a edit of the default SourceMod mapchooser and nomination plugin, it provides functionality for Fluffys SurfTimer or it's forks to display tiers of maps in the nominate and vote menus. ## Requirements -* Sourcemod 1.8 -* MySQL +* Sourcemod 1.8+ +* MySQL 5.7 / 8+ / MariaDB supported +* SurfTimer from [Olokos](https://github.com/surftimer/Surftimer-olokos) or [Fluffys](https://github.com/fluffyst/Surftimer)(NO LONGER MAINTAINED!) ## Installation -* Upload all the files to your csgo server directory -* Add a MySQL database called `surftimer` to `csgo/addons/sourcemod/configs/databases.cfg` (Note: must match the database you're using for SurfTimer`) -* Set `sm_cksurf_type` in `cfg/nominations.cfg` (0 if using original/nikos/marcos ckSurf, 1 if using fluffys/z4lab's SurfTimer) -* Set `sm_server_tier` in `cfg/nominations.cfg` to the tier of maps you want appearing the nominate list. Example, for a tier 1-3 server, set it to `sm_server_tier 1.3`, a tier 1 only server would be `sm_server_tier 1.0` +* Get latest plugin files from [Realase Page](https://github.com/qawery-just-sad/surftimer-mapchooser/releases) +* Copy files over to `csgo/addons/sourcemod` +* Make sure that `csgo/addons/sourcemod/configs/databases.cfg` points to the surftimer database (You have to use the same database as the SurfTimer) +``` +"surftimer" + { + "driver" "mysql" + "host" "localhost" // The ip address to the database server + "database" "surftimerdb" // The database name that surftimer uses + "user" "dbuser" // The user name that has access to that database + "pass" "dbuserpassword" // The password for user specified above + "port" "3306" // The port to the database server + } +``` +* Set `sm_server_tier` in `csgo/cfg/mapchooser.cfg` to the tier of maps you want appearing the nominate list. Example, for a tier 1-3 server, set it to `sm_server_tier 1.3`, a tier 1 only server would be `sm_server_tier 1.0` diff --git a/addons/sourcemod/scripting/mapchooser.sp b/addons/sourcemod/scripting/mapchooser.sp index 7af7086..9f5349d 100644 --- a/addons/sourcemod/scripting/mapchooser.sp +++ b/addons/sourcemod/scripting/mapchooser.sp @@ -146,6 +146,9 @@ public void OnPluginStart() g_Cvar_RunOff = CreateConVar("sm_mapvote_runoff", "0", "Hold run of votes if winning choice is less than a certain margin", _, true, 0.0, true, 1.0); g_Cvar_RunOffPercent = CreateConVar("sm_mapvote_runoffpercent", "50", "If winning choice has less than this percent of votes, hold a runoff", _, true, 0.0, true, 100.0); + // KP Surf ConVars + g_Cvar_ServerTier = CreateConVar("sm_server_tier", "1.0", "Specifies the tier range for maps, for example if you want a tier 1-3 server make it 1.3, a tier 2 only server would be 2.0, etc", 0, true, 1.0, true, 8.0); + RegAdminCmd("sm_mapvote", Command_Mapvote, ADMFLAG_CHANGEMAP, "sm_mapvote - Forces MapChooser to attempt to run a map vote now."); RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap "); @@ -1245,7 +1248,6 @@ public void SelectMapList() { char szQuery[256], szTier[16], szBuffer[2][32]; - g_Cvar_ServerTier = FindConVar("sm_server_tier"); GetConVarString(g_Cvar_ServerTier, szTier, sizeof(szTier)); ExplodeString(szTier, ".", szBuffer, 2, 32); diff --git a/addons/sourcemod/scripting/nominations.sp b/addons/sourcemod/scripting/nominations.sp index b9de359..4ccfd23 100644 --- a/addons/sourcemod/scripting/nominations.sp +++ b/addons/sourcemod/scripting/nominations.sp @@ -81,8 +81,6 @@ public void OnPluginStart() g_Cvar_ExcludeOld = CreateConVar("sm_nominate_excludeold", "1", "Specifies if the MapChooser excluded maps should also be excluded from Nominations", 0, true, 0.00, true, 1.0); g_Cvar_ExcludeCurrent = CreateConVar("sm_nominate_excludecurrent", "1", "Specifies if the current map should be excluded from the Nominations list", 0, true, 0.00, true, 1.0); - // KP Surf ConVars - g_Cvar_ServerTier = CreateConVar("sm_server_tier", "1.0", "Specifies the servers tier to only include maps from, for example if you want a tier 1-3 server make it 1.3, a tier 2 only server would be 2.0, etc", 0, true, 1.0, true, 8.0); RegConsoleCmd("sm_nominate", Command_Nominate); @@ -460,7 +458,8 @@ public void db_setupDatabase() public void SelectMapList() { char szQuery[256], szTier[16], szBuffer[2][32]; - + + g_Cvar_ServerTier = FindConVar("sm_server_tier"); GetConVarString(g_Cvar_ServerTier, szTier, sizeof(szTier)); ExplodeString(szTier, ".", szBuffer, 2, 32);