Force mysql to update player Info every 5 mins?
#1

as the title says ^^ :
how to Force mysql to update player Info every 5 mins?
Reply
#2

pawn Код:
forward SaveAcct(playerid);
forward Save_Account(playerid);
new Account_Save[MAX_PLAYERS];
pawn Код:
Account_Save[playerid] = SetTimerEx("SaveAcct", 900000, true, "i", playerid);
pawn Код:
public SaveAcct(playerid)
{
    Save_Account(playerid);
    SCM(playerid, C_YELLOW, " >> Player account saved automatically.");
}
public Save_Account(playerid)
{
    new query[2000];
    P_Info[playerid][N_Cash] = GetPlayerMoney(playerid);
    mysql_format(mysql, query, sizeof(query),"UPDATE `players` SET `Cash`=%d, `Admin`=%d,`Kills`=%d,`Deaths`=%d,`Rank`=%d,\
    `Vehicle`=%d, `Robberies`=%d, `Score`=%d, `Donor`=%d, `Banned`=%d WHERE `ID`=%d"
, P_Info[playerid][N_Cash], P_Info[playerid][N_Admin], P_Info[playerid][N_Kills], P_Info[playerid][N_Deaths],
    P_Info[playerid][N_Rank], P_Info[playerid][N_Vehicle], P_Info[playerid][N_Robberies], P_Info[playerid][N_Score], P_Info[playerid][N_Donor], P_Info[playerid][N_Banned], P_Info[playerid][pID]);
    mysql_tquery(mysql, query, "", "");
    return true;
}
Change this to match yours accordingly.
Reply
#3

Thx so much +repped,
but how much is
900000 with seconds ^^ ty again
Reply
#4

Quote:
Originally Posted by SWAT4
Посмотреть сообщение
Thx so much +repped,
but how much is
900000 with seconds ^^ ty again
That's 5 Minutes, 900,000 is miliseconds.
Which is 900 seconds
Reply
#5

thx ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)