Online time
#1

So I have this little snippet out of my stats command, basically my issue is that everyone have the same online time,

Also, let's say there are 2 players in-game.

I played for 1 hour, he played for 1 hour too,

I reconnect so I'm gonna have it all resetted(as it's suppose to be), but the first player's online time will be resetted too

Код:
		 format(iString,sizeof(iString),"{ffff99}Online Time: %d hours | %d minutes | %d seconds", hours, minutes, seconds);
		 SendClientMessage(playerid, -1, iString);
	}
 	return 1;
}

stock GetPlayerConnectedTime(playerid, &hours, &minutes, &seconds)
{
   new on‌linetime = NetStats_GetConnectedTime(playerid);
   seconds = (onlinetime / 1000) % 60;
   minutes = (onlinetime / (1000 * 60)) % 60;
   hours = (onlinetime / (1000 * 60 * 60));
   return 1;
}
Reply
#2

Can u show NetStats_GetConnectedTime(playerid)?
How are you saving and loading the players connected time?
Reply
#3

This is the whole code, I'm not trying to save the online time, It's just the time since he connected, It works but as I've stated above the only problem is it resets for everyone if someone disconnects and reconnects.
Reply
#4

Quote:
Originally Posted by ivndosos
Посмотреть сообщение
This is the whole code, I'm not trying to save the online time, It's just the time since he connected, It works but as I've stated above the only problem is it resets for everyone if someone disconnects and reconnects.
These are all global:
PHP код:
seconds = (onlinetime 1000) % 60;
   
minutes = (onlinetime / (1000 60)) % 60;
   
hours = (onlinetime / (1000 60 60)); 
Store the online time in a player ar e.g hours[playerid]
Reply
#5

OP post more of the code that you posted the last 3 lines of... More above that is where something will reside.

Above this...
PHP код:
         format(iString,sizeof(iString),"{ffff99}Online Time: %d hours | %d minutes | %d seconds"hoursminutesseconds);
         
SendClientMessage(playerid, -1iString);
    }
     return 
1;

You haven't posted all the code, as what's above that code SHOULD be the function to retrieve their time online.

Also where did you define hours/minutes/seconds?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)