• Ban List
    19 replies, posted
Hello, So I wanted to install something like [URL="http://gmodtech.net/sourcebans/index.php?p=banlist&page=1"]this[/URL] where it shows who is banned and for how long. It says that it is powered by SourceMod but I don't really want to implement it on my server as it's kinda sucky so I just wanted to know are there any alternatives and if not how would I go about installing SourceMod on my server? Thanks, Owen. :)
SourceMod and SourceBans has been around for years (surprised it's still going). SourceMod can be installed using this guide: [url]https://wiki.alliedmods.net/Installing_SourceMod[/url] It might seem daunting to begin with but SourceMod was the go-to admin plugin for any Source multiplayer server. The only thing is it won't do Garry's Mod admin so you'll still have to put people in as admins on your server like normal.
'you'll still have to put people in as admins' SourceMod has its own ranking system? I literally only want it for the ban page section - I couldn't care less about using it as an admin tool.
Which admin mod do you use right now? It sounds like SourceBans is going to be overkill for you. SourceBans is designed for handling bans across a whole community of servers. Ban someone on one server, it's replicated to all the others (even across different games).
I honestly just use Gravious's built in one on his gamemode. It writes bans directly to the database on the server, or webserver if MySQL.
I just downloaded his release pack. Looks like his database is MySQL or SQLite, both of which are incredibly common and easy to retrieve from. If you know you haven't set up MySQL and configured connection details, it's probably using Gmod's internal database which is sv.db in the garrysmod folder I believe. Where's your gameserver hosted?
Yeah, I was using MySQL but for some reason the database wouldn't connect (I had the same error, fixed it but forgot the fix xD) so I just use sv.db. My gameserver is hosted in the UK and my server host Nitrous Networks.
If you're just renting a gameserver instance, you'll need to find a way to grab a copy of your database and connect to it. If it was me, I'd pull it down to a webserver every few minutes, parse all the ban rows into a cache and display the ban data from there. If you're renting a dedicated server, you could supply the ban data from sv.db to a web page.
I'm just renting one, dedicated servers cost too much. :3 [editline]11th October 2016[/editline] How could I 'parse all the ban rows into a cache and display the ban data'?
Depends what your programming skills are like! How do you access the files on your gameserver to upload stuff? I presume you have SFTP or something? [editline]11th October 2016[/editline] Also what will you be using to host your bans page?
I use FTP yeah, and my programming skills are 'reasonable' at best. xD Well I was just going to use that SourceMod wasn't I? But it appears I'd just use my webhost. - For displaying the ban rows directly.
OK, does your webhost support cron jobs? Look in your admin panel. If not, you'll probably need to pull down the sv.db file as part of your web page request then cache the data you use. PHP can make FTP connections and it's a really easy language to use (though by no means the only nor the best). Look at ftp_connect() and the PDO library. All the above is quite easy to do, you'll just need to google some of the terms used. If you're serious about running a gameserver, all the skills you'll use above will put you in good stead for all kinds of server automation going forward.
PHP is god awful, I do know quite a bit of HTML however. Fortunately my webhost DOES support Cron jobs but I am not by any means familiar with using it.
PHP is as good as you make it. The frameworks like Laravel make it usable in my opinion. It really doesn't matter what you use to render your page though. Look up Cron jobs, it'll make your ban page a lot more efficient as you can download the DB with a script without pulling it down on every request. Take some time to understand the technologies being suggested, trust me it will pay off!
Alright, I'll try - possible fail and give up - but I'll try. ;)
Come back if you get stuck :)
Use the module by Lexi tbh, [url]http://lexi.org.uk/[/url] If you only want sourcebans and not all the other stuff that comes with sourcemod then just use Lexi's module. Much simpler to edit and less resource/stability issues than using a clunky mod like sourcemod.
Honestly a demo would be nice. Nevertheless thanks for the contribution. :)
Or use a normal globalban module, where TCB made a theme about it, its easy and small.
I just thought I'd post a little bit of code which will help display the data from the database. [CODE]<?php mysql_connect('host', 'user', 'pass'); -- Input IP in host, user name in user and password in pass. mysql_select_db('database'); -- Input databse. $sql="SELECT * FROM gmod_bans"; -- Edit 'gmod_bans' to the table in your database. $records=mysql_query($sql); ?> <html> <head> <title>Ban list</title> </head> <body> <table width="600" border="1" cellpadding="1" cellspacing="1"> <tr> <th>ID</th> <th>Name</th> <th>Length</th> <th>Reason</th> <tr> <?php while($bans=mysql_fetch_assoc($records)) { echo "<tr>"; echo "<td>".$bans['id']."</td>"; -- Edit 'id' with the column you want displayed echo "<td>".$bans['name']."</td>"; -- Edit 'name' with the column you want displayed echo "<td>".$bans['length']."</td>"; -- Edit 'length' with the column you want displayed echo "<td>".$bans['reason']."</td>"; -- Edit 'reason' with the column you want displayed echo "</tr>"; } ?> </table> </body> </html>[/CODE] Be careful with the database information. Make sure the user you have assigned to the database can ONLY VIEW the data and not edit it in any way otherwise trouble may arise. You also probably want to remove the comments as they may interfere. No, not the most cleanest code but it should still work. Feel free to make changes to this contribution. :)
Sorry, you need to Log In to post a reply to this thread.