Objects looping.
#1

Hey guys,

how can i loop only some specific objects and destroys it when i perform a command?

If you helped me you will be repped!

Thanks in advance.
~karan007
Reply
#2

You want to delete a specific object id ?
Reply
#3

You have to declare them when creating them, a global array is best to do this.
pawn Код:
new MyObject[3]; // Declares the array we're going to use for our objects

public OnGameModeInit()
{
    MyObject[0] = CreateObject( ... );
    MyObject[1] = CreateObject( ... );
    MyObject[2] = CreateObject( ... );
    // Creates 3 objects, and defines them
}

CMD:mycommand(playerid, params[])
{
    for(new i = 0; i < 3; i ++) // Loops 2 times
    {
        DestroyObject(MyObject[i]); // Destroys the objects
    }
}
Reply
#4

Thanks alot! it works!

Giving you reps later as i don't have one right now lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)