20.06.2014, 07:02
how can i get the total number of accounts registered i am using y_ini
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;
}
printf("There are a total of %d players registered.", ServerInfo[PlayersRegistered]);
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. |