SA-MP Forums Archive
Recording total played time? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Recording total played time? (/showthread.php?tid=187306)



Recording total played time? - Face9000 - 02.11.2010

Hai,i use dini and dudb,there is any way to record the total played time for each player and showing into stats?

Example:

I write /stats :

Kills:
Money:
Total time played: XX days / XX minutes / XX seconds

Thanks.


Re: Recording total played time? - ViruZZzZ_ChiLLL - 02.11.2010

Well here's my version, it maybe unoptimized, but it gets the job done :

pawn Code:
new Hour_ini[MAX_PLAYERS];
new Minute_ini[MAX_PLAYERS];
new Second_ini[MAX_PLAYERS];
new Minute[MAX_PLAYERS];

SetTimerEx("TotalTime", 1000, true, "i", playerid); // put this somewhere in your script

forward TotalTime(playerid);
public TotalTime(playerid)
{
  if(Minute[playerid] == 60) return Minute[playerid]=0, Minute_ini[playerid]++;
  if(Minute_ini[playerid] == 60) return Minute_ini[playerid]=0;
  if(Minute[playerid] == 60*60) return Hour_ini[playerid]++;
  if(Second_ini[playerid] == 60) return Second_ini[playerid]=0;
  Minute[playerid]++;
  Second_ini[playerid]++;
  return 1;
}
The ones with ini are the ones that you must put in your string.
Hour, minute, and second.

EDIT : FUCK lol nvm


Re: Recording total played time? - -•♥♠♦♣-•Arshavin•-♥♠♦♣•- - 05.06.2011

i have little problem when i add it .. it doesnt save my old things i remove it it saves i put it again it doesnt save :P


Respuesta: Re: Recording total played time? - admantis - 05.06.2011

Quote:
Originally Posted by -•♥♠♦♣-•Arshavin•-♥♠♦♣•-
View Post
i have little problem when i add it .. it doesnt save my old things i remove it it saves i put it again it doesnt save :P
Congratulations for doing a 8 month bump.