SA-MP Forums Archive
Cant get countdown to work!! - 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: Cant get countdown to work!! (/showthread.php?tid=210325)



Cant get countdown to work!! - BlackWolf120 - 12.01.2011

hi,
i just cant figure out why this countdown in this texdraw is not working. The textdraw itself appears but the seconds 480 dont change. It stays 480.
Could someone pls tell me the error?

pawn Код:
new Text:selfdestructtext;
new countdownselfdeastruct = 480;

//OnGameModeInit
selfdestructtext = TextDrawCreate(504.000000, 102.000000, "Self Destruction in: ~r~480");
TextDrawBackgroundColor(selfdestructtext, 255);
TextDrawFont(selfdestructtext, 1);
TextDrawLetterSize(selfdestructtext, 0.270000, 1.000000);
TextDrawColor(selfdestructtext, -1);
TextDrawSetOutline(selfdestructtext, 1);
TextDrawSetProportional(selfdestructtext, 1);

//OnPlayerEnterCheckpoint
ADTimer = SetTimer("ActivatorDestruct",480000,false);//this timer destroys a created pickup after 8 mins.
ASDCDK = SetTimer("counterselfdestruct",990,false);//this texdraw countdown just doesnt count down!!

forward counterselfdestruct();
public counterselfdestruct()
{

if(countdownselfdeastruct > 0)
{
ASDCDK = SetTimer("counterselfdestruct",990,false);
new textformat[85];
format(textformat,sizeof textformat,"Self Destruction in: ~r~%d",countdownselfdeastruct);
TextDrawSetString(selfdestructtext,textformat);
TextDrawShowForAll(selfdestructtext);

countdown --;
}

return 1;
}

regards...


Re: Cant get countdown to work!! - Cameltoe - 12.01.2011

Ur code looks a bit messy to me.. but the problem should be that you forgot an bracket..

pawn Код:
forward counterselfdestruct();
public counterselfdestruct()
{

if(countdownselfdeastruct > 0)
{
ASDCDK = SetTimer("counterselfdestruct",990,false);
new textformat[85];
format(textformat,sizeof textformat,"Self Destruction in: ~r~%d",countdownselfdeastruct);
TextDrawSetString(selfdestructtext,textformat);
TextDrawShowForAll(selfdestructtext);
} // Missing bracket here!
countdown --;
}



Re: Cant get countdown to work!! - BlackWolf120 - 12.01.2011

thx for ur answer

but thats not the error.
I tried it and in addition to that there would be an error while compiling if i had forgotten a bracket.

Pls, can someone help


Re: Cant get countdown to work!! - Zamaroht - 12.01.2011

Change "countdown --;" to "countdownselfdeastruct --;" ?


Re: Cant get countdown to work!! - BlackWolf120 - 14.01.2011

thank you very much
didnt see that stupid mistake
Another question:
How to do it like this countdown is not counting down like 480,479,478 (in seconds) but i want to count down like 8:00,7:59,7:58 (in minutes) how to do that??