Activity points ! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Activity points ! (
/showthread.php?tid=91368)
Activity points ! -
RaFsTar - 14.08.2009
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 ?
Re: Activity points ! -
Joe Staff - 14.08.2009
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 SetTimer
Ex because your callback doesn't have any parameters.
Re: Activity points ! -
RaFsTar - 14.08.2009
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.