SA-MP Forums Archive
Getting total 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: Getting total time (/showthread.php?tid=275858)



Getting total time - emokidx - 11.08.2011

hello
i need some help in getting the total times...
e.g.
the total time played by a player..etc..


Re: Getting total time - XGh0stz - 11.08.2011

Alright, I use a timer to determine how long a player has been online and also how long he's been online in total. By using PVars which are updated every second, minute, hour, days, weeks & years even... But only create the according PVars which you care to measure for Player's Total Time etc.


Re: Getting total time - emokidx - 12.08.2011

i dont really understand..


Re: Getting total time - emokidx - 13.08.2011

bump*

and i will add more here..

as i think that SetTimer is a function which creates something like a countdown
so i want something that keeps increasing..
please someone could explain that,, or give me a link to some tut or something..


Re: Getting total time - emokidx - 15.08.2011

bump**


Re: Getting total time - dowster - 15.08.2011

I think this may work, what you want is a variable that gets saved to their file with their total seconds. When they login you have another variable in your array/enum that you use to hold the playerdata and you do
pawn Код:
variable = gettime();
then when they log out you do
pawn Код:
variableToBeSaved += (gettime() - variable);
and that will add the seconds they just played to their total seconds. Then when you want to display this information you can manipulate it however you want.