Counting registered players.
#1

I want to count all the registered users and display them in a dialog.
Can you tell me how to count all user files or registered users?
Reply
#2

Well, you could make a system that counts when a player registers. So instead of counting files (no idea how to do that, as far as I know that's not possible) you could update a variable in a file when a player registers. Know what I mean?
Reply
#3

I made a variable, and incremented it when the player registers but when i restart my server it lost its value.. :S
EDIT: What do you mean by update a variable in a file?
Reply
#4

Well, if you are using Dini or Djson or userfiles like that; you don't have to make an userfile persй. For example, if your variable is RegisteredPlayers;

pawn Код:
OnPlayerRegister() //Off course, when a player is registered. Doesn't actually exist (standard)
{
    new str[45];
    RegisteredPlayers++;
    djSetInt("ServerFile.ini", RegisteredPlayers, RegisteredPlayers); //or dini_IntSet etc.
    format(str, 45, "There are now %d registered users!", RegisteredPlayers);
    SendClientMessageToAll(0xFFFFFFAA, str);
}
Something like that. Just save that variable into a file. And off course, load it when the server is loading
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)