27.09.2011, 20:02
is there a other (shorter) way to do this because it takes long time to load this onplayerconnect
pawn Код:
//OnPlayerConnect
if(isPlayerRangeBanned(playerid))
{
if(!isPlayerWhiteListed(playerid))
{
new string[59];
Format(string, "SELECT * FROM `blacklist` WHERE `IP` = '%s'", splitip(PlayerIP(playerid)));
mysql_query(string, THREAD_RANGEBANNED, playerid);
SetPVarInt(playerid, "AlreadyBanned", 1);
}
else
{
new string[80];
Format(string, "SELECT `pName` FROM `accs` WHERE `pName` = '%s'", PlayerName(playerid));
mysql_query(string, THREAD_LOGINREGISTER, playerid);
}
}
if(isPlayerTempBanned(playerid))
{
if(!isPlayerWhiteListed(playerid))
{
new string[72];
Format(string, "SELECT * FROM `bans` WHERE `ipAddress` = '%s' AND `banTime` > '1'", PlayerIP(playerid));
mysql_query(string, THREAD_TEMPBANNED1, playerid);
SetPVarInt(playerid, "AlreadyBanned", 1);
}
else
{
new string[80];
Format(string, "SELECT `pName` FROM `accs` WHERE `pName` = '%s'", PlayerName(playerid));
mysql_query(string, THREAD_LOGINREGISTER, playerid);
}
}
if(isPlayerBanned(playerid))
{
if(!isPlayerWhiteListed(playerid))
{
new string[86];
Format(string, "SELECT * FROM `bans` WHERE `ipAddress` = '%s' AND `banTime` = '0'", PlayerIP(playerid));
mysql_query(string, THREAD_WHITELISTED, playerid);
SetPVarInt(playerid, "AlreadyBanned", 1);
}
else
{
new string[80];
Format(string, "SELECT `pName` FROM `accs` WHERE `pName` = '%s'", PlayerName(playerid));
mysql_query(string, THREAD_LOGINREGISTER, playerid);
}
}
if(!isPlayerRangeBanned(playerid) && !isPlayerTempBanned(playerid) && !isPlayerBanned(playerid))
{
new string[80];
if(isPlayerWhiteListed(playerid))
{
Format(string, "SELECT `pName` FROM `accs` WHERE `pName` = '%s'", PlayerName(playerid));
}
else
{
Format(string, "SELECT `pName` FROM `accs` WHERE `pName` = '%s'", PlayerName(playerid));
}
mysql_query(string, THREAD_LOGINREGISTER, playerid);
}