SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 19/08/2012, 10:35 PM   #1
sniperwars
Huge Clucker
 
Join Date: Jan 2011
Location: Under your bed.
Posts: 443
Reputation: 22
Default Problem with saving the players total online time!

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 Code:
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
__________________
sniperwars is offline   Reply With Quote
Old 20/08/2012, 12:22 AM   #2
sniperwars
Huge Clucker
 
Join Date: Jan 2011
Location: Under your bed.
Posts: 443
Reputation: 22
Default Re: Problem with saving the players total online time!

Sorry for the bump but I need someone to fix this.
__________________
sniperwars is offline   Reply With Quote
Old 20/08/2012, 12:53 AM   #3
Shetch
Gangsta
 
Shetch's Avatar
 
Join Date: Feb 2011
Posts: 527
Reputation: 40
Default Re: Problem with saving the players total online time!

Show us the TotalGameTime callback.
__________________
Shetch is offline   Reply With Quote
Old 20/08/2012, 01:17 AM   #4
sniperwars
Huge Clucker
 
Join Date: Jan 2011
Location: Under your bed.
Posts: 443
Reputation: 22
Default Re: Problem with saving the players total online time!

pawn Code:
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];
}
__________________
sniperwars is offline   Reply With Quote
Old 20/08/2012, 01:54 AM   #5
Shetch
Gangsta
 
Shetch's Avatar
 
Join Date: Feb 2011
Posts: 527
Reputation: 40
Default Re: Problem with saving the players total online time!

I actually have no solution for your problem, sorry.
__________________
Shetch is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Players online time in server H/M/S maisto5 Scripting Help 8 01/09/2011 04:18 PM
Total time online? DiddyBop Help Archive 7 09/08/2010 02:24 AM
Time doubles speed when 2 players online. Zh3r0 Help Archive 15 10/04/2010 01:06 PM
Total Players Online INeedHelp Help Archive 2 02/04/2010 08:30 PM
[Help] Saving Character online time. Mowgli Help Archive 5 01/09/2009 08:21 AM


All times are GMT. The time now is 05:47 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.