Problem with saving the players total online time!
#1

Hi all,

I'm using Y_ini for my saving system and I'm using the Lux Admin script for total online time to use on my own
custom made statistics command. When I join the server, the hours, minutes and seconds show fine but when I disconnect from the server, the "Hours", "Minutes" and "Seconds" don't save, it just shows 0 for each. I know the Lux Admin script uses dini but I don't think that will make a difference. I just wanted it to save the hours, minutes and seconds.

How can I get it to save OnPlayerDisconnect ?

This is what I have under OnPlayerDisconnect:
pawn Код:
new INI:File = INI_Open(UserPath(playerid));
new h, m, s;
INI_SetTag(File,"data");
INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
INI_WriteInt(File,"Reported",PlayerInfo[playerid][pReported]);
INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarnings]);
INI_WriteInt(File,"Kicks",PlayerInfo[playerid][pKicks]);
INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted]);
INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]);
INI_WriteInt(File,"Hours",PlayerInfo[playerid][pHours]);
INI_WriteInt(File,"Minutes",PlayerInfo[playerid][pMinutes]);
INI_WriteInt(File,"Seconds",PlayerInfo[playerid][pSeconds]);
TotalGameTime(playerid, h, m, s);
INI_Close(File);
I am using the exact code from the Lux Admin script so can anyone correct me here ?
I would like this to be corrected ASAP as I have just brought my host.

Thanks,

Sean
Reply
#2

Sorry for the bump but I need someone to fix this.
Reply
#3

Show us the TotalGameTime callback.
Reply
#4

pawn Код:
TotalGameTime(playerid, &h=0, &m=0, &s=0)
{
    PlayerInfo[playerid][pTotalTime] = ((gettime() - PlayerInfo[playerid][pConnectTime]) + (PlayerInfo[playerid][pHours]*60*60) + (PlayerInfo[playerid][pMinutes]*60) + (PlayerInfo[playerid][pSeconds]));

    h = floatround(PlayerInfo[playerid][pTotalTime] / 3600, floatround_floor);
    m = floatround(PlayerInfo[playerid][pTotalTime] / 60,   floatround_floor) % 60;
    s = floatround(PlayerInfo[playerid][pTotalTime] % 60,   floatround_floor);

    return PlayerInfo[playerid][pTotalTime];
}
Reply
#5

I actually have no solution for your problem, sorry.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)