Cant get countdown to work!!
#1

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...
Reply
#2

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 --;
}
Reply
#3

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
Reply
#4

Change "countdown --;" to "countdownselfdeastruct --;" ?
Reply
#5

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??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)