explode
#1

hello.
i want to make explosions in different positions, and when it explodes, a map marker will appear there.
I have this array:
Код:
new Float:Sprogimai[22][3] = {
	{313.7992,-232.5558,1.5405},
	{303.3114,-242.4304,1.5781},
	{303.1594,-237.9958,1.5781},
	{161.5752,-107.0551,4.8965},
	{-551.0144,-180.1322,78.4063},
	{-549.0139,-198.3918,78.4063},
	{-535.5254,-201.2425,78.4047},
	{-91.0212,1379.6661,14.2219},
	{20.0051,909.6061,23.9200},
	{27.0170,923.9292,23.6297},
	{-25.8857,1120.5881,19.7422},
	{-110.2473,1129.0212,19.7422},
	{-109.4907,1136.9374,19.7422},
	{171.4478,1179.5272,14.7578},
	{1.3888,1376.2521,9.1719},
	{-126.5330,1188.3641,19.6109},
	{-182.2593,1216.5100,19.7176},
	{-149.3541,886.2834,18.5911},
	{-314.6257,827.1323,14.2422},
	{-55.6220,49.0006,3.1103},
	{160.3983,-152.6760,5.0786},
	{360.9296,-121.6992,1.2804}
};
There all my explosions positions.
Then i use this:
Код:
Sprogimas()
{
	new rand = random(sizeof(Sprogimai));

	CreateExplosion(Sprogimai[rand][0], Sprogimai[rand][1], Sprogimai[rand][2], 6, 10); // Sprogdinam
	return 1;
}
How to get the explosion pos?
Reply
#2

Well you would create a variable to log what "rand" is. So when you want to bring it up again you could just retrieve it through that same variable with your Index.
Reply
#3

can you give an example?
Reply
#4

any1?
Reply
#5

up
Reply
#6

Don't fucking triple post dude, sheesh.
What's wrong with the code you've got?
Reply
#7

pawn Код:
new Float:sX, Float:sY, Float:sZ;

Sprogimas()
{
    new rand = random(sizeof(Sprogimai));

    CreateExplosion(Sprogimai[rand][0], Sprogimai[rand][1], Sprogimai[rand][2], 6, 10); // Sprogdinam
    sX = Sprogimai[rand][0];
    sY = Sprogimai[rand][1];
    sZ = Sprogimai[rand][2];
    printf("Sprogimo coordinates: X: %f, Y: %f, Z: %f", sX, sY, sZ);
    return 1;
}
Try it, but i am not sure, maybe this code is right.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)