Help with timer !
#1

I have a simple timer for adding score:

Код:
ScoreTimer1[playerid] = SetTimerEx("AddScore1", 60000, true, "i", playerid);
but its ok for 10-15 minutes and after that, it adding 2-3 score in every 15-20 seconds, anyone know how to fix it ?
Reply
#2

Prob its a variable problem or some in your script ... show the AddScore1 public
Reply
#3

Where are you setting the timer ?
And whats it calling ?
Reply
#4

Addscore1 + SetPlayerScoreEx

Quote:

forward AddScore1(playerid);
public AddScore1(playerid)
{
SetPlayerScoreEx(playerid, GetPlayerScore(playerid)+1);
return 1;
}

forward SetPlayerScoreEx(playerid,score);
public SetPlayerScoreEx(playerid,score)
{
new string[128];
Account[playerid][Score] = score;
SetPlayerScore(playerid,score);
if(score < 10) format(string,sizeof(string),"S0000000%d",score);
else if(score < 100 && score > 9) format(string,sizeof(string),"S000000%d",score);
else if(score < 1000 && score > 99) format(string,sizeof(string),"S00000%d",score);
else if(score < 10000 && score > 999) format(string,sizeof(string),"S0000%d",score);
else if(score < 100000 && score > 9999) format(string,sizeof(string),"S0000%d",score);
else if(score < 1000000 && score > 99999) format(string,sizeof(string),"S000%d",score);
else if(score < 10000000 && score > 999999) format(string,sizeof(string),"S00%d",score);
else if(score < 100000000 && score > 9999999) format(string,sizeof(string),"S0%d",score);
else if(score < 1000000000 && score > 99999999) format(string,sizeof(string),"S%d",score);
TextDrawSetString(TextScore[playerid],string);
}

Reply
#5

Quote:
Originally Posted by Gotti_
Посмотреть сообщение
Addscore1 + SetPlayerScoreEx
Where are you setting the timer ?
Reply
#6

public OnPlayerConnect( playerid )
{

ScoreTimer1[playerid] = SetTimerEx("AddScore1", 60000, true, "i", playerid);
Reply
#7

Quote:
Originally Posted by Gotti_
Посмотреть сообщение
public OnPlayerConnect( playerid )
{

ScoreTimer1[playerid] = SetTimerEx("AddScore1", 60000, true, "i", playerid);
Try:

pawn Код:
SetPlayerScoreEx(playerid, GetPlayerScore(playerid)++);
And where are you killing your timer ?
Reply
#8

im not killing it
Reply
#9

Quote:
Originally Posted by Gotti_
Посмотреть сообщение
im not killing it
You need to kill it when the player disconnects. Otherwise it will keep running. When the player re-connects it will start another.
Hence your score will go up by 2 or more.

https://sampwiki.blast.hk/wiki/KillTimer
Reply
#10

You have to kill when player disconnect ..


EDIT: Fail post xD sorry
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)