Played time ( non A.F.K ) - 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: Played time ( non A.F.K ) (
/showthread.php?tid=618675)
Played time ( non A.F.K ) -
TheDarkBlade - 08.10.2016
I'm creating a giftbox script buy i would like to make it accesable once 5 hours played ingame , not just by afk-ing .
So my question is how could i keep track of the actually played time ?
afk means when the player is not moving for more than 10 mins and not on the esc menu . or any other way of afk-ing .
Re: Played time ( non A.F.K ) -
JaKe Elite - 08.10.2016
PHP код:
new pLastUpdate[MAX_PLAYERS];
public OnPlayerUpdate(playerid)
{
pLastUpdate[playerid] = gettime();
return 1;
}
stock IsPlayerTabbed(playerid)
{
if(pLastUpdate[playerid] < gettime())
return 1;
return 0;
}
Use that function to detect if player is AFK or not (Check if the player is AFK when adding the playing hours)