getting total # of acc registered -
AroseKhanNiazi - 20.06.2014
how can i get the total number of accounts registered i am using y_ini
Re: getting total # of acc registered -
Threshold - 20.06.2014
pawn Код:
enum ServerData
{
PlayersRegistered
//You can add additional stuff here that you might want to save as well
};
new ServerInfo[ServerData];
public OnGameModeInit()
{
INI_ParseFile("Server.ini", "LoadServInfo_%s", .bExtra = false);
//Other code...
return 1;
}
//When a user registers...
ServerInfo[PlayersRegistered]++;
new INI:file = INI_Open("Server.ini");
INI_SetTag(file, "data");
INI_WriteInt(file, "PlayersRegistered", ServerInfo[PlayersRegistered]); //This is just in case the server ever crashes, so we don't use OnGameModeExit
INI_Close(file);
//
forward LoadServInfo_data(name[], value[]);
public LoadServInfo_data(name[], value[])
{
INI_Int("PlayersRegistered", ServerInfo[PlayersRegistered]);
//Other server stuff here...
return 1;
}
Then you could use:
pawn Код:
printf("There are a total of %d players registered.", ServerInfo[PlayersRegistered]);
This is just an example of how to save the amount of players registered.
This uses a 'y_ini' based saving system.
Re: getting total # of acc registered -
AroseKhanNiazi - 20.06.2014
i have already know this way but how can i get the other # of acc that are registered already
Re: getting total # of acc registered -
Threshold - 20.06.2014
Well... you could count them manually I guess?

There's no real way to count them as far as I know :l
Re: getting total # of acc registered -
Jack_Leslie - 20.06.2014
If you can find a stock, or a code, that gets the last 3 characters of a string, you could make a loop, that loops through the path which would be wherever your accounts are stored, example "/accounts/" and for each string found that ends with ".ini" you add +1. I'm not sure how you would make the code to check the last 3 characters of a string, but it should be possible.
Re: getting total # of acc registered -
]Rafaellos[ - 20.06.2014
Quote:
Originally Posted by Threshold
Well... you could count them manually I guess? 
There's no real way to count them as far as I know :l
|
Actually there is. Right click on the Folder > Properties > Contains: x Files.
Re: getting total # of acc registered -
Jack_Leslie - 20.06.2014
Quote:
Originally Posted by ]Rafaellos[
Actually there is. Right click on the Folder > Properties > Contains: x Files.
|
I think it's obvious he means scriptwise.
OT:
You could make a seperate .ini file, and every time someone registers it just gets the value from that seperate .ini file, adds 1 and saves.. That's probably the easiest way with an ini based file system.
Re: getting total # of acc registered -
NaClchemistryK - 20.06.2014
Quote:
Originally Posted by Jack_Leslie
I think it's obvious he means scriptwise.
OT:
You could make a seperate .ini file, and every time someone registers it just gets the value from that seperate .ini file, adds 1 and saves.. That's probably the easiest way with an ini based file system.
|
That.
He means to simply create a "Server.ini" file or something. There you can add the number of registrations every time someone registers. You can also store other Server stuff in there. For example, number of bans.
Re: getting total # of acc registered -
AroseKhanNiazi - 20.06.2014
SO I THINK I NEED TO COUNT THEM manually and add it in the server ini and next each time acc registers it's +1 to each
Re: getting total # of acc registered -
AroseKhanNiazi - 20.06.2014
Quote:
Originally Posted by NaClchemistryK
That.
He means to simply create a "Server.ini" file or something. There you can add the number of registrations every time someone registers. You can also store other Server stuff in there. For example, number of bans.
|
yea i made something like that to store number of players banned by anticheat