SA-MP Forums Archive
Stats - 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: Stats (/showthread.php?tid=497903)



Stats - KIllINGS - 01.03.2014

How do I get 1 hour to put on / stats


Re: Stats - rangerxxll - 01.03.2014

Well. I'm sure there's a few ways to do it, but the most simplest way would be to create a timer. And at the end of the timers cycle, have it add 1 hour to their user data. Here's a example.

pawn Код:
SetTimerEx("payday", 3600000, true, "i", playerid); //This would create a repeating timer for the playerid.
After that, you would need to forward "payday". So do the following.

pawn Код:
forward payday(playerid);
public payday(playerid)
{
    SendClientMessage(playerid, color, "Congratulations. You have earned 1+ score for playing one hour."); //sends them a message, making them aware of the payday.
    PlayerInfo[playerid][pHours]++; //adds 1 hour to their user data.
    return 1;
}