diff --git a/README.md b/README.md
index 76ba53e8..0f646b4a 100644
--- a/README.md
+++ b/README.md
@@ -97,9 +97,12 @@ a bhop server should be simple
- [ ] Add strafe sync to the WR menu where available.
- [ ] Add `sm_bwr` `sm_bonuswr` `sm_bonusworldrecord`.
- [ ] Use unix timestamps for future record dates.
+- [ ] [rankings] Calculate points per scored time once it's added to the database.
+- [ ] [rankings] Show points in WR menu.
~ shavit-stats
- [x] Make style names editable from shavit.inc (like I did to the rest of modules) (dynamic!)
+- [ ] Points implementation
~ shavit-misc
- [x] Allow changing the prespeed limitation.
@@ -111,9 +114,10 @@ a bhop server should be simple
- [x] On map finish.
~ [NEW PLUGIN] shavit-rankings:
-- [ ] Create tables. (`mappoints`, `playerpoints`)
-- [ ] Allow RCON admins to set ideal points for map and time for the default style.
-- [ ] Implement an algorithm that will calculate points for the map, will also take the time and style into account. Add a +25% bonus if the time is equal or better than the ideal one.
+- [x] Create tables. (`mappoints`, `playerpoints`)
+- [x] Allow ROOT admins to set ideal points for map and time for the default style.
+- [ ] Add `sm_points`.
+- [ ] Implement an algorithm that will calculate points for the current map, will also take the time and style into account. Add a +25% bonus if the time is equal or better than the ideal one.
- [ ] Use a weighting system for points calculation. The highest ranked time will be weighted 100% and worse times will be weighted as 5% less each time.
- [ ] Calculate points and rank for players once they connect to the server.
- [ ] Add `sm_top` that will show the top X players, sort by points.
diff --git a/scripting/include/shavit.inc b/scripting/include/shavit.inc
index bdf281d3..37619269 100644
--- a/scripting/include/shavit.inc
+++ b/scripting/include/shavit.inc
@@ -141,6 +141,19 @@ char gS_ShortBhopStyles[MAX_STYLES][] =
};
#endif
+#if defined USES_STYLE_MULTIPLIERS
+// ranking system
+float gI_RankingMultipliers[MAX_STYLES] =
+{
+ 1.00, // Forwards
+ 1.30, // Sideways
+ 1.33, // W-Only
+ 1.30, // Scroll
+ 1.50, // 400 Velocity
+ 1.20 // HSW
+};
+#endif
+
// map zones
#define MULTIPLEZONES_LIMIT 32
diff --git a/scripting/shavit-core.sp b/scripting/shavit-core.sp
index 16078ca4..56ce97c9 100644
--- a/scripting/shavit-core.sp
+++ b/scripting/shavit-core.sp
@@ -72,7 +72,7 @@ bool gB_HUD = false;
// cvars
ConVar gCV_Autobhop = null;
-ConVar gCV_Leftright = null;
+ConVar gCV_LeftRight = null;
ConVar gCV_Restart = null;
ConVar gCV_Pause = null;
ConVar gCV_NoStaminaReset = null;
@@ -88,7 +88,7 @@ public Plugin myinfo =
author = "shavit",
description = "The core for shavit's bhop timer.",
version = SHAVIT_VERSION,
- url = "http://forums.alliedmods.net/member.php?u=163134"
+ url = "https://github.com/shavitush/bhoptimer"
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
@@ -210,7 +210,7 @@ public void OnPluginStart()
CreateConVar("shavit_version", SHAVIT_VERSION, "Plugin version.", FCVAR_NOTIFY|FCVAR_DONTRECORD);
gCV_Autobhop = CreateConVar("shavit_core_autobhop", "1", "Enable autobhop?\nWill be forced to not work if STYLE_AUTOBHOP is not defined for a style!", FCVAR_NOTIFY, true, 0.0, true, 1.0);
- gCV_Leftright = CreateConVar("shavit_core_blockleftright", "1", "Block +left/right?", 0, true, 0.0, true, 1.0);
+ gCV_LeftRight = CreateConVar("shavit_core_blockleftright", "1", "Block +left/right?", 0, true, 0.0, true, 1.0);
gCV_Restart = CreateConVar("shavit_core_restart", "1", "Allow commands that restart the timer?", 0, true, 0.0, true, 1.0);
gCV_Pause = CreateConVar("shavit_core_pause", "1", "Allow pausing?", 0, true, 0.0, true, 1.0);
gCV_NoStaminaReset = CreateConVar("shavit_core_nostaminareset", "1", "Disables the built-in stamina reset.\nAlso known as 'easybhop'.\nWill be forced to not work if STYLE_EASYBHOP is not defined for a style!", 0, true, 0.0, true, 1.0);
@@ -769,7 +769,7 @@ public void OnClientPutInServer(int client)
char[] sCountry = new char[45];
GeoipCountry(sIP, sCountry, 45);
- if(StrEqual(sCountry, ""))
+ if(strlen(sCountry) == 0)
{
strcopy(sCountry, 45, "Local Area Network");
}
@@ -819,7 +819,6 @@ public void SQL_SetPrefix()
while(fFile.ReadLine(sLine, PLATFORM_MAX_PATH * 2))
{
TrimString(sLine);
-
strcopy(gS_MySQLPrefix, 32, sLine);
break;
@@ -898,7 +897,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
bool bOnLadder = (GetEntityMoveType(client) == MOVETYPE_LADDER);
- if(gCV_Leftright.BoolValue && gB_TimerEnabled[client] && (!gB_Zones || !Shavit_InsideZone(client, Zone_Start) && (buttons & IN_LEFT || buttons & IN_RIGHT)))
+ if(gCV_LeftRight.BoolValue && gB_TimerEnabled[client] && (!gB_Zones || !Shavit_InsideZone(client, Zone_Start) && (buttons & IN_LEFT || buttons & IN_RIGHT)))
{
Shavit_StopTimer(client);
Shavit_PrintToChat(client, "I've stopped your timer for using +left/+right. No cheating!");
diff --git a/scripting/shavit-hud.sp b/scripting/shavit-hud.sp
index aee28fe5..245ee8d8 100644
--- a/scripting/shavit-hud.sp
+++ b/scripting/shavit-hud.sp
@@ -69,7 +69,7 @@ public Plugin myinfo =
author = "shavit",
description = "HUD for shavit's bhop timer.",
version = SHAVIT_VERSION,
- url = "http://forums.alliedmods.net/member.php?u=163134"
+ url = "https://github.com/shavitush/bhoptimer"
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
diff --git a/scripting/shavit-misc.sp b/scripting/shavit-misc.sp
index 3ede0552..027d5c96 100644
--- a/scripting/shavit-misc.sp
+++ b/scripting/shavit-misc.sp
@@ -58,7 +58,7 @@ public Plugin myinfo =
author = "shavit",
description = "Miscellaneous stuff for shavit's bhop timer.",
version = SHAVIT_VERSION,
- url = "http://forums.alliedmods.net/member.php?u=163134"
+ url = "https://github.com/shavitush/bhoptimer"
}
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
diff --git a/scripting/shavit-rankings.sp b/scripting/shavit-rankings.sp
new file mode 100644
index 00000000..9a284cbb
--- /dev/null
+++ b/scripting/shavit-rankings.sp
@@ -0,0 +1,212 @@
+/*
+ * shavit's Timer - Rankings
+ * by: shavit
+ *
+ * This file is part of shavit's Timer.
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 3.0, as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see .
+ *
+*/
+
+#include
+
+// #define USES_STYLE_MULTIPLIERS
+#include
+
+#pragma newdecls required
+#pragma semicolon 1
+#pragma dynamic 131072
+
+// cache
+char gS_Map[256];
+float gF_IdealTime = 0.0;
+float gF_Points = 0.0;
+
+// database handle
+Database gH_SQL = null;
+
+// table prefix
+char gS_MySQLPrefix[32];
+
+public Plugin myinfo =
+{
+ name = "[shavit] Rankings",
+ author = "shavit",
+ description = "Rankings system for shavit's bhop timer.",
+ version = SHAVIT_VERSION,
+ url = "https://github.com/shavitush/bhoptimer"
+}
+
+public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
+{
+ RegPluginLibrary("shavit-rankings");
+
+ return APLRes_Success;
+}
+
+public void OnAllPluginsLoaded()
+{
+ if(!LibraryExists("shavit-wr"))
+ {
+ SetFailState("shavit-wr is required for the plugin to work.");
+ }
+}
+
+public void OnPluginStart()
+{
+ // database connections
+ Shavit_GetDB(gH_SQL);
+ SQL_SetPrefix();
+ SetSQLInfo();
+
+ // player commands
+ // sm_points
+ // sm_rank
+
+ // admin commands
+ RegAdminCmd("sm_setpoints", Command_SetPoints, ADMFLAG_ROOT, "Set points for a defined ideal time. sm_setpoints