Question for mysql
#1

can this code lag server because he is starting every 1 second in timer?:

pawn Код:
new Result:total3 = sql_query(mysql, "SELECT * FROM `Players` WHERE `Online`='1'");
sql_store_result(total3);
new ttotal3 = sql_num_rows(total3);
sql_free_result(total3);
that code is used to count for online players.
Reply
#2

I don't think so
Reply
#3

Quote:
Originally Posted by Sparke
Посмотреть сообщение
I don't think so
lol

@OP: Why don't you loop through all the current players? Like this:

pawn Код:
GetOnlinePlayers()
{
    new count;

    for(new i; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            count ++;
        }
    }

    return count;
}
Reply
#4

----
Reply
#5

Quote:
Originally Posted by Mionee
Посмотреть сообщение
lol

@OP: Why don't you loop through all the current players? Like this:

pawn Код:
GetOnlinePlayers()
{
    new count;

    for(new i; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i))
        {
            count ++;
        }
    }

    return count;
}
I know that, but i just wanna to know can server lag if he every 1 sec check for number of rows via sql plugin
Reply
#6

Depends on your amount of rows/tables. It'll take a lot of them to make your server lag, but there's no point in doing that.
Reply
#7

Quote:
Originally Posted by Mionee
Посмотреть сообщение
Depends on your amount of rows/tables. It'll take a lot of them to make your server lag, but there's no point in doing that.
Ok, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)