30.09.2009, 20:09
Hello,
Today i've tried to make a command with timers,/bomb.
Its suppose to make an explosion,after 1 second another one,etc.4 explosions.
Well here is the code:
On the top:
OnPlayerCommandText:
On the bottom:
No errors at compiling.
Well,Whats the bug?
What happens is,that when im using /bomb,its starts,1 explosion,good,2 explosions,good,3 explosions,good,4 explosions,good,5 explosions,WTF?there supposed to be 4 explosions only.and it makes endless explosions at the same place.what am i doing wrong?
Excuse me,its the first time im using timers
Today i've tried to make a command with timers,/bomb.
Its suppose to make an explosion,after 1 second another one,etc.4 explosions.
Well here is the code:
On the top:
pawn Код:
forward ExTimer1(playerid);//The Ex=Explosion
forward ExTimer2(playerid);
forward ExTimer3(playerid);
forward ExTimer4(playerid);
pawn Код:
if (strcmp("/bomb", cmdtext, true, 10) == 0)
{
CreateExplosion(-1415.4913,490.6862,11.2429,7,100);
SetTimerEx("ExTimer1",1000,0,"d",playerid);
}
pawn Код:
public ExTimer1(playerid)
{
CreateExplosion(-1415.4913,490.6862,11.2429,7,100);
SetTimerEx("ExTimer1",1000,0,"d",playerid);
return 1;
}
public ExTimer2(playerid)
{
CreateExplosion(-1417.1440,491.5547,11.5640,7,100);
SetTimerEx("ExTimer2",1000,0,"d",playerid);
return 1;
}
public ExTimer3(playerid)
{
CreateExplosion(-1418.9178,491.6942,13.8101,7,100);
SetTimerEx("ExTimer3",1000,0,"d",playerid);
return 1;
}
public ExTimer4(playerid)
{
CreateExplosion(-1421.4771,492.4316,11.1953,7,100);
SetTimerEx("ExTimer4",1000,0,"d",playerid);
return 1;
}
Well,Whats the bug?
What happens is,that when im using /bomb,its starts,1 explosion,good,2 explosions,good,3 explosions,good,4 explosions,good,5 explosions,WTF?there supposed to be 4 explosions only.and it makes endless explosions at the same place.what am i doing wrong?
Excuse me,its the first time im using timers