other way?
#1

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);
    }
Reply
#2

I see no other way ... You gotta check that when player connects, right ? My knowleadge leads me to belive that you can't do it other way.
Reply
#3

Quote:
Originally Posted by Berlovan
Посмотреть сообщение
I see no other way ... You gotta check that when player connects, right ? My knowleadge leads me to belive that you can't do it other way.
yes, um, i mean i gonna use it onplayerconnect. but is there a faster way to do the mysql thing, without checking isplayerbanned > isplayerwhitelisted
istempbanned > iswhitelisted ect..
like a faster and shorter way to do the mysql part, my internet frient did it on a shorter way, but hes never on
Reply
#4

Um .... JunkBuster ?
Reply
#5

Quote:
Originally Posted by Berlovan
Посмотреть сообщение
Um .... JunkBuster ?
no, i want my own mysql whitelist/blacklist

there must be a way to make the code better
Reply
#6

Mi apologizes. I can't help '-'. MySQL is not my area of expertisse ...
Reply
#7

And unless you need specific sized char arrays why don't you
declare one string[80] at the start instead of 1 in each conditional
branch?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)