mysql is not saving
#1

hello all! so basically my problem is my system is not updating

pawn Код:
//Under OnGameMode
    SetTimer("SavePlayerData",180000,1);
//.....
public SavePlayerData(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        for (new i = 0; i < MAX_PLAYERS; i++)
        {
            new query[600];
            mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d,`Money`=%d,`Cookies`=%d,`Kills`=%d,`Deaths`=%d,`Score`=%d,`Banned`=%d,`Bannedfor`=%s,`Bannedby`=%e,`BannedDate`=%d WHERE `ID`=%d",\
            pInfo[i][Admin], pInfo[i][Money], pInfo[i][Cookies], pInfo[i][Kills], pInfo[i][Deaths],pInfo[i][Score],pInfo[i][Banned], pInfo[i][Bannedfor], pInfo[i][Bannedby], pInfo[i][BannedDate] ,pInfo[i][ID]);
            //We update the table(`players`) by getting player's admin level, vip level, money, and positions and save them in the database
            mysql_tquery(mysql, query, "", "");
        }
        new str[128];
        SendClientMessageToAll(0x009D00DB,"Your player data have been saved into(Database)");
        format(str, sizeof(str),"* Admin AutoSave (ID:007) saved all regged player stats (Total %d)",GetOnLinePlayers());
        IRC_GroupSay(groupID, IRC_CHANNEL, str);
    }
    return 1;
}
Reply
#2

pawn Код:
//Under OnGameMode
    SetTimer("SavePlayerData",180000,1);
//.....
public SavePlayerData()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if( IsPlayerConnected( i ) )
        {
            new query[600];
            mysql_format(mysql, query, sizeof(query), "UPDATE `players` SET `Admin`=%d,`Money`=%d,`Cookies`=%d,`Kills`=%d,`Deaths`=%d,`Score`=%d,`Banned`=%d,`Bannedfor`=%s,`Bannedby`=%e,`BannedDate`=%d WHERE `ID`=%d",\
            pInfo[i][Admin], pInfo[i][Money], pInfo[i][Cookies], pInfo[i][Kills], pInfo[i][Deaths],pInfo[i][Score],pInfo[i][Banned], pInfo[i][Bannedfor], pInfo[i][Bannedby], pInfo[i][BannedDate] ,pInfo[i][ID]);
            //We update the table(`players`) by getting player's admin level, vip level, money, and positions and save them in the database
            mysql_tquery(mysql, query, "", "");
        }
        new str[128];
        SendClientMessageToAll(0x009D00DB,"Your player data have been saved into(Database)");
        format(str, sizeof(str),"* Admin AutoSave (ID:007) saved all regged player stats (Total                 %d)",GetOnLinePlayers());
        IRC_GroupSay(groupID, IRC_CHANNEL, str);
    }
    return 1;
}
Also, I highly recommend you to use foreach if you're making it a global timer each 3 minutes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)