• SourceBans in Lua
    264 replies, posted
  • Avatar of lexic
  • [release][i](Shiny banner goes here)[/i] [b]SourceBans In Lua version 1.531[/b] (Last Update: [i]25th December 2012[/i]) I've been working for a while on getting an implementation of SourceBans going in GLua, so that the benefit of a nice global banning system can be had without the large downside of having to install MetaMod:Source and SourceMod. The result is Sourcebans.lua! This is two things in one: Firstly, it is a complete replacement that a server owner can put in instead of the SourceMod version, and it will continue as normal. Secondly, it is a tool developers can use to create in-game admin mods that completely integrate with SourceBans, allowing you to view bans in-game and use useful menus instead of the concommands. For instance, Overv has done this with [url=http://www.facepunch.com/showthread.php?t=940348]Evolve[/url], which is now SourceBans compatible. [b]For Server Owners[/b] * Uninstall or disable Metamod by moving metamod.vdf from garrysmod/addons/ to garrysmod/addons/metamod/. * Install MySQLOO. Get it [[url=http://www.facepunch.com/showthread.php?t=933647]Here[/url]]. Place libmySQL.dll orangebox/ and gmsv_mysqloo.dll in orangebox/garrysmod/lua/includes/modules/ * Install SourceBans.lua. Get it [[url=http://lexi.org.uk/modules/sourcebans.lua]Here[/url]]. Download the file and place it in garrysmod/lua/includes/modules/ next to gmsv_mysqlloo.dll. * Install the setup file. Get it [[url=http://lexi.org.uk/modules/sourcebans_example.lua]Here[/url]]. Download the file and place it in garrysmod/lua/autorun/server/ and then fill out all the details with your own. * Start your server. Everything should work as normal. [b]For Developers[/b] I have used the handy [url=http://luadoc.luaforge.net/]LuaDoc[/url] system to provide full documentation for the module. You can find it [[url=http://lexi.org.uk/modules/sourcebans.html]Here[/url]]. Please report back if you use this or have any trouble. [b]Thanks[/b] The people who made SourceBans in the first place. The people on my server for being unwilling test pilots Overv for lots of testing and being the first adopter. [b]Changelog[/b] [code] 1.531 Tiny change to make the source GM13 compatible (no more | operator!) 1.53 sm_rehash now goes through all online players and makes sure their group is up to date. 1.521 Fixed a hang if an admin had no srv_flags and no srv_group 1.52 Added various sm_#say commands at a request, and added a SBANS_NO_COMMANDS global variable to disable all admin commands (for pure lua usage) 1.51 Made it work again 1.5 Made it support gatekeeper 1.41 Fixed yet another 'stop loading admins' glitch 1.4 Added GetAdmins(), made it work a bit more. 1.317 Added even more error prevention when an admin doesn't have a server group but is assigned to the server 1.316 Added error prevention when an admin doesn't have a server group but is assigned to the server 1.315 Made sure callback was always actually a function even when not passed one, fixed a typo. 1.31 Added some error checks, removed some sloppy assumptions and fixed queued ban checks not working. 1.3 Pimped up the concommands and made them report more details 1.22 Added dogroups to the config to disable automatic usergroup setting 1.21 Made it so that the player is only kicked if their user object is available 1.2 Made CheckForBan() and BanPlayerBySteamIDAndIP() accessable 1.12 Made the concommands check that the right amount of arguments had been passed. 1.11 Fixed a typo that stopped the fix working 1.1 Fixed the module freezing the server by pinging the database 10 times a second [/code] [/release]
  • So, this uses the normal web interface of Sourcebans? Can I also run sourcemod with this? I disabled all sm_ban commands, so non of them will be used with sourcemod. All the sm commands in your Sourcebans.lua file are removed from the sourcemod I use.
  • Avatar of _axe_
  • Is this a replacement for the VAC security? And does this use a global database wich has write and read permission from every server wich installed this. Like, if someone gets bannes by this system somewhere for a normal reason, he gets banned on all servers using this, and for breaking the private rules of the server, he only gets bannes on that particular server. Here is a siggestion. Why not create certain server rules profiles. Like, this server is for rp, and serious RP only. Someone playing on this server breaks one of the rules in the serious RP profile. This someone gets bannes from all servers using this serious RP profile. Like, the ban gets tagged with this profile relation only. But once he breaks some of the standard rules like cheating, this persons just gets banned from every server using this.
  • Avatar of lexic
  • [QUOTE=Tobba;23830108]Awsome, the second i needed this you released it[/QUOTE] :buddy: [QUOTE=.\\Shadow};23832607]So, this uses the normal web interface of Sourcebans? Can I also run sourcemod with this? I disabled all sm_ban commands, so non of them will be used with sourcemod. All the sm commands in your Sourcebans.lua file are removed from the sourcemod I use.[/QUOTE] Yes, and potentially. the sm_rehash command might cause problems, I don't know. Why do you want to run SourceMod in Garry's Mod? It seems redundant to me. [QUOTE=_axe_;23833174]Is this a replacement for the VAC security? And does this use a global database wich has write and read permission from every server wich installed this. Like, if someone gets bannes by this system somewhere for a normal reason, he gets banned on all servers using this, and for breaking the private rules of the server, he only gets bannes on that particular server. Here is a siggestion. Why not create certain server rules profiles. Like, this server is for rp, and serious RP only. Someone playing on this server breaks one of the rules in the serious RP profile. This someone gets bannes from all servers using this serious RP profile. Like, the ban gets tagged with this profile relation only. But once he breaks some of the standard rules like cheating, this persons just gets banned from every server using this.[/QUOTE] No, this is a Lua version of [[url=http://www.sourcebans.net/]This[/url]] system, which allows you to have a ban enacted on every Source based server you own. It does work in Garry's Mod, but it's a bit laggy so I made a native version.
  • Avatar of BomBom
  • What do you mean by a bit laggy? Do you mean having sourcemod with metamod source and sourcebans makes your server laggy? Also i was going to make something like this for our admin mod cause we use sourcebans but this just made my day, thanks :)
  • [QUOTE=Lexic;23834251] Yes, and potentially. the sm_rehash command might cause problems, I don't know. Why do you want to run SourceMod in Garry's Mod? It seems redundant to me. [/QUOTE] sm_rehash is also removed, all ban-related commands from sourcemod are removed. And I use it for the Rtv/Nominate plugins. And some others on Allied Modders. [b]Edit:[/b] "The server at lexi.org.uk is taking too long to respond." That's firefox. Tried Google Chrome "This webpage is not available. The webpage at [url]http://lexi.org.uk/modules/sourcebans_example.lua[/url] might be temporarily down or it may have moved permanently to a new web address." Site down? Maybe you should post the code here on FP? [b]Edit2:[/b] Working, nevermind.
  • Avatar of lexic
  • [QUOTE=BomBom;23836277]What do you mean by a bit laggy? Do you mean having sourcemod with metamod source and sourcebans makes your server laggy?[/QUOTE] It drops your server FPS a bit and according to Connameku or whatever his new name is, it seends a huge networking spike every 5 minutes. [QUOTE=BomBom;23836277]Also i was going to make something like this for our admin mod cause we use sourcebans but this just made my day, thanks :)[/QUOTE] You're welcome. (:
  • Avatar of gamer_lv
  • This is awesome. I was looking for something like this for a while now. Thank you so much.
  • Avatar of haza55
  • I made my own ages ago for ULX(been using it alongside my ULX MySQL admin list). And when I made it, I couldn't understand why no one had done it yet. Nice work.
  • Just added it, and I just tried something. It doesn't work in-game, it doesn't even do anything when I type in "sm_ban" No error message, or anything. I banned myself using the Web interface, and THAT worked. It just doesn't seem to want to work in-game using sm_ban, sm_addban, or any of those.
  • Avatar of [NNJG]Ben
  • Yes, I have the same problem. Also, sm_ban doesn't work unless you type writeid in RCON after it, but still doesn't go to the website.
  • Avatar of lexic
  • Ok, looked into it, uploaded a new version that should work better. The main reason you weren't receiving feedback is that I'd forgot to import HUD_PRINTCONSOLE. :v: Anyway, I've added new words and that. From server console: [code]sm_ban lexi 5 testing sm_ban: Your ban request has been sent to the database. Dropped Lexi from server (Kicked by Console : You are BANNED from this server!) sm_ban: Lexi has been banned successfully.[/code] From my console: [code] ] sm_addban 120 STEAM_0:1:17496864 Using 'omg! :D' in a serious roleplay event sm_addban: Your ban request has been sent to the database. sm_addban: STEAM_0:1:17496864 has been banned successfully. [/code] Please download the latest version of the module from the post or [[url=http://lexi.org.uk/modules/sourcebans.lua]Here[/url]] and tell me how it works out for you. Thanks.
  • [code] ] sm_addban 14440 STEAMID Rdming You do not have access to this command! clafair (STEAMID) connected from Canada NutterButter: Im going to top floor NutterButter: Im in the building ] sm_rcon sm_addban 14440 STEAMID Rdming [/code] I'm admin on the users file, ulx admin, sourcemod admin. Even admin on the bans website. It didn't update on the website either. [code] ] sm_ban gash 1 test You do not have access to this command! [/code] I also banned myself using the web interface, and it didn't even ban me this time. Just kicked me. [url]http://onlinecomphelp.com/bans/[/url]
  • Avatar of lexic
  • the sm_ commands require various access levels like the normal sourcemod. You need to grant yourself ADMFLAG_BAN, ADMFLAG_RCON and ADMFLAG_UNBAN from the SourceBans website. Like so: [img]http://lexi.org.uk/files/sourcebans_groups_example.png[/img]
  • Avatar of lexic
  • It could be a problem with the z flag... Could you quickly try with z off but all the others on please? I'm not in a position to test right now.
  • Okay, it is a problem with the Z flag. I removed the Z flag, and it worked perfectly... BESIDES the fact that a one minute ban did not unban me after one minute, and sb_reload didn't unban me either once the ban expired. I had to manually sm_unban myself. [b]EDIT[/b] I tried it again, does it ban you for 5 minutes by default if it's lower then 5? Because that's what it did.. lol, I banned myself for 1 minute, took 5 minutes. Banned for 5 minutes, took that long. Anyway, it works. I'm happy. I'll post any other bugs I find :) [b]Edit2[/b] Web interface isn't updating.
  • Avatar of lexic
  • [QUOTE=.\\Shadow};23904165]Okay, it is a problem with the Z flag. I removed the Z flag, and it worked perfectly..[/quote] Ok, I'll get that fixed. [QUOTE=.\\Shadow};23904165]I tried it again, does it ban you for 5 minutes by default if it's lower then 5? Because that's what it did.. lol, I banned myself for 1 minute, took 5 minutes. Banned for 5 minutes, took that long. [/QUOTE] Yep. I didn't think people'd ban for less. I'll look into lowering or not actually doing the ban if it's for shorter. [QUOTE=.\\Shadow};23904165]Anyway, it works. I'm happy. I'll post any other bugs I find :)[/quote] Good. :3: [QUOTE=.\\Shadow};23904165] Web interface isn't updating.[/QUOTE] I don't think that's my fault, more info?
  • Avatar of [NNJG]Ben
  • [QUOTE=Lexic;23912665]Ok, I'll get that fixed. Yep. I didn't think people'd ban for less. I'll look into lowering or not actually doing the ban if it's for shorter. Good. :3: I don't think that's my fault, more info?[/QUOTE] What would be the reason of the web interface not loading? I think it would most likely be the game server having trouble connecting to the web server. The Webpage is connecting fine, If we ban someone from the webpage, they are banned from the server also, but why wouldn't it update?
  • Avatar of lexic
  • Try putting lua_log_sv 1 in your server.cfg and checking for Lua errors in garrysmod/lua_errors_server.txt after banning someone. Are they banned for the full amount of time, even though the ban doesn't show up?
  • Avatar of lexic
  • I did say using SourceMod and this at the same time was probably a bad idea.
  • Every single command in SourceBans.lua has been removed from Sourcemod before adding SourceBans.lua. The player is completely banned for the full amount of time if they are banned using the web interface or in-game, but if you ban in-game it does not list the ban on the website. That's the only problem, which I'm not sure how can be fixed. Could it just be a problem with my host (xenon servers), in some way?
  • Avatar of lexic
  • Humor me and try temporarily disabling SourceMod with the quick and reversible fix I put in the main post, then try banning someone. As my server's incredibly active ban page shows, it works fine from the Lua, and my last local test with the concommands worked fine, so it's got to be something on your end.
  • Avatar of Chief Tiger
  • I installed this and I'm getting this: 20:25:40 L 08/08/2010 - 20:25:23: [08/08/10 20:25:23][SourceBans.lua] Loading Admin Groups . . . 20:25:40 L 08/08/2010 - 20:25:23: Lua Error: lua\includes\modules\sourcebans.lua:291: attempt to index global 'activequeries' (a nil value) [editline]09:35PM[/editline] That last thing happened only if the db initializes mid-game I think, but this happened after a fresh restart (and only on my authing): 21:30:07 L 08/08/2010 - 21:29:49: "Stealth Merc<15><STEAM_0:1:11466439><>" connected, address "69.255.145.134:43620" 21:30:07 L 08/08/2010 - 21:29:50: "Stealth Merc<15><STEAM_0:1:11466439><>" STEAM USERID validated 21:30:11 L 08/08/2010 - 21:29:53: Lua Error: Hook 'SourceBans.lua - PlayerAuthed' Failed: lua\includes\modules\sourcebans.lua:118: invalid value (nil) at index 6 in table for 'concat' 21:30:11 L 08/08/2010 - 21:29:54: "'{CS} Chief Tiger<4><STEAM_0:1:22240086><>" entered the game 21:30:12 L 08/08/2010 - 21:29:55: "{/MBG\} Mitch710<9><STEAM_0:1:26505460><>" entered the game [editline]09:39PM[/editline] This happened shortly after banning myself for 1 minute: 21:34:39 L 08/08/2010 - 21:34:21: Lua Error: [08/08/10 21:34:21][SourceBans.lua] The server has lost connection to the database. Retrying... 21:34:39 L 08/08/2010 - 21:34:21: Lua Error: Timer Error: lua\includes\modules\sourcebans.lua:560: attempt to index local 'query' (a nil value)
  • Avatar of Chief Tiger
  • Yes. My webserver isn't updating with my bans. :v: [editline]10:23PM[/editline] I have Sourcemod disabled too, but I'm using this module with Evolve.