SQLite Ban System Crash.
#1

Hello I have a little problem.
If you ban a player and he wants to come back to see how long he stayed.
Yes crash the server and closes.

OnPlayerConnect
Код:
	new DBResult:answer, var[32], unbandate, bool:ban, ip[32],str[1024],sendername[32];
	GetPlayerName(playerid, sendername, 32);
	GetPlayerIp(playerid, ip, 32);
	format(str, sizeof(str), "SELECT * FROM `Bans` WHERE `Name` = '%s'", sendername);
	answer = db_query(Database, str);
	if(db_num_rows(answer))
	{
		db_get_field(answer, 4, var, 32);
		unbandate = strval(var);
		if(unbandate - gettime() > 0) ban = true;
	}
	if(!ban)
	{
		format(str, sizeof(str), "SELECT * FROM `Bans` WHERE `Ip` = '%s'", ip);
		answer = db_query(Database, str);
		if(db_num_rows(answer))
		{
			db_get_field(answer, 4, var, 32);
			unbandate = strval(var);
			if(unbandate - gettime() > 0) ban = true;
		}
	}
	if(ban)
	{
  		convert((unbandate-gettime())*1000,UBMin,UBSec,UBMSec);
 		UBHour = UBMin/60;
  		UBMin = UBMin%60;
  		UBDay = UBHour/24;
  		UBHour = UBHour%24;
  		format(str, sizeof(str), "{FF0000}Your account has been blocked! {FFFF00}Unban remained until {FFFFFF}%d Day %d Hours %d Mins {FFFF00}y {FFFFFF}%d Seconds", UBDay, UBHour, UBMin, UBSec);
  		SendClientMessage(playerid, 0xFF0000FF, str);
 		Kick(playerid);
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)