Activity points !
#1

I am having a problem with activity points, it's going up too fast !

Код:
new Activity[MAX_PLAYERS];
new Classed[MAX_PLAYERS]

public OnPlayerConnect(playerid)
{
Classed[playerid] = 0;
}

public OnPlayerSpawn(playerid)
{	
	if(Classed[playerid]==0)
	{
	SetTimerEx("upactpoints",60000,1,"i",playerid);
	}
	Classed[playerid]=1;
}

forward upactpoints();
public upactpoints()
{
	for(new i=0; i < MAX_PLAYERS; i++)
		{
        if(IsPlayerConnected(i))
    		    {
    		     if(Active[i]==1)
    			    {
				GivePlayerAct(i,1);
				}
			}
		}
	return 1;
}

stock GivePlayerAct(playerid, act)
{
	Activity[playerid] = Activity[playerid] + act;
	return Activity[playerid];
}

stock GetPlayerAct(playerid)
{
	return Activity[playerid];
}
Why is it giving points like 10 in 10 seconds ?
Reply
#2

Everytime a player dies, the timer is being repeated, so if the timer is running twice, every player will get a point every 60 seconds.

You should have placed your "SetTimer" function under "OnGameModeInit"

Please Note; In your case, you do not need SetTimerEx because your callback doesn't have any parameters.
Reply
#3

No, the timer is not repeated because Classed[playerid]=1; .

I have another timers between if(Classed[playerid]=0) and they work fine, they just start one time, then after player spawns they wont start again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)