Removing all objects from a certain world. -
iLearner - 22.07.2017
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.
Re: Removing all objects from a certain world. -
jlalt - 22.07.2017
You can use streamer set functions.
PHP код:
native Streamer_SetFloatData(type, STREAMER_ALL_TAGS id, data, Float:value);
native Streamer_SetIntData(type, STREAMER_ALL_TAGS id, data, value);
native Streamer_SetArrayData(type, STREAMER_ALL_TAGS id, data, 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.
Re: Removing all objects from a certain world. -
Vince - 22.07.2017
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?
Re: Removing all objects from a certain world. -
iLearner - 22.07.2017
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
Re: Removing all objects from a certain world. -
jlalt - 22.07.2017
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(980, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); // create the object on world -1 [ all ]
for(new i = 0; i < 100; i++) // 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_OBJECT, objectid, E_STREAMER_WORLD_ID, varworlds); // 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....
Re: Removing all objects from a certain world. -
iLearner - 22.07.2017
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?
Re: Removing all objects from a certain world. -
jlalt - 22.07.2017
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 i = 0; i < objects; i++)
{
Streamer_SetArrayData(STREAMER_TYPE_OBJECT, i, E_STREAMER_WORLD_ID, varworlds);
}
Re: Removing all objects from a certain world. -
Vince - 22.07.2017
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.
Re: Removing all objects from a certain world. -
iLearner - 22.07.2017
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.
Re: Removing all objects from a certain world. -
NaS - 22.07.2017
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 i = 0; i < objects; i++)
{
Streamer_SetArrayData(STREAMER_TYPE_OBJECT, i, E_STREAMER_WORLD_ID, varworlds);
}
|
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().