Question for mysql - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Question for mysql (
/showthread.php?tid=546016)
Question for mysql -
Dusan01 - 12.11.2014
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.
Re: Question for mysql -
Sparke - 12.11.2014
I don't think so
Re: Question for mysql -
Dignity - 12.11.2014
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;
}
Re: Question for mysql -
Sparke - 12.11.2014
----
Re: Question for mysql -
Dusan01 - 12.11.2014
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
Re: Question for mysql -
Dignity - 12.11.2014
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.
Re: Question for mysql -
Dusan01 - 12.11.2014
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