[HELP] Destroying Dynamic Objects
#1

Hello,

i am try to destroying dynamic Objects with for loop

here is my code:


Код:
  	L[0] = CreateDynamicObject(10983,233.08203125,439.94628906,-1.92500007,0.00000000,0.00000000,0.00000000); //object(hub_sfs) (1)
	L[1] = CreateDynamicObject(11541,163.09960938,518.28515625,16.41543579,0.00000000,0.00000000,0.00000000); //object(dambit3) (1)
	L[2] = CreateDynamicObject(11539,278.62304688,474.71777344,-6.09234047,0.00000000,0.00000000,246.40136719); //object(dambit1) (1)
	L[3] = CreateDynamicObject(11539,294.32226562,475.25683594,20.67765808,0.00000000,0.00000000,246.40136719); //object(dambit1) (2)
	L[4] = CreateDynamicObject(17953,215.16665649,478.38708496,-1.83478677,0.00000000,0.00000000,88.43176270); //object(conc_bblok) (1)
	L[5] = CreateDynamicObject(16169,226.80371094,534.45996094,21.54305840,0.00000000,358.49487305,0.00000000); //object(n_bit_14) (1)
	L[6] = CreateDynamicObject(16170,233.04710388,360.22219849,18.83999825,0.00000000,0.00000000,264.37988281); //object(n_bit_15) (1)
	L[7] = CreateDynamicObject(16170,120.67521667,417.09393311,23.11772919,0.00000000,0.00000000,208.73498535); //object(n_bit_15) (3)
	L[8] = CreateDynamicObject(11541,96.90451813,465.58477783,25.08543968,0.00000000,0.00000000,90.00000000); //object(dambit3) (1)
	L[9] = CreateDynamicObject(11541,148.55441284,510.46472168,31.14042664,0.00000000,0.00000000,0.00000000); //object(dambit3) (1)
	L[10] = CreateDynamicObject(11541,96.89428711,486.80413818,-21.56456757,180.00000000,0.00000000,270.00000000); //object(dambit3) (1)
	L[11] = CreateDynamicObject(11472,185.96638489,461.66024780,19.94476891,0.00000000,0.00000000,283.53503418); //object(des_swtstairs1) (1)
	L[12] = CreateDynamicObject(11472,185.61590576,463.10913086,19.94481850,0.00000000,0.00000000,283.52966309); //object(des_swtstairs1) (2)
	L[13] = CreateDynamicObject(10983,181.02178955,476.55645752,-3.95499992,3.97000122,358.01501465,193.04003906); //object(hub_sfs) (1)
	L[14] = CreateDynamicObject(16050,236.11233521,477.27697754,24.18178368,359.50000000,90.00000000,90.00000000); //object(des_powercable_22) (1)
	L[15] = CreateDynamicObject(16095,236.54496765,426.88931274,1.48855472,0.00000000,0.00000000,269.80499268); //object(des_a51guardbox02) (1)
	L[16] = CreateDynamicObject(16095,185.37356567,486.92434692,17.67743492,0.00000000,0.00000000,259.44006348); //object(des_a51guardbox02) (2)
	L[17] = CreateDynamicObject(16095,236.68301392,468.49185181,1.05103672,0.00000000,0.00000000,357.72998047); //object(des_a51guardbox02) (3)
	L[18] = CreateDynamicObject(11484,235.45718384,446.27587891,3.62822771,0.00000000,0.00000000,176.66503906); //object(dam_turbine_4) (2)
	L[19] = CreateDynamicObject(11485,237.86470032,489.44165039,3.62130737,0.00000000,0.00000000,176.71002197); //object(dam_turbine_3) (1)
	L[20] = CreateDynamicObject(11486,218.77749634,521.82629395,-5.87267733,0.00000000,0.00000000,160.86999512); //object(dam_turbine_2) (1)
	L[21] = CreateDynamicObject(7947,301.78372192,453.69390869,21.55084991,0.00000000,0.00000000,83.82000732); //object(vegaspumphouse1) (1)
	L[22] = CreateDynamicObject(16095,259.90820312,498.63085938,0.63863003,0.00000000,0.00000000,89.72534180); //object(des_a51guardbox02) (4)
	L[23] = CreateDynamicObject(4106,185.97525024,520.95587158,13.29799843,354.04501343,0.00000000,0.00000000); //object(shpfireesc_lan) (1)
	L[24] = CreateDynamicObject(8613,194.11868286,433.01507568,5.87956762,0.00000000,0.00000000,76.41503906); //object(vgssstairs03_lvs) (1)
	L[25] = CreateDynamicObject(12950,184.38977051,456.99642944,19.72177887,0.00000000,0.00000000,0.00000000); //object(cos_sbanksteps03) (1)
	L[26] = CreateDynamicObject(12950,184.38958740,450.67111206,14.76675987,0.00000000,0.00000000,0.00000000); //object(cos_sbanksteps03) (2)
	L[27] = CreateDynamicObject(16095,184.62985229,444.56387329,13.20854568,0.00000000,0.00000000,270.21105957); //object(des_a51guardbox02) (5)
	L[28] = CreateDynamicObject(11544,274.18820190,535.48229980,20.81227112,0.00000000,0.00000000,290.17492676); //object(des_ntfrescape2) (1)
	L[29] = CreateDynamicObject(11544,282.51861572,445.68695068,24.26027870,0.00000000,0.00000000,348.97045898); //object(des_ntfrescape2) (3)
	L[30] = CreateDynamicObject(3066,281.84783936,501.13458252,23.00881004,0.00000000,0.00000000,5.70498657); //object(ammotrn_obj) (1)
	L[31] = CreateDynamicObject(3066,188.40625000,510.06542969,14.32909489,0.00000000,0.00000000,0.00000000); //object(ammotrn_obj) (2)
	L[32] = CreateDynamicObject(2991,188.81686401,455.43246460,13.90255260,0.00000000,0.00000000,0.00000000); //object(imy_bbox) (1)
	L[34] = CreateDynamicObject(2991,285.42523193,453.58453369,22.38695526,0.00000000,0.00000000,264.09500122); //object(imy_bbox) (2)
	L[35] = CreateDynamicObject(2973,277.90747070,534.72631836,21.75922203,0.00000000,0.00000000,0.00000000); //object(k_cargo2) (1)
	L[36] = CreateDynamicObject(2973,195.79939270,471.44915771,1.80335057,0.00000000,0.00000000,0.00000000); //object(k_cargo2) (2)
	L[37] = CreateDynamicObject(18260,249.42364502,468.08572388,2.35877800,0.00000000,0.00000000,273.04003906); //object(crates01) (1)
	L[38] = CreateDynamicObject(18257,265.01504517,481.77716064,1.78260911,0.00000000,0.00000000,0.00000000); //object(crates) (1)
And Destroying Object with for loop
Код:
for(new i=0;i<50;i++)
{
DestroyDynamicObject(L[i]);
}
Objects didnt destroying....
whats wrong in my code??
Reply
#2

have you done

new L[50]

maybe try
pawn Код:
new L[50]
public OnGameModeInt()
{
    new i = 0;
    L[i] = CreateDynamicObject(10983,233.08203125,439.94628906,-1.92500007,0.00000000,0.00000000,0.00000000), i++;
    L[i] = CreateDynamicObject(11541,163.09960938,518.28515625,16.41543579,0.00000000,0.00000000,0.00000000), i++;
    //... REST HERE
    //TRY IT WITHOUT THE 'i' FIRST
}

COMMAND:Destroy(playerid, params[])
{
    for(new i=0; i<50; i++)
    {
        DestroyDynamicObject(L[i]);
    }
    return 1;
}
Not sure if ur using ZCMD or not
Just an idea :/
Reply
#3

Quote:
Originally Posted by [DK]Dark_Knight
Посмотреть сообщение
have you done

new L[50]

maybe try
pawn Код:
new L[50]
public OnGameModeInt()
{
    new i = 0;
    L[i] = CreateDynamicObject(10983,233.08203125,439.94628906,-1.92500007,0.00000000,0.00000000,0.00000000), i++;
    L[i] = CreateDynamicObject(11541,163.09960938,518.28515625,16.41543579,0.00000000,0.00000000,0.00000000), i++;
    //... REST HERE
    //TRY IT WITHOUT THE 'i' FIRST
}

COMMAND:Destroy(playerid, params[])
{
    for(new i=0; i<50; i++)
    {
        DestroyDynamicObject(L[i]);
    }
    return 1;
}
Not sure if ur using ZCMD or not
Just an idea :/
nope i am not destroying with cmd
i am try to destroying with Timer

And one more CheckPoints didnt destroy too it will destroy for 2 or 3 sec and re show up.....
me using Incognito Streamer


Edit:
Код:
		for(new i;i<6;i++)
		{
		DestroyDynamicCP(B1[i]);
		Delete3DTextLabel(txt[i]);
		DestroyObject(pb[i]);
		}
in for loop samp default func like Delete3DTextlabel and DestroyObject destroyed...
but not destroy dynamicCP
Reply
#4

pawn Код:
new L[50]
forward destroyobj();

public OnGameModeInt()
{
    L[0] = CreateDynamicObject(10983,233.08203125,439.94628906,-1.92500007,0.00000000,0.00000000,0.00000000);
    L[1] = CreateDynamicObject(11541,163.09960938,518.28515625,16.41543579,0.00000000,0.00000000,0.00000000);
    //... REST HERE

    SetTimer("destroyobj", 120000, false);

}

public destroyobj()
{
    for(new i=0; i<50; i++)
    {
        DestroyDynamicObject(L[i]);
    }
    return 1;
}
What about that?

Do you have the "CreateDynamicObject"s under OnGameModeInt?
and How is the timer called?
Reply
#5

Quote:
Originally Posted by [DK]Dark_Knight
Посмотреть сообщение
pawn Код:
new L[50]
forward destroyobj();

public OnGameModeInt()
{
    L[0] = CreateDynamicObject(10983,233.08203125,439.94628906,-1.92500007,0.00000000,0.00000000,0.00000000);
    L[1] = CreateDynamicObject(11541,163.09960938,518.28515625,16.41543579,0.00000000,0.00000000,0.00000000);
    //... REST HERE

    SetTimer("destroyobj", 120000, false);

}

public destroyobj()
{
    for(new i=0; i<50; i++)
    {
        DestroyDynamicObject(L[i]);
    }
    return 1;
}
What about that?

Do you have the "CreateDynamicObject"s under OnGameModeInt?
and How is the timer called?
hmm i already try this in OnGameModeInit and Also try in func.. call with timer

Код:
for(new i;i<6;i++)
		{
		DestroyDynamicCP(B1[i]);
		Delete3DTextLabel(txt[i]);
		DestroyObject(pb[i]);
		}
--------------------------------------------
in for loop samp default func like Delete3DTextlabel and DestroyObject destroyed...
but not destroy dynamicCP
Reply
#6

Can you post me the whole code? i don't know where your calling it from...
Reply
#7

which streamer are you using ??

try this
pawn Код:
DestroyAllDynamicObjects();
hope this helps
Reply
#8

Quote:

Incognito Streamer

The message you have entered is too short. Please lengthen your message to at least 4 characters.
Reply
#9

Also How Many Objects do you have.. ?? 50 cause i see 38 in the list just to keep it clean.. idk if it affects but

try making a loop from 0 to 37 only.. tell me if it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)