Removing all objects from a certain world.
#1

Hello, I was trying make like a mini game in my server(its not mini actually), but i've encountered a few problems; i've solved some but still there's a major problem I am unable to solve... main server has alot of objects created in main game almost everywhere. I know there's an option in CreateDynamicObject to create an object in a certian world only but it would take me too much time to go thorough all the mapping and set virtualworld to 0 (currently, by default: -1).

So i was wondering if there's a easier and faster way to remove objects from ground from a certain world (or keep in a certain world only).

Note: using latest version of streamer.
Reply
#2

You can use streamer set functions.

PHP код:
native Streamer_SetFloatData(typeSTREAMER_ALL_TAGS iddataFloat:value);
native Streamer_SetIntData(typeSTREAMER_ALL_TAGS iddatavalue);
native Streamer_SetArrayData(typeSTREAMER_ALL_TAGS iddata, const src[], maxsrc sizeof src); 
type would be
PHP код:
#define STREAMER_TYPE_OBJECT (0) 
id would be object id and data would be E_STREAMER_WORLD_ID

also for loop length you can sue CountDynamicObjects function.

hope that helped : p.
Reply
#3

Quote:
Originally Posted by iLearner
Посмотреть сообщение
but it would take me too much time to go thorough all the mapping and set virtualworld to 0 (currently, by default: -1).
Search and replace doesn't work?
Reply
#4

Quote:
Originally Posted by Vince
Посмотреть сообщение
Search and replace doesn't work?
I never used the virtualworld option in CreateDynamicObject which means its set to -1 by default.
Also replace wouldnt work because there are more tags set to -1 (e.g playerid)

@Jlalt: Can you explain a bit more? i am not familiar with streamer related stuff
Reply
#5

Well iLearner, lets assume that you have an object, which you wanna remove it from world id 100 and keep it in world 0 to 99, would do like below:

PHP код:
    new varworlds[100]; // define var to handle our worlds which object should be visible in 0 - 99 [ size 100 ]
    
new objectid CreateDynamicObject(9800.00.00.00.00.00.0); // create the object on world -1 [ all ]
    
for(new 0100i++) // do a loop to set our var which handle words values
    
{
        
varworlds[i] = i// set world id 0 - 99 value same as their value ex 0 = 0, 1 = 1, etc
    
}
    
Streamer_SetArrayData(STREAMER_TYPE_OBJECTobjectidE_STREAMER_WORLD_IDvarworlds); // set array world value which has value 0 to 99 for the object
    // now object will be visible in world 0 - 99 but not on a world which is grather than 99.... 
Reply
#6

Ok great, but in my case i want to set all possible objects to a certain world.

how can i do that? does streamer has anything for all objects?
Reply
#7

yes as I've mentioned above
Quote:

also for loop length you can sue CountDynamicObjects function.

this will count all the objects you got so the set array function will be in side a loop:
PHP код:
    new objects CountDynamicObjects();
    for(new 
0objectsi++)
    {
        
Streamer_SetArrayData(STREAMER_TYPE_OBJECTiE_STREAMER_WORLD_IDvarworlds);
    } 
Reply
#8

Quote:
Originally Posted by iLearner
Посмотреть сообщение
I never used the virtualworld option in CreateDynamicObject which means its set to -1 by default.
Also replace wouldnt work because there are more tags set to -1 (e.g playerid)
Doesn't matter.

Search: );
Replace: , .virtualworld = 0);

Tick checkbox "in selection". Done.
Reply
#9

Quote:
Originally Posted by Vince
Посмотреть сообщение
Doesn't matter.

Search: );
Replace: , .virtualworld = 0);

Tick checkbox "in selection". Done.
Solved it with an easier way (as jlalt stated).

Jlalt: Thanks my Iranian friend.
Reply
#10

Quote:
Originally Posted by jlalt
Посмотреть сообщение
yes as I've mentioned above


this will count all the objects you got so the set array function will be in side a loop:
PHP код:
    new objects CountDynamicObjects();
    for(new 
0objectsi++)
    {
        
Streamer_SetArrayData(STREAMER_TYPE_OBJECTiE_STREAMER_WORLD_IDvarworlds);
    } 
Streamer_AppendArrayData or RemoveArrayData would be a good way too. That lets you keep all other worlds, if needed of course.

Furthermore the highest Streamer ID isn't neccessarily the number of objects created. Use Streamer_GetUpperBound().
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)