Max Players Save in DB bug.
#1

Hey all,

Well I have had this system for a while now but since recently I saw it did save for a while and then returns back to its old value:

pawn Код:
ON PLAYER CONNECT:

PlayersOn++;

    if(PlayersOn > MaxOnline)
    {
        new query[200];
        MaxOnline = PlayersOn;
        format(query, sizeof(query), "UPDATE `ServerData` SET `MaxOnline` = %d WHERE ID = 1", MaxOnline);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
       
        new str2[128];
        format(str2, sizeof(str2), "Copyright VL-RP 2014 - 2015 ] Player Record: %d ] Script Version: "#SCRIPT_VERSION"", MaxOnline);
        TextDrawSetString(Text:ServerStats, str2);
    }

public LoadServerDataCallback()
{
    new
        rows,
        fields;

    cache_get_data(rows, fields);
    new temp[50];
    cache_get_row(0, 1, temp);
    RegisteredPlayers = strval(temp);
    cache_get_row(0, 2, temp);
    SavedVehicles = strval(temp);
    cache_get_row(0, 3, temp);
    SavedHouses = strval(temp);
    cache_get_row(0, 4, temp);
    SavedBusinesses = strval(temp);
    cache_get_row(0, 5, temp);
    MaxOnline = strval(temp);
    printf("Loaded Server Data");
    printf("%d Registrered Accounts", RegisteredPlayers);
    printf("%d SavedVehicles", SavedVehicles);
    printf("%d SavedHouses", SavedHouses);
    printf("%d SavedBusinesses", SavedBusinesses);
    printf("%d Max Record", MaxOnline);
   
    new str2[128];
    format(str2, sizeof(str2), "Copyright VL-RP 2014 - 2015 ] Player Record: %d ] Script Version: "#SCRIPT_VERSION"", MaxOnline);
    TextDrawSetString(Text:ServerStats, str2);

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)