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.