11.04.2012, 20:36
Well, from what you've posted, the only way that a player can level-up is by obtaining minutes which is obviously given every minute. So make a repeating timer for 1 minute.
Alright, let's start. First, declare a forward for the call-back.
Then set the timer
For an explanation of the code above:
OneMinute would be the call-back as declared above, 60000 is the interval which is 1 minute, and the last parameter as 1 to identify it as repeating.
Next, let's create the actual call-back.
On the call-back, it would loop through all the players online and would give them 1 point to their minutes variable.
Alright, let's start. First, declare a forward for the call-back.
pawn Код:
forward OneMinute();
pawn Код:
public OnGameModeInit()
{
SetTimer("OneMinute", 60000, 1);
return 1;
}
OneMinute would be the call-back as declared above, 60000 is the interval which is 1 minute, and the last parameter as 1 to identify it as repeating.
Next, let's create the actual call-back.
pawn Код:
public OneMinute()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
// Create your own variables which I assume that you already have for each player.
// That would be the enumeration(enum) on top of your script.
PlayerStats[i][pMinutes]++; // this is just an example, change it with your actual variable.
}
}
return 1;
}