Problem with saving the players total online time! -
sniperwars - 19.08.2012
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
Re: Problem with saving the players total online time! -
sniperwars - 19.08.2012
Sorry for the bump but I need someone to fix this.
Re: Problem with saving the players total online time! -
Shetch - 19.08.2012
Show us the TotalGameTime callback.
Re: Problem with saving the players total online time! -
sniperwars - 20.08.2012
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];
}
Re: Problem with saving the players total online time! -
Shetch - 20.08.2012
I actually have no solution for your problem, sorry.