29.03.2012, 18:51
hello.
this code check if player has ban:
(onplayerconnect)
but is happen very slowly (the server pause [freeze] in "Join to server" message)
what is the problem with the code ?
thank's a lot
this code check if player has ban:
(onplayerconnect)
pawn Код:
format(String,256,"SELECT * FROM `Bans` WHERE `Username`='%s' OR `IP`='%s'",GetName(playerid),GetIP(playerid));
mysql_query(String);
mysql_store_result();
if(mysql_num_rows())
{
new baninfo[8][35];
while(mysql_retrieve_row())
{
mysql_fetch_field_row(baninfo[0],"Username");
mysql_fetch_field_row(baninfo[1],"Adminname");
mysql_fetch_field_row(baninfo[2],"Reason");
mysql_fetch_field_row(baninfo[3],"Date");
mysql_fetch_field_row(baninfo[4],"Time");
mysql_fetch_field_row(baninfo[5],"IP");
mysql_fetch_field_row(baninfo[6],"Type");
mysql_fetch_field_row(baninfo[7],"Days");
}
if(strval(baninfo[6]) == 1 && strval(baninfo[7]) < 1)
{
format(String,128,"DELETE FROM `Bans` WHERE `Username`='%s' OR `IP`='%s'",GetName(playerid),GetIP(playerid));
mysql_query(String);
SendClientMessage(playerid,c_red,".дбап щмк йшг, лрс озгщ");
}
else
{
SendClientMessage(playerid,c_red,"You are banned from this server.");
format(String,256,"Ban Info: (Admin: %s | User: %s) (IP: %s)",baninfo[1],baninfo[0],baninfo[5]);
SendClientMessage(playerid,c_lightblue,String);
format(String,256,"Ban Info: (Reason: %s | Ban type: %s)",baninfo[2],(strval(baninfo[6])==0)?("Permanent"):("Temporary"));
SendClientMessage(playerid,c_lightblue,String);
format(String,256,"Ban Info: (Date: %s | At: %s) (End ban: %s%s)",baninfo[3],baninfo[4],(strval(baninfo[6])==0)?("Never"):(GetNum(strval(baninfo[7]))),(strval(baninfo[6])==0)?(""):(" days"));
SendClientMessage(playerid,c_lightblue,String);
SendClientMessage(playerid,c_green,"ан дйрк зещб щбап жд айре оецгч, аъд оежоп мтштш тмйе");
SendClientMessage(playerid,c_green,"suport.GTAZONE.co.il -бфешен дъойлд щм дчдймд щмре, блъебъ");
}
return Kick(playerid);
}
mysql_free_result();
what is the problem with the code ?
thank's a lot