04.09.2018, 13:50
Sorry to say but this script is just full of bugs and mistakes.
This check in offline ban command:
Why? Why do you check if a name exists if im offline banning someone and not retrieving their ban info?
OnPlayerConnect check:
Must be:
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:
Mysql query for creating "bans" table:
70 chars, seriously?
Same here.
Must be at least 128.
If im not wrong, an IP is made by 24 chars, not 17.
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.");
}
OnPlayerConnect check:
pawn Код:
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `bans` WHERE (`Username`='%e')", ReturnPlayerName(playerid));
pawn Код:
mysql_format(g_SQL, query, sizeof(query), "SELECT * FROM `bans` WHERE `Username` = '%e'", ReturnPlayerName(playerid));
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;
}
pawn Код:
Username` VARCHAR(70)
pawn Код:
BannedBy` VARCHAR(70) NOT NULL,
pawn Код:
`BanReason` VARCHAR(70) NOT NULL
pawn Код:
`IpAddress` VARCHAR(17)
