[MySQL] Ban / Unban System

Scripter or interested in scripting? This place just may fancy to your likings!

Moderators: Game Admins, FM, Lead Admins

Post Reply
User avatar
.clay
Wannabe Mafia
Wannabe Mafia
Posts: 156
Joined: Fri Jun 24, 2016 7:11 pm
Ingame name: Bekim Lekaj
Contact:

[MySQL] Ban / Unban System

Post by .clay » Wed Jan 02, 2019 10:11 pm

Hello, I have went through my files and my work, and I saw this system I made a while ago, not sure when. It's a ban system using the latest MySQL version (R41-4), and it is pretty useful. I have decided to release this as some people may find it useful for their servers, and wanted to make my first release here on the forums. I saw that this forum has been pretty inactive, and I wanted to post something for others to use.

The requirements to compile this filterscript are:

sscanf2 by Y_Less
a_mysql by BlueG / maddinat0r
zcmd by Zeex
easyDialog by Emmet_

The commands can only be used by RCON Admins, and here are all the commands:

/ban [playerid / part of name] [reason]- BAN a player with a specific reason.
/unban [name] - UNBAN a player.
/baninfo [name] - Check ban information on someone if they are banned.
/oban [name] [reason] - Offline BAN a player.

Screenshots:
https://imgur.com/a/MmX7LiC

Information:

This filterscript will check if a player is banned as soon as they connect, if they are then it will kick them, if not it will spawn them.

Download:
Pastebin
GitHub

There is no known bugs as far as I know and it is tested, if you have issues you can post here and let me know, enjoy.

User avatar
Brasi
Gold Member
Gold Member
Posts: 544
Joined: Thu Nov 12, 2015 1:28 am

Re: [MySQL] Ban / Unban System

Post by Brasi » Wed Jan 02, 2019 10:43 pm

It isn't bad, however there is a few things I would do to touch it up and make it less lines/and more efficient.


You're storing the IP address when banning the player, however you're not putting it to use. The code below, you should include Username OR IpAddress, otherwise there is no point of collecting and storing that info (The IP Address). What I would recommend as well is if the IpAddress is banned and the username isn't, link it to the other banned user and re-ban the new one.
mysql_format(Database, query, sizeof(query), "SELECT * FROM `bans` WHERE `Username` = '%e';", GetName(playerid));

User avatar
.Bauer.
Gold Donator
Gold Donator
Posts: 243
Joined: Sun May 08, 2016 6:11 pm
Ingame name: Luke Watts
Location: My basement

Re: [MySQL] Ban / Unban System

Post by .Bauer. » Thu Jan 03, 2019 1:04 am

Very nice. It will come in handy for some.
Need to contact me?
Discord: Bauer#1300
Forum: .Bauer.

My PMs are always open!

User avatar
.clay
Wannabe Mafia
Wannabe Mafia
Posts: 156
Joined: Fri Jun 24, 2016 7:11 pm
Ingame name: Bekim Lekaj
Contact:

Re: [MySQL] Ban / Unban System

Post by .clay » Thu Jan 03, 2019 9:00 pm

Brasi wrote:
Wed Jan 02, 2019 10:43 pm
It isn't bad, however there is a few things I would do to touch it up and make it less lines/and more efficient.


You're storing the IP address when banning the player, however you're not putting it to use. The code below, you should include Username OR IpAddress, otherwise there is no point of collecting and storing that info (The IP Address). What I would recommend as well is if the IpAddress is banned and the username isn't, link it to the other banned user and re-ban the new one.
mysql_format(Database, query, sizeof(query), "SELECT * FROM `bans` WHERE `Username` = '%e';", GetName(playerid));
Yeah, I might update this when I get free time, thanks anyways.

.Bauer. wrote:
Thu Jan 03, 2019 1:04 am
Very nice. It will come in handy for some.
Thanks.

Post Reply

Return to “Scripting Section”

Who is online

Users browsing this forum: No registered users