Time played
#1

I wonder how i can add days played in stats?

Every 24 minutes will be one day in game, how i do
Reply
#2

ananisiki soon i am doing it so i will give it too u too
Reply
#3

Need it now friend... :/
Reply
#4

Set a timer that will trigger every 24 minutes, which would add it to an database/ini file.
Reply
#5

Ye but how like a stock / public with stuff in it and pinfo[timeplayed] and stuff like that
Reply
#6

add an playerinfo enum like
Код:
daysplayed
then set an time on player connect and kill the timer on playerdisconnect
and you can do when the timer reaches the time u set
Код:
PlayerInfo[playerid][daysplayed] ++;
Reply
#7

Dont really understand
Reply
#8

do you use any clock/time system ??
Reply
#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
#10

ty +rep
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)