Posts: 749
Threads: 76
Joined: Apr 2013
Reputation:
0
Hey guys,i want a script that give +1 score every 1 hour.
I watched the tutorials about the score timer like +1 score every 1 hour but i didn't understood, can someone do
it for me or explain it to me please?
Posts: 302
Threads: 72
Joined: Dec 2009
Here you go, have a look at this I've just created:
pawn Код:
new pTimeOnline[MAX_PLAYERS];
public OnGameModeInit()
{
SetTimer("Timer_Second", 1000, true);
}
forward Timer_Second();
public Timer_Second()
{
for(new i = 0; i != MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(pTimeOnline[i] == 3600)
{
pTimeOnline[i] = 0;
SetPlayerScore(i, GetPlayerScore(i) + 1);
} else
pTimeOnline[i]++;
}
}
}
public OnPlayerConnect(playerid)
{
pTimeOnline[playerid] = 0;
return 1;
}
Posts: 302
Threads: 72
Joined: Dec 2009
Because if someone joined a few seconds before the interval was about to tick 60 minutes, they would also get +1 score.