Help me again -.- - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me again -.- (
/showthread.php?tid=174720)
Help me again -.- -
sekol - 06.09.2010
So i need to know how to aboid scripting like this:
Код:
if(strcmp("/destroycity", cmdtext, true) == 0)
{
new Random = random(402);
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
new Random2 = random(402);
CreateExplosion(USAair[Random2][0], USAair[Random2][1], USAair[Random2][2], 6, 10.0);
}
Isn't there anyway to use, hmm.... "Random++;" or something? it would take hundreds lines to create all those random explosions over city.
Re: Help me again -.- -
Claude - 06.09.2010
No, this is the only way, just make it next to each other.
It will look noobish but has less lines
Re: Help me again -.- -
sekol - 06.09.2010
So i have create hundreds of randoms?!
Re: Help me again -.- -
Mauzen - 06.09.2010
You do do it with a loop:
pawn Код:
new Random = random(402);
for(new i = 0; i < MAX_EXPLOSIONS; i ++)
{
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
Random = random(402);
}
This will create as much explosions as you want
Re: Help me again -.- -
sekol - 06.09.2010
Quote:
Originally Posted by Mauzen
You do do it with a loop:
pawn Код:
new Random = random(402); for(new i = 0; i < MAX_EXPLOSIONS; i ++) { CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0); Random = random(402); }
This will create as much explosions as you want
|
So
Код:
new Random = random(402);
for(new i = 0; i < MAX_EXPLOSIONS; i ++)
{
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
CreateExplosion(USAair[Random][0], USAair[Random][1], USAair[Random][2], 6, 10.0);
Random = random(402);
}
Yea?
Re: Help me again -.- -
Mauzen - 06.09.2010
One CreateExplosion is enuogh, the loop creates a random value, and then creates the explosion at the pos for that value, so multiple CreateExplosions would just create multiple explosions on the same position.
The number of explosions is just definined through MAX_EXPLOSIONS (put here whatever you want) because this sets the maximum number of runs of the loop.
Re: Help me again -.- -
sekol - 06.09.2010
Thanks