An mysql query every 1 sec per all_players?
#1

Ok my question is: If i make a mysql query that check in database which player has 'ToBeKicked = 1' every 1 second, does that function would make lag on server?
Reply
#2

Calling a query for every player every second will obviously cause problems. Instead of fetching that type of data from a database, you can directly act on such changes through the Socket plugin(here). The thread contains usage/documentation.
Reply
#3

Yes. It will. It'll also cause other queries you do to get bottlenecked and could take a while for that query to be processed if there's a constant queue.

Why do you need that in the database? Can't you use a variable for it?
Reply
#4

When do you insert that value in the database?
When the player is online or offline?

In case he's online, just kick him immediately instead of saving a 1 in the database and query it every second.

In case he's offline and should be kicked upon connecting, you can simply read the value during OnPlayerConnect and if it's a 1, kick him.

There is no need to run such a query every second per player.
Reply
#5

Why do you even want to use MySQL? Why not simply keep an array, ToBeKicked[MAX_PLAYERS]?

Maybe you want to kick from your control panel? If that is the case, use the Sockets plugin. If you are new to sockets, use SAMP's query mechanism to send RCON commands.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)