Recording total played time?
#1

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.
Reply
#2

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
Reply
#3

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
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)