DestroyObject?
#1

Hi, i made a list of objects and i want to know how to delete these and only these objects by one command.
I tryed using DestroyObject but i dont know the IDS. (This map was made in MTA)

Код:
    CreateObject(3095,-1975.38317871,122.47660065,23.69404984,90.00000000,0.00000000,180.00000000);
    CreateObject(3095,-1974.81420898,156.96458435,23.69404984,90.00000000,0.00000000,0.00000000);
    CreateObject(3095,-1960.91845703,138.16474915,30.68750000,0.00000000,90.00000000,180.00000000);
    CreateObject(3095,-1960.86621094,117.32519531,23.68750000,90.00000000,90.00000000,179.99450684);
    CreateObject(3095,-1960.84082031,127.23242188,24.68750000,90.00000000,90.00000000,179.99450684);
    CreateObject(3095,-1960.81909180,148.95767212,24.68750000,90.00000000,90.00000000,180.00000000);
    CreateObject(3095,-1960.90393066,160.82286072,23.68750000,90.00000000,90.00000000,180.00000000);
    CreateObject(3095,-1979.92443848,138.29560852,24.88750076,90.00000000,90.00000000,0.00000000);
    CreateObject(3095,-1926.58142090,110.22968292,29.28125000,90.00000000,90.00000000,90.00000000);
    CreateObject(3095,-1934.29687500,110.28515625,29.29999924,90.00000000,90.00000000,90.00000000);
    CreateObject(3095,-1942.99548340,110.37456512,29.30000114,90.00000000,90.00000000,90.00000000);
    CreateObject(3095,-1950.40197754,110.39454651,29.29999924,90.00000000,90.00000000,90.00000000);
    CreateObject(3095,-1957.71618652,110.46925354,29.36874962,90.00000000,90.00000000,90.00000000);
    CreateObject(3095,-1955.49768066,165.21762085,29.39405060,90.00000000,270.00000000,90.00000000);
    CreateObject(3095,-1947.70849609,165.22105408,29.39406204,90.00000000,270.00000000,90.00000000);
    CreateObject(3095,-1939.00646973,165.26200867,29.37344170,90.00000000,270.00000000,90.00000000);
    CreateObject(3095,-1930.14807129,165.25106812,29.31093788,90.00000000,270.00000000,90.00000000);
    CreateObject(3095,-1925.03967285,165.36193848,29.32902336,90.00000000,270.00000000,90.00000000);
    CreateObject(16093,-1939.30920410,118.64165497,29.55428696,0.00000000,0.00000000,180.00000000);
    CreateObject(16093,-1938.78698730,158.75949097,29.36209488,0.00000000,0.00000000,0.00000000);
    CreateObject(3594,-1938.83215332,145.72259521,25.91242599,0.00000000,0.00000000,90.00000000);
    CreateObject(3594,-1939.95532227,130.60821533,25.90461731,0.00000000,0.00000000,90.00000000);
    CreateObject(16638,-1939.35998535,119.70784760,27.92168427,0.00000000,0.00000000,180.00000000);
    CreateObject(16638,-1938.50561523,157.86375427,27.63337517,0.00000000,0.00000000,0.00000000);
    return 1;
    }
Reply
#2

u should do this:
pawn Код:
new Obj1;
Obj1=CreateObject(16638,-1938.50561523,157.86375427,27.63337517,0.00000000,0.00000000,0.00000000);
like that with all of them, Obj1 is the ID for that object.

So for the first 3 lines:

pawn Код:
new Obj1, Obj2, Obj3;
Obj1=CreateObject(3095,-1975.38317871,122.47660065,23.69404984,90.00000000,0.00000000,180.00000000);
Obj2=CreateObject(3095,-1974.81420898,156.96458435,23.69404984,90.00000000,0.00000000,0.00000000);
Obj3=CreateObject(3095,-1960.91845703,138.16474915,30.68750000,0.00000000,90.00000000,180.00000000);
Matthew "6d" Larrabure
Reply
#3

This Is a FilterScript not a game mode lol. (Sorry if that sounded rude)
Reply
#4

Quote:
Originally Posted by ThePwherer
Посмотреть сообщение
This Is a FilterScript not a game mode lol. (Sorry if that sounded rude)
Umm what 6D posted you can do in a Game Mode or Filter Script.
Reply
#5

And?
Filterscript or gamemode, it's the same.
Reply
#6

WAit so Your saying

DestroyObject(Obj1)?
Reply
#7

Quote:
Originally Posted by ThePwherer
Посмотреть сообщение
WAit so Your saying

DestroyObject(Obj1)?
His way would work, but you need many variables, you could do it like this;

pawn Код:
#define MY_OBJECT_LIMIT 24
new Objects[MY_OBJECT_LIMIT];

public OnFilterScriptInit()
{
    new i;
    Objects[i] = CreateObject(3095,-1975.38317871,122.47660065,23.69404984,90.00000000,0.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1974.81420898,156.96458435,23.69404984,90.00000000,0.00000000,0.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1960.91845703,138.16474915,30.68750000,0.00000000,90.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1960.86621094,117.32519531,23.68750000,90.00000000,90.00000000,179.99450684);
    i++;
    Objects[i] = CreateObject(3095,-1960.84082031,127.23242188,24.68750000,90.00000000,90.00000000,179.99450684);
    i++;
    Objects[i] = CreateObject(3095,-1960.81909180,148.95767212,24.68750000,90.00000000,90.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1960.90393066,160.82286072,23.68750000,90.00000000,90.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1979.92443848,138.29560852,24.88750076,90.00000000,90.00000000,0.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1926.58142090,110.22968292,29.28125000,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1934.29687500,110.28515625,29.29999924,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1942.99548340,110.37456512,29.30000114,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1950.40197754,110.39454651,29.29999924,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1957.71618652,110.46925354,29.36874962,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1955.49768066,165.21762085,29.39405060,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1947.70849609,165.22105408,29.39406204,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1939.00646973,165.26200867,29.37344170,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1930.14807129,165.25106812,29.31093788,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1925.03967285,165.36193848,29.32902336,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(16093,-1939.30920410,118.64165497,29.55428696,0.00000000,0.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(16093,-1938.78698730,158.75949097,29.36209488,0.00000000,0.00000000,0.00000000);
    i++;
    Objects[i] = CreateObject(3594,-1938.83215332,145.72259521,25.91242599,0.00000000,0.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3594,-1939.95532227,130.60821533,25.90461731,0.00000000,0.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(16638,-1939.35998535,119.70784760,27.92168427,0.00000000,0.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(16638,-1938.50561523,157.86375427,27.63337517,0.00000000,0.00000000,0.00000000);
    i = 0;
}
Then to destroy all

pawn Код:
for(new i; i < MY_OBJECT_LIMIT; i++)
{
    DestroyObject(Objects[i]);
}
Reply
#8

Quote:
Originally Posted by funky1234
Посмотреть сообщение
His way would work, but you need many variables, you could do it like this;

pawn Код:
#define MY_OBJECT_LIMIT 24
new Objects[MY_OBJECT_LIMIT];

public OnFilterScriptInit()
{
    new i;
    Objects[i] = CreateObject(3095,-1975.38317871,122.47660065,23.69404984,90.00000000,0.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1974.81420898,156.96458435,23.69404984,90.00000000,0.00000000,0.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1960.91845703,138.16474915,30.68750000,0.00000000,90.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1960.86621094,117.32519531,23.68750000,90.00000000,90.00000000,179.99450684);
    i++;
    Objects[i] = CreateObject(3095,-1960.84082031,127.23242188,24.68750000,90.00000000,90.00000000,179.99450684);
    i++;
    Objects[i] = CreateObject(3095,-1960.81909180,148.95767212,24.68750000,90.00000000,90.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1960.90393066,160.82286072,23.68750000,90.00000000,90.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1979.92443848,138.29560852,24.88750076,90.00000000,90.00000000,0.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1926.58142090,110.22968292,29.28125000,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1934.29687500,110.28515625,29.29999924,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1942.99548340,110.37456512,29.30000114,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1950.40197754,110.39454651,29.29999924,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1957.71618652,110.46925354,29.36874962,90.00000000,90.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1955.49768066,165.21762085,29.39405060,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1947.70849609,165.22105408,29.39406204,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1939.00646973,165.26200867,29.37344170,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1930.14807129,165.25106812,29.31093788,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3095,-1925.03967285,165.36193848,29.32902336,90.00000000,270.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(16093,-1939.30920410,118.64165497,29.55428696,0.00000000,0.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(16093,-1938.78698730,158.75949097,29.36209488,0.00000000,0.00000000,0.00000000);
    i++;
    Objects[i] = CreateObject(3594,-1938.83215332,145.72259521,25.91242599,0.00000000,0.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(3594,-1939.95532227,130.60821533,25.90461731,0.00000000,0.00000000,90.00000000);
    i++;
    Objects[i] = CreateObject(16638,-1939.35998535,119.70784760,27.92168427,0.00000000,0.00000000,180.00000000);
    i++;
    Objects[i] = CreateObject(16638,-1938.50561523,157.86375427,27.63337517,0.00000000,0.00000000,0.00000000);
    i = 0;
}
Then to destroy all

pawn Код:
for(new i; i < MY_OBJECT_LIMIT; i++)
{
    DestroyObject(Objects[i]);
}
Well, that's the way.
Reply
#9

Quote:
Originally Posted by 6d
Посмотреть сообщение
Well, that's the way.
Yes, however your using many variables (Obj1, Obj2 etc) whereas im using one and using (in this case 24) cells.
Reply
#10

wait i want to make this in a command form.... i should have mentioned that.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)