04.03.2014, 12:58
You get the name before tusing TempBanCheck, right? It's the first time I've heard of that happens so I guess you'll have to do some debugging manually:
I remember only 1 way that format crashed and that was with send formatted message function (using emit).
And print the server log.
pawn Код:
stock TempBanCheck(playerid)
{
if(!test)
{
MySQLCheck();
return false;
}
new ip[15];
new str[128];
new tmp[256];
new query[512];
new ban_second, ban_minute, ban_hour, ban_day, ban_month, ban_year;
GetPlayerIp(playerid, ip, sizeof(ip));
print("DEBUG: TempBanCheck -> 1");
format(query,sizeof(query),"SELECT * FROM `"TEMPBANTABLENAME"` WHERE tempban_ip = '%s'",ip);
mysql_query(query,-1,playerid,connection);
mysql_store_result(connection);
new nrows = mysql_num_rows(connection);
if(nrows == 1)
{
mysql_fetch_field("tempban_second",tmp,connection);
ban_second = strval(tmp);
mysql_fetch_field("tempban_minute",tmp,connection);
ban_minute = strval(tmp);
mysql_fetch_field("tempban_hour",tmp,connection);
ban_hour = strval(tmp);
mysql_fetch_field("tempban_day",tmp,connection);
ban_day = strval(tmp);
mysql_fetch_field("tempban_month",tmp,connection);
ban_month = strval(tmp);
mysql_fetch_field("tempban_year",tmp,connection);
ban_year = strval(tmp);
mysql_free_result(connection);
}
else
{
mysql_free_result(connection);
printf("beore return false my name is %s", fName(playerid));
return false;
}
new year, month, day, hour, minute, second;
getdate(year, month, day);
gettime(hour, minute, second);
new bool:kban=false;
if(year >= ban_year && month > ban_month) kban = false;
else
{
if(ban_year > year) kban = true;
else if(ban_month > month && ban_year >= year) kban = true;
else if(ban_day > day && ban_month >= month && ban_year >= year) kban = true;
else if(ban_day == day && ban_month == month && ban_year == year)
{
if(ban_hour > hour) kban = true;
else
{
if(ban_minute >= minute && ban_second >= second) kban = true;
}
}
}
if(kban == true)
{
if(ban_minute<=9 && ban_minute>=0)
{
if(ban_second<=9 && ban_second>=0)
{
print("DEBUG: TempBanCheck -> 2");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
else
{
print("DEBUG: TempBanCheck -> 3");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:0%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
}
else
{
if(ban_second<=9 && ban_second>=0)
{
print("DEBUG: TempBanCheck -> 4");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:0%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
else
{
print("DEBUG: TempBanCheck -> 5");
format(str, sizeof str, "|- You are temporarily banned from this server until: %d/%d/%d - %d:%d:%d -|", ban_day, ban_month, ban_year, ban_hour, ban_minute, ban_second);
}
}
SendClientMessage(playerid, RED, str);
return true;
}
else
{
print("DEBUG: TempBanCheck -> 6");
format(query,sizeof(query),"DELETE FROM `"TEMPBANTABLENAME"` WHERE `tempban_ip` = '%s'", ip);
mysql_query(query,-1,playerid,connection);
}
return false;
}
And print the server log.