to the SourceBans 1.5 game plugin!
Since rewriting both the game plugin and web panel for SourceBans 2.0 was too big of an undertaking, considering we have a small development team, I opted to first rewrite the game plugin for the current release. This version consists of 3 plugins:
This plugin is mandatory and handles the connection to the database, as well as loading of the configuration file. It provides natives for third party plugins to retrieve configuration values and query the database. If the database connection is lost, it will reconnect the next time a query is executed.
Based off of the collection of SQL admin plugins that come with SourceMod, it provides commands and natives to add/delete admins and groups from within the game server. It has full support for command/group overrides, group immunity might be enabled later or with SourceBans 2.0. If you don't want to use the admins part of SourceBans, simply don't install this plugin
Integrates with SourceMod's banning system (supporting BanClient
) and stores bans in a local database for 5 minutes, instead of using Valve's banning system. This database also stores bans temporarily in case your MySQL server goes down. Lastly, the ban length menu is configurable to show specific options to different admin groups.
Forwards and natives
<!-- Reload config and ban reason menu options -->
<!-- Add/remove admins and groups -->
sb_addadmin <name> <authtype> <identity> [password] [group1] ... [group N]
sb_deladmin <authtype> <identity>
sb_addgroup <name> <flags> [immunity]
sb_setadmingroups <authtype> <identity> [group1] ... [group N]
<!-- Ban/unban Steam IDs and IP addresses -->
sm_ban <#userid|name> <minutes|0> [reason]
sm_banip <ip|#userid|name> <time> [reason]
sm_addban <time> <steamid> [reason]
(Full documentation is in the include file)
forward void SB_OnConnect(Database db);
forward void SB_OnReload();
native void SB_Connect();
native bool SB_Escape(const char string, char buffer, int maxlength, int &written = 0);
native void SB_Execute(const char query, DBPriority prio = DBPrio_Normal);
native void SB_GetConfigString(const char key, char buffer, int maxlength);
native any SB_GetConfigValue(const char key);
native void SB_Init();
native void SB_Query(SQLQueryCallback callback, const char query, any data = 0, DBPriority prio = DBPrio_Normal);
native void SB_Reload();
native int SB_GetAdminId(int client);
native void SB_AddAdmin(int client, const char name, const char authtype, const char identity, const char password = "", const char groups = "");
native void SB_DeleteAdmin(int client, const char authtype, const char identity);
native void SB_AddGroup(int client, const char name, const char flags, int immunity = 0);
native void SB_DeleteGroup(int client, const char name);
native void SB_SetAdminGroups(int client, const char authtype, const char identity, const char groups = "");
native void SB_ReportPlayer(int client, int target, const char reason);
Although I have tested it a lot, I can't be certain everything works correctly, so I wouldn't recommend running it on a production server yet. I'm especially interested in:
- If the server ID is correctly detected
- If admin and group permissions are retrieved correctly from the database
- If bans are stored properly, even from third party plugins
- If the local bans database works correctly
- Any other problems or errors
Some notable differences from the previous plugin:
- configs/sourcebans/sourcebans.cfg is now configs/sourcebans.cfg
- Inside sourcebans.cfg, instead of a "ServerID" option, there is now a "ServerIP" option, which you should only need if your game server is behind NAT (a router/firewall) or if -ip is not set on startup.
- If there is no "sourcebans" section inside configs/databases.cfg, it will use the "default" section instead
- The sm_rehash command has been removed, since it had the same functionality as the sm_reloadadmins command that's provided by SourceMod.
- There is no option yet to backup admins to config files in case the database connection is lost. Since SourceMod already has an admin cache, this should only be a problem if you restart the game server.
Thanks for all the help in advance!