Question [+ReP]
#1

Hello, i wanna ask a question.

I got this stuff,

Quote:

public flak1()
{
CreateExplosion(345.5642,1942.2423,91.0942, 7, 200.0);
SetTimer("flak2", 400, false);
}

public flak2()
{
CreateExplosion(361.6501,1833.6226,112.4169, 7, 200.0);
SetTimer("flak3", 200, false);
}

public flak3()
{
SetTimer("flak4", 500, false);
CreateExplosion(345.5642,1942.2423,91.0942, 7, 20.0);
}

public flak4()
{
CreateExplosion(292.3560,1932.7439,114.9479, 7, 200.0);
CreateExplosion(222.0950,1894.0089,65.7750, 7, 20.0);
SetTimer("flak5", 400, false);
}

public flak5()
{
CreateExplosion(318.1672,1896.9247,94.8049, 7, 200.0);
SetTimer("flak6", 600, false);
}

public flak6()
{
CreateExplosion(296.7839,1996.2834,93.8044, 7, 200.0);
CreateExplosion(345.5642,1942.2423,91.0942, 7, 20.0);
SetTimer("flak7", 300, false);
}

public flak7()
{
CreateExplosion(300.5460,2046.3280,80.2271, 7, 200.0);
SetTimer("flak8", 100, false);
}

public flak8()
{
CreateExplosion(257.0427,2014.5140,80.2271, 7, 20.0);
CreateExplosion(345.5642,1942.2423,91.0942, 7, 20.0);
SetTimer("flak9", 200, false);
}

public flak9()
{
CreateExplosion(238.3253,1984.2850,76.5202, 7, 200.0);
CreateExplosion(318.1672,1896.9247,94.8049, 7, 20.0);
SetTimer("flak10", 100, false);
}

public flak10()
{
CreateExplosion(209.8063,2031.0883,72.2160, 7, 20.0);
CreateExplosion(222.0950,1894.0089,65.7750, 7, 200.0);
SetTimer("flak11", 400, false);
}

public flak11()
{
CreateExplosion(222.0950,1894.0089,65.7750, 7, 20.0);
SetTimer("flak12", 500, false);
}

public flak12()
{
CreateExplosion(274.9369,1895.5328,84.6803, 7, 200.0);
SetTimer("flak13", 400, false);
}

public flak13()
{
CreateExplosion(269.5538,1803.3356,96.1616, 7, 20.0);
SetTimer("flak14", 300, false);
}

public flak14()
{
CreateExplosion(322.2178,1868.1572,78.0541, 7, 200.0);
SetTimer("flak15", 600, false);
}

public flak15()
{
CreateExplosion(304.2239,2007.7393,70.3496, 7, 20.0);
SetTimer("flak16", 800, false);
}

public flak16()
{
CreateExplosion(302.3601,2077.5278,93.3762, 7, 200.0);
// SetTimer("flak1", 1000, false);
}

I'm asking, how can i make it like, shorter? and i won't need to put SetTimer to change etc. But instead it will explode randomly on given coordinates and will stop on a time that i set it to?
Reply
#2

The timers all have different speeds, is that neccesary?
Reply
#3

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
The timers all have different speeds, is that neccesary?
Not Really, i just did that for some Fast effect x]
Reply
#4

If that is the case, what about setting a timer, looping, every 500ms, then a switch() statement or if() to check if a variable has a certain value and making an explosion, raising the value of value of that variable and then explode the next one.. like
pawn Код:
a++;
if(a == 0) CreateExplosion(...):
if(a == 1) CreateExplosion(...);
if(a == 2) CreateExplosion(...);
or
pawn Код:
a++;
switch(a)
{
case 0: CreateExplosion(...);
case 1: CreateExplosion(...):
case 2: CreateExplosion(...):
}
and when all the explosions are done, kill the timer at the last explosion perhaps?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)