How to make players score rise every 1 hour? - 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: How to make players score rise every 1 hour? (
/showthread.php?tid=293495)
How to make players score rise every 1 hour? -
Feel - 28.10.2011
Hello.
Im using GTA:RP (LARP edit), and i want people to get score +1 every hour, and it would save it. Right now you will need to play like X hours, do /levelup and then your score will be 2. I want it to be every hour +1 if player is online.
Please help me with that, i have asked for this before and I didnt get any help from you guys!
Re: How to make players score rise every 1 hour? -
Scenario - 28.10.2011
Start a one hour timer when the game mode beings.
Each time the timer is called (ever hour from the time the game-mode began), loop through all players (would recommend using foreach by ****** for this).
For each player, update their score like this:
pawn Код:
SetPlayerScore(i, GetPlayerScore(i)+1);
That will get their score, then set their score to what it was plus one.
Good luck!
Re: How to make players score rise every 1 hour? -
Tigerkiller - 28.10.2011
for dynamic i recomment you to use SetTimerEx
Re: How to make players score rise every 1 hour? -
Scenario - 28.10.2011
Quote:
Originally Posted by Tigerkiller
for dynamic i recomment you to use SetTimerEx
|
What the hell are you talking about? There is no reason for them to use SetTimerEx.
Re: How to make players score rise every 1 hour? -
Tigerkiller - 28.10.2011
yep lol but when he loops thought all players, that havent played for a hour?
i play 1 min and get rep or what ?
Re: How to make players score rise every 1 hour? -
Scenario - 29.10.2011
I see I made a mistake.
You need to set a timer for EACH player when they connect- when the timer get's called then update their score. Keep in mind, if they are online for 59 minutes, then they'll need to be online another hour (if they disconnect) before their score increases. It may be a good idea to save this for later use.