How to save played time on mysql.
#2

Under onplayerconnect, make a variable and do this
pawn Код:
playerJOINtime[playerid] = gettime();
then under OnPlayerDisconnect,
pawn Код:
Player total time played this session = gettime() - playerJOINtime[playerid]
now this difference gives the no of secs played by player in this session. Each time, add this to the existing time (MAKE SURE YOU DO NOT OVERWRITE IT, BUT ADD IT) after retreiving it. Then, divide by 3600, floatround to get the hours played, for mins, divide by 60 and floatround, for seconds, just use
pawn Код:
secs = totaltime % 60
to get the secs and display it.. Hope you understood.
Reply


Messages In This Thread
How to save played time on mysql. - by Scrillex - 18.10.2013, 16:04
Re: How to save played time on mysql. - by RajatPawar - 18.10.2013, 16:32
Re: How to save played time on mysql. - by Scrillex - 18.10.2013, 16:34

Forum Jump:


Users browsing this thread: 1 Guest(s)