Releases: azalty/sm-ct-bans
[2.0.7 Beta 2] Ban time saving when disconnecting bug fix
THIS IS A PRE-RELEASE
Those changes are experimental and could cause issues. More testing is advised.
- Fixed a bug introduced by my latest 2.0.7 experimental fixes (pre-release) that occurred when a player with a temporary CTBan disconnected from the server or maps switched
The 2.0.7 pre-release is now considered 2.0.7 Beta 1. Here are its changelogs:
- Updated the
CTBan_OnClientBan_Offline
forward prototype to support the ban duration in minutes as well as the reason. This change shouldn't break other plugins that use the old prototype of this forward, but more testing is required. Please contact me in case it worked (or didn't work) for you.- New prototype:
forward void CTBan_OnClientBan_Offline(char[] sAuthID, int iAdmin, int iMinutes, const char[] sReason);
- New prototype:
- Added ban time left saving when the plugin is unloaded mid-game: clients with a temporary ctban should now have their time properly updated to the database when the plugin is unloaded mid-game. Before, it would only save the ban time left when a client disconnected.
- This change is experimental and may cause short freezes if you unload the plugin mid-game. If you notice any long freeze, please contact me.
[2.0.7] Forward update and ban time saving on unload (2.0.7 Beta 1)
THIS IS A PRE-RELEASE
Those changes are experimental and could cause issues. More testing is advised.
- Updated the
CTBan_OnClientBan_Offline
forward prototype to support the ban duration in minutes as well as the reason. This change shouldn't break other plugins that use the old prototype of this forward, but more testing is required. Please contact me in case it worked (or didn't work) for you.- New prototype:
forward void CTBan_OnClientBan_Offline(char[] sAuthID, int iAdmin, int iMinutes, const char[] sReason);
- New prototype:
- Added ban time left saving when the plugin is unloaded mid-game: clients with a temporary ctban should now have their time properly updated to the database when the plugin is unloaded mid-game. Before, it would only save the ban time left when a client disconnected.
- This change is experimental and may cause short freezes if you unload the plugin mid-game. If you notice any long freeze, please contact me.
[2.0.6] Improved offline ctbans with custom duration and reason support, minor changes
- Improved sm_ctban_offline command by supporting a custom duration and reason
- Added quotes ("") support for sm_ctban_offline, sm_unctban_offline (as well as its alias sm_unctban_offline) and sm_isbanned_offline. Previously, quotes weren't removed properly.
- Improved code visibility in some places
- Fixed a bit the french translations
Note: Writing the SteamID between double quotes (") is now needed for sm_ctban_offline.
Here is the new syntax: sm_ctban_offline <"steamid"> <optional: time> <optional: reason>
Examples (these are all valid):
sm_ctban_offline "STEAM_1:1:57298004" 60 "Freekill, doesn't know the rules"
sm_ctban_offline "STEAM_1:1:57298004" 60 Freekill, doesn't know the rules
sm_ctban_offline "STEAM_1:1:57298004" 60
sm_ctban_offline "STEAM_1:1:57298004"
However, this isn't valid: sm_ctban_offline STEAM_1:1:57298004
Note 2: sm_ctban_force_reason isn't enforced for sm_ctban_offline. The reason is always optional.
Note 3: I might do the same thing for Rage Bans, but offline CT bans with custom durations and reasons are supported now, so it isn't my top priority.
Warning: This release was bugged, and is now fixed with this commit. If you downloaded it within 5 hours of its release, you need to update it again! The bugged release was replaced by the fixed and final 2.0.6 in this release, so you can download it safely.
[2.0.5] Fixed duplicate SQL connections being created on map change
[2.0.4] Ban time resetting on map change fix, and some quick fixes
- Removed a useless query that was causing a ban duration reset when a map change occured (discrepancy between ban time variable and data from the database due to a problem with the order of the queries)
- Fixed (re)loading the plugin mid game preventing banned players from having their ban time properly loaded, thus making the plugin think it was a permanent ban. Reconnecting fixed that, but now it shouldn't happen anymore (I hope).
- Fixed a typo :)
Q: Why is the plugin so much smaller?
A: I used a different hosties.inc file from a semi-fixed version of SM Hosties. As far as I know, it didn't change any function from ct-bans (i'm pretty sure it only uses 1 from it), it only makes the plugin file smaller! Win, win :)
Q: What was the problem with the order of the queries?
A: I'll try to answer you, but I really suck at using the right vocabulary.
In short, queries in sourcemod are stored in a queue. First in, first out: they are processed one by one in the order they were added. This is good, since you will wait for the first query to be done before doing the second one, which might need the first one, or might have newer infos. If it wasn't working like that, it could update the newer infos (query 2, latest) and then the old ones (query 1, old).
The problem that was in the plugin is:
- Player disconnects: add a (useless - logging only) query to the queue.
- Once the callback arrives (the query just executed), add another query to the queue.
The problem here is that it adds the other query WHEN the first query calls back, rather than right after the first query was added to the queue! This meant that if you were quick enough to reconnect before that first query was finished (which happens when a mapchange occurs), the plugin would add a query to the queue to get your ban infos, and that query would thus be between the first useless, logging only query AND the one that actually updated your ban time.
Result: your ban time variable is the old value from the database (the one you had on your initial connection, before the map change) and your ban time on the database is up to date. Disconnecting then would push your old values to the database and boom, you get a never-ending CT Ban.
Congratulations on reading this explanatory nightmare. Understanding it, on the other hand, is on a whole other level.