[MYSQL R41-4] Ban / Unban System -
solstice_ - 03.09.2018
Note
I would recommend to add the systems from this filterscript into your gamemode since it doesn't save accounts or load anything, only has commands & callbacks and fuctions.
Introduction
Ban / Unban system with the latest MySQL version.
Screenshots
I took 2 screenshots in-game, when the player uses /ban, /unban and when the player connects the dialog pops up telling him the ban information.
Commands
/ban - RCON Admins
/unban - RCON Admins
/baninfo - RCON Admins
/oban - RCON Admins
Version
This is the first version which is 0.1, i'll keep updating the filterscript by adding /oban(Already added), /tempban and /baninfo(Already added) (for admins only)
Bugs
Well, there was no bugs while i was testing this. I tested this in localhost with sandbox, so if you find any bug please let me know by PMs or by posting here, doesn't matter.
Credits
SA:MP Team for a_samp
maddinat0r - BlueG for a_mysql
Zeex - zcmd
Y_Less - sscanf2
Emmet - easyDialog
Download
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 03.09.2018
Updated - added /baninfo command (admins will be able to check ban information if the player is banned)
Screenshot:
Re: [MYSQL R41-2] Ban / Unban System -
ZJK - 03.09.2018
Nice bro, would be also nice if you add commands like:
- /owarn (warn an offline player)
- /checkwarns (will check the amount of warns of an offline or online player)
- /removewarn (will remove a warn id of X player)
A suggestion:
- Be able to also unban a player by typing the ban ID
Re: [MYSQL R41-2] Ban / Unban System -
ZigGamerx - 03.09.2018
Really Nice. BRO
but I was looking for R41-4
Re: [MYSQL R41-2] Ban / Unban System -
OPcode - 03.09.2018
Great job!
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 03.09.2018
Quote:
Originally Posted by ZigGamerx
Really Nice. BRO but I was looking for R41-4
|
Oh wow lol! Didn't even notice R41-4 was released.. Will update it as soon as i get home
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 03.09.2018
Quote:
Originally Posted by ZJK
Nice bro, would be also nice if you add commands like:
- /owarn (warn an offline player)
- /checkwarns (will check the amount of warns of an offline or online player)
- /removewarn (will remove a warn id of X player)
A suggestion:
- Be able to also unban a player by typing the ban ID
|
Will create a new filterscript for the warn system, this is a ban system.
Quote:
Originally Posted by ZigGamerx
Really Nice. BRO but I was looking for R41-4
|
You can now use this on R41-4.
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 04.09.2018
- Updated to V0.2, added /oban. I can't really post screenshots now as i'm not on my PC but will post a screenshot later.
Re: [MYSQL R41-2] Ban / Unban System -
KinderClans - 04.09.2018
You should include the CREATE database if not exists query. Btw good job.
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 04.09.2018
Quote:
Originally Posted by KinderClans
You should include the CREATE database if not exists query. Btw good job.
|
Ah yes, updated. Forgot about that.
Re: [MYSQL R41-2] Ban / Unban System -
KinderClans - 04.09.2018
#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 04.09.2018
Quote:
Originally Posted by KinderClans
#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
|
Does it show you that error? Because it compiles fine for me...
EDIT: Try now, i've tried changing something but even before it was compiling fine.
Re: [MYSQL R41-2] Ban / Unban System -
Banditul18 - 04.09.2018
Quote:
Originally Posted by willbedie
Does it show you that error? Because it compiles fine for me...
EDIT: Try now, i've tried changing something but even before it was compiling fine.
|
He means the table creation query. If you make a column auto_increment you must defined it as PRIMARY KEY or to add an index to it(in this case PRIMARY KEY will be perfect)
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 04.09.2018
Quote:
Originally Posted by Banditul18
He means the table creation query. If you make a column auto_increment you must defined it as PRIMARY KEY or to add an index to it(in this case PRIMARY KEY will be perfect)
|
Now i get it, updated once again.
Re: [MYSQL R41-2] Ban / Unban System -
KinderClans - 04.09.2018
Sorry to say but this script is just full of bugs and mistakes.
This check in offline ban command:
pawn Код:
if(!rows)
{
SCM(playerid, COLOR_RED, "* That name does not exist or there is no ban under that name.");
}
Why? Why do you check if a name exists if im offline banning someone and not retrieving their ban info?
OnPlayerConnect check:
pawn Код:
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `bans` WHERE (`Username`='%e')", ReturnPlayerName(playerid));
Must be:
pawn Код:
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `bans` WHERE `Username` = '%e'", ReturnPlayerName(playerid));
The "else" in CheckPlayer is useless. As you said this is not an user system, so why i should place my login code there?
I tried placing in that else and bugged everything. So remove it and remain just:
pawn Код:
CheckPlayer(playerid)
{
if(cache_num_rows() != 0)
{
new Username[24], BannedBy[24], BanReason[70];
cache_get_value_name(0, "Username", Username);
cache_get_value_name(0, "BannedBy", BannedBy);
cache_get_value_name(0, "BanReason", BanReason);
SendClientMessage(playerid, COLOR_RED, "* You are banned from this server.");
new string[500];
format(string, sizeof(string), "{FFFFFF}You are banned from this server\n{D93D3D}Username: {FFFFFF}%s\n{D93D3D}Banned by: {FFFFFF}%s\n{D93D3D}Ban Reason: {FFFFFF}%s", Username, BannedBy, BanReason);
ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Ban Info", string, "Close", "");
DelayedKick(playerid);
}
return 1;
}
Mysql query for creating "bans" table:
70 chars, seriously?
pawn Код:
BannedBy` VARCHAR(70) NOT NULL,
Same here.
pawn Код:
`BanReason` VARCHAR(70) NOT NULL
Must be at least 128.
If im not wrong, an IP is made by 24 chars, not 17.
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 04.09.2018
Quote:
Originally Posted by KinderClans
Sorry to say but this script is just full of bugs and mistakes.
|
Quote:
OnPlayerConnect check:
pawn Код:
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `bans` WHERE (`Username`='%e')", ReturnPlayerName(playerid));
Must be:
pawn Код:
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `bans` WHERE `Username` = '%e'", ReturnPlayerName(playerid));
|
Updated
Quote:
The "else" in CheckPlayer is useless. As you said this is not an user system, so why i should place my login code there?
I tried placing in that else and bugged everything. So remove it and remain just:
pawn Код:
CheckPlayer(playerid) { if(cache_num_rows() != 0) { new Username[24], BannedBy[24], BanReason[70]; cache_get_value_name(0, "Username", Username); cache_get_value_name(0, "BannedBy", BannedBy); cache_get_value_name(0, "BanReason", BanReason);
SendClientMessage(playerid, COLOR_RED, "* You are banned from this server."); new string[500]; format(string, sizeof(string), "{FFFFFF}You are banned from this server\n{D93D3D}Username: {FFFFFF}%s\n{D93D3D}Banned by: {FFFFFF}%s\n{D93D3D}Ban Reason: {FFFFFF}%s", Username, BannedBy, BanReason); ShowPlayerDialog(playerid, DIALOG_UNUSED, DIALOG_STYLE_MSGBOX, "Ban Info", string, "Close", ""); DelayedKick(playerid); } return 1; }
|
That worked for me tho on my gamemode...
Quote:
Mysql query for creating "bans" table:
70 chars, seriously? It should be like 24 or something but that can't be called a bug, i've changed it.
pawn Код:
BannedBy` VARCHAR(70) NOT NULL,
Same here. // changed
pawn Код:
`BanReason` VARCHAR(70) NOT NULL
Must be at least 128.
If im not wrong, an IP is made by 24 chars, not 17.
|
Код:
If im not wrong, an IP is made by 24 chars, not 17.
Afaik, an IP is made by 16 or 17 characters.
Re: [MYSQL R41-2] Ban / Unban System -
KinderClans - 04.09.2018
That's why i said "if im not wrong".
Re: [MYSQL R41-2] Ban / Unban System -
solstice_ - 04.09.2018
Quote:
Originally Posted by KinderClans
That's why i said "if im not wrong".
|
I've fixed everything but i don't think anything is wrong with CheckPlayer since it worked for me, if someone else tries this please let me know if CheckPlayer works for you because it worked for me on my own gamemode.
Re: [MYSQL R41-2] Ban / Unban System -
SonnyGamer - 04.09.2018
I suggest you to create mysql admin system. Use this system and add some other admin commands: warn, kick, jail, freeze etc...
Good Job anyway
Re: [MYSQL R41-2] Ban / Unban System -
brauf - 04.09.2018
Quote:
Originally Posted by KinderClans
That's why i said "if im not wrong".
|
and that's why he corrected you.