Checking hours
#1

Fixed.
Reply
#2

Just set up a timer which increases a variable every second/minute.

Like:

Код:
new pOnlineTime[MAX_PLAYERS];

SetTimerEx("OnlineTime",  1000, 1, "i", playerid);

foward OnlineTime(playerid)
public OnlineTime(playerid)
{
      pOnlineTime[playerid]++;
      return 1;
}
You can do the same with minutes of course which is probably better.
Then calculate the hours from the minutes/seconds.
Reply
#3

Very ineffcient. Save timestamp at connect (gettime()), subtract from the timestamp at disconnect and then add to the player's total time; e.g. let's say the timestamp when the player joins is 100 and when he leaves it's 500. The player has played for 400 seconds during that session.
Reply
#4

Okay, yeah that's probably better.
Reply
#5

Use timer and save array in database (or files)
Reply
#6

Quote:
Originally Posted by Vince
Посмотреть сообщение
Very ineffcient. Save timestamp at connect (gettime()), subtract from the timestamp at disconnect and then add to the player's total time; e.g. let's say the timestamp when the player joins is 100 and when he leaves it's 500. The player has played for 400 seconds during that session.
Thank you !!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)