Count-down [+rep] - 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: Count-down [+rep] (
/showthread.php?tid=332748)
Count-down [+rep] -
Steezy_ - 09.04.2012
Hey guys, now im trying to create count down with timers but i have a prob
the prob. is...when i write /test the 1,2,3 countdowns dont appear as gametext...only the final one (boom)
here is the code:
Quote:
forward boom();
forward one();
forward two();
forward tre();
new ob;
//onfsinit
ob = CreateObject(srry private code);
//onplayercommandtext
{
if(strcmp(cmdtext, "/test", true, 10)==0)
{
SetTimer("boom", 4000, 0);
SetTimer("tre", 1000, 0);
SetTimer("two", 2000, 0);
SetTimer("one", 3000, 0);
return 1;
}
return 0;
}
public boom()
{
MoveObject(ob, srry private code);
GameTextForAll("~r~BOOM!", 3000,3);
return 1;
}
public one()
{
GameTextForAll("3 seconds until launch", 3000,3);
return 1;
}
public two()
{
GameTextForAll("2 seconds until launch", 3000,3);
return 1;
}
public tre()
{
GameTextForAll("1 seconds until launch", 3000,3);
return 1;
}
|
Re: Count-down [+rep] -
Phyrunx - 09.04.2012
Under the
Код:
SetTimer("boom", 4000, 0);
Type This
Код:
SetTimer("one", 4000, 0);
SetTimer("two", 4000, 0);
SetTimer("tre", 4000, 0);
Re: Count-down [+rep] -
Steezy_ - 09.04.2012
Quote:
Originally Posted by Phyrunx
Under the
Код:
SetTimer("boom", 4000, 0);
Type This
Код:
SetTimer("one", 4000, 0);
SetTimer("two", 4000, 0);
SetTimer("tre", 4000, 0);
|
all timers to 4 sec.? -_-
btw did read my post? there are aearly these strings...
Re: Count-down [+rep] -
Cjgogo - 09.04.2012
Try this:
pawn Код:
new countn,counttimer;
forward BOOM(playerid);
COMMAND:test(playerid,params[])
{
countn=3;
counttimer=SetTimerEx("BOOM",1000,true,"i",playerid);
}
public BOOM(playerid)
{
countn--;
new string[128];
format(string,sizeof(string),"%d",countn);
GameTextForPlayer(playerid,string,3000,4);
if(count<=-1)
{
KillTimer(counttimer);
GameTextForPlayer(playerid,"BOOM",1500,4);
}
return 1;
}
replace your whole code with what I gave you
Re: Count-down [+rep] -
Steezy_ - 09.04.2012
Quote:
Originally Posted by Cjgogo
Try this:
pawn Код:
new countn,counttimer; forward BOOM(playerid); COMMAND:test(playerid,params[]) { countn=3; counttimer=SetTimerEx("BOOM",1000,true,"i",playerid); } public BOOM(playerid) { countn--; new string[128]; format(string,sizeof(string),"%d",countn); GameTextForPlayer(playerid,string,3000,4); if(count<=-1) { KillTimer(counttimer); GameTextForPlayer(playerid,"BOOM",1500,4); } return 1; }
replace your whole code with what I gave you
|
thx u <3 +1 rep