PDA

View Full Version : Simple score system.


Azzeto
12/10/2011, 09:45 AM
I need help to create a [probably] simple score system. I'm a newb with timers but I need an example of each

1. Everyhour some one gets 1 score.
2. Some one does an action and gets 1 score [Ex. Robbing a store]

Whoever helps will recieve a rep.

Wesley221
12/10/2011, 09:58 AM
SetTimer("ScoreTimer", 3600000, true); // add this to OnGameModeInit, this will repeat every 1 hour (3600000 miliseconds in 1 hour (if im right))
// it will create a timer with name 'ScoreTimer'
forward ScoreTimer(); // forwarding the timer with name 'ScoreTimer'
public ScoreTimer() // the public of the timer, it will do this every hour
{
foreach(Player, i) // need the foreach include
{
SetPlayerScore(i, GetPlayerScore(i) + 1)
}
return 0;
}

This would help you with the timer thing

Azzeto
12/10/2011, 10:35 AM
Posting this before I tested it, but i'm repping you for helping, just one question, does this restart the timer when a player logs in? Or lets say a player logs in for like 21 minutes, logs out, and logs back in like 10 minutes later, does the timer reset, or continue from where he logged out?
-Didnt have the foreach, added it now, now I get 1 error
Fixed it ;)