Checking hours - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Checking hours (
/showthread.php?tid=581646)
Checking hours -
Crystallize - 14.07.2015
Fixed.
AW: Checking hours -
FSAOskar - 14.07.2015
Just set up a timer which increases a variable every second/minute.
Like:
Код:
new pOnlineTime[MAX_PLAYERS];
SetTimerEx("OnlineTime", 1000, 1, "i", playerid);
foward OnlineTime(playerid)
public OnlineTime(playerid)
{
pOnlineTime[playerid]++;
return 1;
}
You can do the same with minutes of course which is probably better.
Then calculate the hours from the minutes/seconds.
Re: Checking hours -
Vince - 14.07.2015
Very ineffcient. Save timestamp at connect (gettime()), subtract from the timestamp at disconnect and then add to the player's total time; e.g. let's say the timestamp when the player joins is 100 and when he leaves it's 500. The player has played for 400 seconds during that session.
AW: Checking hours -
FSAOskar - 14.07.2015
Okay, yeah that's probably better.
Re: Checking hours -
Orsini24 - 14.07.2015
Use timer and save array in database (or files)
Re: Checking hours -
Crystallize - 14.07.2015
Quote:
Originally Posted by Vince
Very ineffcient. Save timestamp at connect (gettime()), subtract from the timestamp at disconnect and then add to the player's total time; e.g. let's say the timestamp when the player joins is 100 and when he leaves it's 500. The player has played for 400 seconds during that session.
|
Thank you !!!!