Removing Objects which are in a specific virtual world
#1

Hello.
If I have 500 object, 250 in virtual world ID 0 and 250 in Virtual world ID 1
Is it possible to remove objects which are in virtual world ID 1 without having to define them all and use normal way ?

I've tried this code
Код:
	for(new i; i<MAX_OBJECTS; i++)
	{
		if(IsValidObject(i)) DestroyObject(i);
	}
but that simply removes all objects. :/
Reply
#2

//EDIT: i was wrong, read my next post
Quote:
Originally Posted by XxBaDxBoYxX
Посмотреть сообщение
without having to define them all
no, cuz when removing them, you need to check if theyre in that specific virtual world.
Only possible if you can identify the vw-id by object id

like...
pawn Код:
object[0][0] = createObject(.....
object[0][1] = 4;//virtual world
currently, there is no native function for something like this.
But you could write your own if you really need it
or just hook your create(dynamic)object & make it save the virtual world somewhere
once an object is being created so that it's available for later use.
Reply
#3

The streamer plugin handles this of course.
Reply
#4

ye as pottus said by that first make the objects in world you want add them there again and remove the objects that are already there
Reply
#5

Quote:
Originally Posted by Pottus
Посмотреть сообщение
The streamer plugin handles this of course.
true! i was wrong, so i looked more into it.

here's an example on how some1 could get hold of the virtual world id by
just using the object id.

pawn Код:
new ob = CreateDynamicObject(1804, 0, 0, 0, 0, 0, 0, 3);
    new x = Streamer_GetIntData(STREAMER_TYPE_OBJECT, ob, E_STREAMER_WORLD_ID);
    printf("\nVW: %d",x);
it'll print
VW: 3

so by using the streamer plugin:
pawn Код:
//will destroy every valid object in world 1
    for(new i; i<MAX_OBJECTS; i++)
    {
        if(IsValidDynamicObject(i))
            if(Streamer_GetIntData(STREAMER_TYPE_OBJECT, i, E_STREAMER_WORLD_ID) == 1)// 1 is our virtual world id
                DestroyDynamicObject(i);
    }
Reply
#6

Thanks but If I would define them anyway, I would use the define > remove way.
Thanks anyway.
Reply
#7

Quote:
Originally Posted by XxBaDxBoYxX
Посмотреть сообщение
Thanks but If I would define them anyway, I would use the define > remove way.
Thanks anyway.
you don't have to define them at all.
just use the streamer plugin and do it like in my last post, the one with the for loop at the end
that'll do the trick without defining anything.

first, we check if i is a valid object and then we check if its in a world, specified by us.
then we simply destroy it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)