#1

How can i check how much time someone was in server? i mean... i want to make a "Money Giving" every hour and that the system will calculate it with the time he was connected out of the hour... how can i do it without getting my server very laggy?
Reply
#2

Global variable:
pawn Код:
new initRef[MAX_PLAYERS] = {0, ...};
When they join:
pawn Код:
initRef[playerid] = GetTickCount();
Whenever you want the server to give them the money.
pawn Код:
new online = (GetTickCount() - initRef[playerid]) / 1000;
"online" will be the time they were in the server in seconds.
Reply
#3

A better way would be to set a variable to 60, and every minute reduce it by 1, when it reaches 0 give them money and set it back to 60. Make sure you save the value to their account also.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)