16.01.2016, 12:57
Hello,
I've recently finished making a command which checks the ban information for the player name provided. When I input a name which was not found in the ban database, it works fine, it outputs the "Ban not found within the database" error. However, when I do input the name of a banned player, it just outputs the "Unknown Command" error.
I've checked the MySQL error log, and the ban seems to come up fine.
I've recently finished making a command which checks the ban information for the player name provided. When I input a name which was not found in the ban database, it works fine, it outputs the "Ban not found within the database" error. However, when I do input the name of a banned player, it just outputs the "Unknown Command" error.
Код:
CMD:baninfo(playerid, params[])
{
new name;
if( sscanf( params, "s", name ) )
return SendUsageError( playerid, "/baninfo [Name]");
new query[128];
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `"BanTable"` WHERE `Name` = '%s'", name);
mysql_tquery(mysql, query, "BanInfo", "i", playerid);
return 1;
}
forward BanInfo(playerid);
public BanInfo(playerid)
{
new rows, fields, reason[128], bannedby[128], date[50], ip[30], str[128], name[24];
cache_get_data(rows, fields, mysql);
if(rows)
{
cache_get_field_content(0, "Reason", reason, mysql, 128);
cache_get_field_content(0, "BannedBy", bannedby, mysql, 128);
cache_get_field_content(0, "Date", date, mysql, 50);
cache_get_field_content(0, "IP", ip, mysql, 30);
format(str, sizeof(str), "[BANINFO] {FFFFFF}%s was banned by %s on %s. IP: %s", name, bannedby, date, ip);
SendClientMessage(playerid, RED, str);
return 1;
}
else Error(playerid, "Ban was not found in the database");
return 1;
}
Код:
[13:53:02] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM `bans` WHERE `Name` = 'itsDanny'", callback: "BanInfo", format: "i" [13:53:02] [DEBUG] CMySQLQuery::Execute[BanInfo] - starting query execution [13:53:02] [DEBUG] CMySQLQuery::Execute[BanInfo] - query was successfully executed within 4.324 milliseconds [13:53:02] [DEBUG] CMySQLResult::CMySQLResult() - constructor called [13:53:02] [DEBUG] Calling callback "BanInfo".. [13:53:02] [DEBUG] cache_get_data - connection: 1 [13:53:02] [DEBUG] cache_get_field_content - row: 0, field_name: "Reason", connection: 1, max_len: 128 [13:53:02] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Reason", data: "test" [13:53:02] [DEBUG] cache_get_field_content - row: 0, field_name: "BannedBy", connection: 1, max_len: 128 [13:53:02] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "BannedBy", data: "itsDanny" [13:53:02] [DEBUG] cache_get_field_content - row: 0, field_name: "Date", connection: 1, max_len: 50 [13:53:02] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "Date", data: "2015-11-29 16:03:08" [13:53:02] [DEBUG] cache_get_field_content - row: 0, field_name: "IP", connection: 1, max_len: 30 [13:53:02] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "IP", data: "127.0.0.1" [13:53:02] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called


