score help for server -
Nathanael_Tavares - 04.10.2009
could someone help me make a timer/code that makes all the players score go up every second or every minute go up 1 piont
TY
Nathanael_Tavares
Re: score help for server -
[XST]O_x - 04.10.2009
Easy

do it like this:
On the top of your script,after the includes put:
pawn Код:
forward ScoreTimer(playerid);
Under OnPlayerConnect:
pawn Код:
SetTimerEx("ScoreTimer",60000,0,"d",playerid);
And in the end of the script,make a callback,here:
pawn Код:
public ScoreTimer(playerid)
{
SetPlayerScore(playerid,(playerid)+1);
return 1;
}
Hope i helped.
PS:now after every 60 seconds everyone will get +1 point
I've tested it,its working
Oh and,you see the "60000",it means every 60 seconds,its in ms,it means,miliseconds,1000=1 second,so if you want any player to get
1 point after every second,change the 60000 to 1000.
Re: score help for server -
Nathanael_Tavares - 04.10.2009
Quote:
Originally Posted by 3xPloSioNxXx
Easy 
do it like this:
On the top of your script,after the includes put:
pawn Код:
forward ScoreTimer(playerid);
Under OnPlayerConnect:
pawn Код:
SetTimerEx("ScoreTimer",60000,0,"d",playerid);
And in the end of the script,make a callback,here:
pawn Код:
public ScoreTimer(playerid) { SetPlayerScore(playerid,(playerid)+1); return 1; }
Hope i helped.
PS:now after every 60 seconds everyone will get +1 point
I've tested it,its working 
|
TY very much
Re: score help for server -
pagie1111 - 05.10.2009
Whoa Whoa Whoa.... dude, instead of making that, which creates many timers for every player.
Use a loop:
pawn Код:
forward Score(playerid);
SetTimer("Score",60000,true);
public Score(playerid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
new Current;
Current = GetPlayerScore(i);
SetPlayerScore(i,Current + 1);
}
}
}
Re: score help for server -
[XST]O_x - 05.10.2009
Quote:
Originally Posted by Enemy_Plus[SA:MP
]
Whoa Whoa Whoa.... dude, instead of making that, which creates many timers for every player.
Use a loop:
pawn Код:
forward Score(playerid);
SetTimer("Score",60000,true);
public Score(playerid) { for(new i=0; i<MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { new Current; Current = GetPlayerScore(i); SetPlayerScore(i,Current + 1); } } }
|
Yeah after i tested my timer after two minutes the score still stays 1

so its working only for one minute,listen to Enemy_Plus he know better than me about scripting :P
i can say i've tried my luck.
Re: score help for server -
pagie1111 - 05.10.2009
Hahahaha

I find this funny lol.... well you did try :P
Re: score help for server -
dice7 - 05.10.2009
Mozilla Firefox, that's because you put
pawn Код:
SetTimerEx("ScoreTimer",60000,0,"d",playerid);
instead of
pawn Код:
SetTimerEx("ScoreTimer",60000,1,"d",playerid);
The third parameter means if the timer should repeat or not