SA-MP Forums Archive
[HELP] checkpoint 'for loop' countdown - 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)
+--- Thread: [HELP] checkpoint 'for loop' countdown (/showthread.php?tid=306718)



[HELP] checkpoint 'for loop' countdown - theinformer - 27.12.2011

new string[30];
for(new i = 30; i >= 0; i--){
format(string, sizeof(string), "CP countdown: %i", i);
gMyText1 = TextDrawCreate(280, 340, string);
}

In game it just shows "CP countdown: 1" then it freezes there.. when I leave the cp and reenter it, it doesnt even show anything..

{
if(checkpointid = Checkpoint[1]){
if(gTeam[playerid] == TEAM_GANG){
SetTimer("Timer", 1, true);
}
}
return 1;
}

NOTE: Checkpoint[1] is that checkpoint id that I'm using atm


Re: [HELP] checkpoint 'for loop' countdown - coole210 - 27.12.2011

Код:
new i = 30;
gMyText1 = TextDrawCreate(280,340,"CP countdown: 30");
while(i >= 0)
{
i--;
format(string, sizeof(string), "CP countdown: %i", i);
TextDrawSetString(gMyText1,string);
}



Re: [HELP] checkpoint 'for loop' countdown - theinformer - 27.12.2011

It only shows "CP countdown: -1"
Any idea?


Re: [HELP] checkpoint 'for loop' countdown - theinformer - 27.12.2011

I did
public Timer()
{
new string[50];
new i = 30;
for(i; i>=30; i--){
format(string, sizeof(string), "CP countdown: %i", i);
gMyText1 = TextDrawCreate(250,420,string);
TextDrawShowForAll(gMyText1);
}
return 1;
}

Everything else is fine but it says "CP countdown: 30" and doesnt go down. So the fault is in the for loop I think. I've done the forwarding of the function and stuff so thats all cool.