Time played
#9

Quote:
Originally Posted by Ananisiki
Посмотреть сообщение
I wonder how i can add days played in stats?

Every 24 minutes will be one day in game, how i do
1. Create variable to store a "dayz played count" for each player (add it to your global arrays):
PHP код:
new days_played[MAX_PLAYERS]; 
2. Create public function, that will be called each hour (your's 24 minutes):
PHP код:
public IAmCalledEachHour() {
  for (new 
i=0i<MAX_PLAYERSi++)
    if (
IsPlayerConnected(i))
      
days_played[i]++;

It adds 1 hour for each player, that is online.

3. Set the timer, that will call this function each 24 minutes, for example in OnGameModeInit:
PHP код:
public OnGameModeInit(){
  ...
  
SetTimer("IAmCalledEachHour"24 60 1000true);
  ...

Done.
Reply


Messages In This Thread
Time played - by Ananisiki - 21.04.2014, 17:17
Re: Time played - by AroseKhanNiazi - 21.04.2014, 17:18
Re: Time played - by Ananisiki - 21.04.2014, 17:24
Re: Time played - by OsteeN - 21.04.2014, 17:26
Re: Time played - by Ananisiki - 21.04.2014, 17:27
Re: Time played - by AroseKhanNiazi - 21.04.2014, 17:31
Re: Time played - by Ananisiki - 21.04.2014, 19:07
Re: Time played - by AroseKhanNiazi - 22.04.2014, 14:37
Re: Time played - by therainycat - 22.04.2014, 16:37
Re: Time played - by Ananisiki - 23.04.2014, 01:10

Forum Jump:


Users browsing this thread: 5 Guest(s)