28.11.2011, 19:42
hi,
i have this system to count a players online time and giving 500 score for an hour a player has been online but for some reason it doesnt work the right way.
I get the score message every 20 minutes instead of every hour only once!
Wheres the prob?
i have this system to count a players online time and giving 500 score for an hour a player has been online but for some reason it doesnt work the right way.
I get the score message every 20 minutes instead of every hour only once!
Wheres the prob?
pawn Код:
new Hours[MAX_PLAYERS];
new Minutes[MAX_PLAYERS];
new OnlineCheck[MAX_PLAYERS];
//OnPlayerConnect
OnlineCheck[playerid] = SetTimerEx("TimePlayed",60000,1,"playerid",playerid);
Minutes[playerid] = 0;
Hours[playerid] = 0;
//OnPlayerDisconnect
KillTimer(OnlineCheck[playerid]);
OnlineCheck[playerid]=-1;
//timer
forward TimePlayed(playerid);
public TimePlayed(playerid)
{
Minutes[playerid]++;
if(Minutes[playerid] == 60)
{
Hours[playerid]++;
Minutes[playerid] = 0;
SetPlayerScore(playerid,GetPlayerScore(playerid)+15);
SendClientMessage(playerid,-1,"You got 500 score cause youve been online for 1 hour!");
}
return 1;
}