forward OnBanLoad(playerid);
public OnBanLoad(playerid)
{
new rows, fields, temp[120];
new
bReason,
bannedBy,
bName,
Dialog[403],
bIP,
bExpiration,
bID;
cache_get_data(rows, fields, mysql);
if(rows != 0)
{
cache_get_field_content(1, "Name", temp), bName = strval(temp);
cache_get_field_content(3, "Reason", temp), bReason = strval(temp);
cache_get_field_content(4, "BannedBy", temp), bannedBy = strval(temp);
cache_get_field_content(2, "IP", temp), bIP = strval(temp);
cache_get_field_content(0, "BanID", temp), bID = strval(temp);
cache_get_field_content(7, "Expiration", temp), bExpiration = strval(temp);
/*bName = cache_get_field_content_int(1, "Name");
bReason = cache_get_field_content_int(3, "Reason");
bannedBy = cache_get_field_content_int(4, "BannedBy");
bIP = cache_get_field_content_int(2, "IP");
bID = cache_get_field_content_int(0, "BanID");
bExpiration = cache_get_field_content_int(7, "Expiration");
#pragma unused temp*/
if(bExpiration > 0)
{
if(gettime() >= bExpiration)
{
new query[74];
mysql_format(mysql, query, sizeof(query), "UPDATE `bans` SET `Status`=0 WHERE `BanID` = '%d'", bID);
mysql_tquery(mysql, query, "", "");
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}You will be unbanned in %d day(s)!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", bName, bIP, bReason, bannedBy, (bExpiration-gettime()+86400)/86400);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
SetTimerEx( "KickPlayer",100, false, "i", playerid);
}
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}You are banned forever!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", bName, bIP, bReason, bannedBy);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
SetTimerEx( "KickPlayer",100, false, "i", playerid);
}
}
return 1;
}
[22:48:02] [DEBUG] mysql_tquery - scheduling query "SELECT * FROM `bans` WHERE (`Name` = 'LoLiTsTols' OR `IP` = '') AND `Status` = '1'"..
[22:48:02] [DEBUG] CMySQLQuery::Execute[OnBanLoad(i)] - starting query execution
[22:48:02] [DEBUG] CMySQLQuery::Execute[OnBanLoad(i)] - query was successful
[22:48:02] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[22:48:02] [DEBUG] CMySQLQuery::Execute[OnBanLoad(i)] - data being passed to ProcessCallbacks()
[22:48:02] [DEBUG] Calling callback "OnBanLoad"..
[22:48:02] [DEBUG] cache_get_data - connection: 1
[22:48:02] [DEBUG] cache_get_field_content - row: 1, field_name: "Name", connection: 1, max_len: 120
[22:48:02] [DEBUG] CMySQLResult::GetRowDataByName - row: '1', field: "Name", data: "LoLiTsTols"
[22:48:02] [DEBUG] cache_get_field_content - row: 3, field_name: "Reason", connection: 1, max_len: 120
[22:48:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('3')
[22:48:02] [DEBUG] cache_get_field_content - row: 4, field_name: "BannedBy", connection: 1, max_len: 120
[22:48:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('4')
[22:48:02] [DEBUG] cache_get_field_content - row: 2, field_name: "IP", connection: 1, max_len: 120
[22:48:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('2')
[22:48:02] [DEBUG] cache_get_field_content - row: 0, field_name: "BanID", connection: 1, max_len: 120
[22:48:02] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "BanID", data: "151"
[22:48:02] [DEBUG] cache_get_field_content - row: 7, field_name: "Expiration", connection: 1, max_len: 120
[22:48:02] [ERROR] CMySQLResult::GetRowDataByName() - invalid row index ('7')
[22:48:02] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[22:48:02] [DEBUG] CMySQLQuery::~CMySQLQuery() - deconstructor called
|
First of all, show us what have you tried to fix this issue. Then on fail you should post a thread.
I have tried with R33, but as I am using R6 it get's kinda new for me to response. I will suggest you to check this link and start script from scratch. |
cache_get_field_content(0, "Name", temp), bName = strval(temp);
cache_get_field_content(0, "Reason", temp), bReason = strval(temp);
cache_get_field_content(0, "BannedBy", temp), bannedBy = strval(temp);
cache_get_field_content(0, "IP", temp), bIP = strval(temp);
cache_get_field_content(0, "BanID", temp), bID = strval(temp);
cache_get_field_content(0, "Expiration", temp), bExpiration = strval(temp);
/*bName = cache_get_field_content_int(0, "Name");
bReason = cache_get_field_content_int(0, "Reason");
bannedBy = cache_get_field_content_int(0, "BannedBy");
bIP = cache_get_field_content_int(0, "IP");
bID = cache_get_field_content_int(0, "BanID");
bExpiration = cache_get_field_content_int(0, "Expiration");
#pragma unused temp*/
if(CheckBan(playerid) == 0)
{
mysql_format(mysql, query, sizeof(query),"SELECT `password` FROM `"PlayerTable"` WHERE `user` = '%e' LIMIT 1", Name[playerid]);
mysql_tquery(mysql, query, "OnAccountCheck", "i", playerid);
}
stock CheckBan(playerid)
{
new
query[100];
mysql_format(mysql, query, sizeof(query), "SELECT * FROM `"BanTable"` WHERE (`Name` = '%e' OR `IP` = '%s') AND `Status` = '1'", Name[playerid]);
mysql_tquery(mysql, query, "OnBanLoad", "i", playerid);
return 1;
}
public OnBanLoad(playerid)
{
new rows, fields, temp[120];
new
bReason,
bannedBy,
bName,
Dialog[403],
bIP,
bExpiration,
bID;
cache_get_data(rows, fields, mysql);
if(rows != 0)
{
cache_get_field_content(0, "BanID", temp), bID = strval(temp);
cache_get_field_content(1, "Name", temp), bName = strval(temp);
cache_get_field_content(2, "IP", temp), bIP = strval(temp);
cache_get_field_content(3, "Reason", temp), bReason = strval(temp);
cache_get_field_content(4, "BannedBy", temp), bannedBy = strval(temp);
cache_get_field_content(7, "Expiration", temp), bExpiration = strval(temp);
if(bExpiration > 0)
{
if(gettime() >= bExpiration)
{
new query[74];
mysql_format(mysql, query, sizeof(query), "UPDATE `bans` SET `Status`=0 WHERE `BanID` = '%d'", bID);
mysql_tquery(mysql, query, "", "");
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}You will be unbanned in %d day(s)!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", bName, bIP, bReason, bannedBy, (bExpiration-gettime()+86400)/86400);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
SetTimerEx( "KickPlayer",100, false, "i", playerid);
}
}
else
{
format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! Ban details:\n\n{FF0000}Name:{FFFFFF} %s \n{FF0000}IP:{FFFFFF} %s\n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s\n\n{FF0000}You are banned forever!\n\n{FF0000}If you think this ban is unfair, you can apply for an unban appeal at our forums\n{FF0000}Note - We do not unban hackers, or people who lie in their appeal", bName, bIP, bReason, bannedBy);
ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned!", Dialog, "Close", "");
SetTimerEx( "KickPlayer",100, false, "i", playerid);
}
}
return 1;
}
|
cache_get_field_content("1",.... Change these numbers to "0". in all cache get codes.
|
cache_get_field_content(0, "BanID", temp), bID = strval(temp);
cache_get_field_content(0, "Name", temp), bName = strval(temp);
cache_get_field_content(0, "IP", temp), bIP = strval(temp);
cache_get_field_content(0, "Reason", temp), bReason = strval(temp);
cache_get_field_content(0, "BannedBy", temp), bannedBy = strval(temp);
cache_get_field_content(0, "Expiration", temp), bExpiration = strval(temp);
|
cache_get_field_content("1",.... Change these numbers to "0". in all cache get codes.
|