Posts: 579
Threads: 18
Joined: Apr 2017
Reputation:
0
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.
Posts: 1,266
Threads: 6
Joined: Oct 2014
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.
Posts: 1,266
Threads: 6
Joined: Oct 2014
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....
Posts: 579
Threads: 18
Joined: Apr 2017
Reputation:
0
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?
Posts: 1,266
Threads: 6
Joined: Oct 2014
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);
}