25.02.2013, 19:57
Well, I would do it this way:
Create 2 time variables for the player.
One is for saving the total time the player was on the server, the other is a temporary one for every "session".
The total time variable (like "pTotalTime") is loaded and saved exactly like the other variables you have there (like pKills for example).
in OnPlayerConnect do something like this:
in PlayerDisconnect (BEFORE saving the variables to the file):
I would not save the time in milliseconds (as returned by GetTickCount). After some weeks/days of playing the values are getting too big for the capacity of PAWN's integer variables.
Then you have the total time the player played on your server in SECONDS saved in pTotalTime.
You can now either use a time converting function (there are some includes, use search) or convert it yourself.
If you don't know how to do post here again I can explain it to you.
Create 2 time variables for the player.
One is for saving the total time the player was on the server, the other is a temporary one for every "session".
The total time variable (like "pTotalTime") is loaded and saved exactly like the other variables you have there (like pKills for example).
in OnPlayerConnect do something like this:
Код:
PlayerInfo[playerid][pTMPTime] = GetTickCount();
Код:
PlayerInfo[playerid][pTotalTime] += (GetTickCount() - PlayerInfo[playerid][pTMPTime])/1000;
Then you have the total time the player played on your server in SECONDS saved in pTotalTime.
You can now either use a time converting function (there are some includes, use search) or convert it yourself.
If you don't know how to do post here again I can explain it to you.