Y_INI not overwriting data..
#1

pawn Код:
// .ini file
[Server Statistics]
Total Registered Users = 1
Total Registered Users = 1
pawn Код:
new gTotalRegisters;
#define ServerStats "stats/ServerStats.ini"
//OnGameModeInit
INI_ParseFile(ServerStats, "loadserverstats", .bExtra = false);

forward loadserverstats(name[], value[]);
public loadserverstats(name[], value[])
{
    INI_Int("Total Registered Users", gTotalRegisters);
    return 1;
}

// DIALOG_REGISTER
gTotalRegisters++;
format(str, sizeof(str), "{%06x}%s(%d) has registered, making the server have total %d players registered.", random_color >>> 8, GetName(playerid), playerid, gTotalRegisters);
SendClientMessageToAll(-1, str);

new INI:FILE_SERVER_STATS = INI_Open(ServerStats);
INI_SetTag(FILE_SERVER_STATS, "Server Statistics");
INI_WriteInt(FILE_SERVER_STATS, "Total Registered Users", gTotalRegisters);
INI_Close(FILE_SERVER_STATS);
Help..
Reply
#2

Need help.
Reply
#3

You need to store gTotalRegisters somewhere, for example in an enum.
Reply
#4

like in "Server Statistics" and "Total Registered Users" there should not be a space between it try doing this instead "Server_Statistics" and"Total_Registered_Users"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)