Posts: 25
Threads: 0
Joined: Feb 2009
Reputation:
0
Create a timer, you can put it in OnGameModeInit:
SetTimer("PlayerTime", 1000, 0);
Create the function:
forward PlayerTime(); // dont forget the forward since its called in a timer
public PlayerTime()
{
for(new i = 0; i < MAX_PLAYERS; i++) // go through each player
{
if(IsPlayerConnected(i) && (maybe put logged-in variable here))
{
pInfo[i][Online]++; // add one second to the played time
}
}
}
if you want it to add time each minute, change the timer to 60000 milliseconds
Posts: 1,223
Threads: 5
Joined: Sep 2011
Reputation:
0
If I want something to happen every minute they're online, I can simply modify what they gain when a minute happens, or an hour, or even a second. It's a universal thing, if they play for 15 minutes, I can do that in there too. I personally think it's just simpler than getting time over and over.
EDIT:
I would say to use ******'s method if you aren't planning on doing anything with it, like putting in certain things at certain times. I can't think of a way without using a timer to do such a thing. Though, making a separate timer for every single player would probably create more of a mess than just using one global timer. Of course you could call it less like one minute and increase their minutes and when they're at that you could.
Posts: 627
Threads: 93
Joined: Mar 2009
Reputation:
0
@[ABK]Antonio
Thanks, it worked.