looping through all of the all the users to check if there in a certain group.
#1

.....
Reply
#2

You should have a look at y_groups and foreach.
example.
pawn Код:
//create the group
new RegisteredPlayers  = Group_Create("registeredplayers");

COMMAND:register(playerid, params[])
{
    //blahbloodyblah
   
    //set the player to the group
    Group_SetPlayer( RegisteredPlayers, playerid, true );
    return 1;
}

//then where you need the loop
foreach( Group( RegisteredPlayers ), i )
{
    //will only loop through players in the
    //"registered players" group
}
Reply
#3

Shit, i just answered the title, didn't realise he wanted to loop through offline players. I must read more carefully.
Reply
#4

.....
Reply
#5

The fact that you are calling possibly hundreds if not thousands of queries in a few nanoseconds is quite a problem, I think you need to re-think how your system is structured. Why is there even a limit to how many people can register on your server? It's not good coding practice at all to call thousands of SQL queries in a few milliseconds, SQL is designed in a way that you should be able to call one query and get all of your information from that single query, which is far more efficient.

I've made this point time and time again, look here for an example of how you can easily get information from every single row in a table with a single query, instead of having 500 queries:

http://forum.sa-mp.com/showpost.php?...85&postcount=2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)