samp-streamer-plugin: AttachDynamicObjectToObject bug

I made command that create two dynamic objects, I attach them with AttachDynamicObjectToObject and it works, but when I leave stream radius and come back the attach object is not streamed in(loaded) it disappears. Streamer only load the main object. And it works only when I type command for the first time if I type command again streamer only create me the main object.

My code:

 GetPlayerPos(playerid, X, Y, Z);
 new Mainobject = CreateDynamicObject(19632,X, Y, Z+2,0.000000,0.000000,14.900031);
 new Attachobject = CreateDynamicObject(19614,X, Y, Z-100,0.000000,0.000000,0.000000);
 AttachDynamicObjectToObject(Attachobject,Mainobject,0.009999,-0.220000,-0.599999,0.000000,0.000000,180.000015);

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 26 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, those should all be INVALID_OBJECT_ID.

Sorry, I realized just now that this is backwards. These should actually all be INVALID_STREAMER_ID. We’re attaching dynamic objects, not player objects, so INVALID_OBJECT_ID is still a valid ID. The problem before was that this was inconsistent in the code.

It`s strange, but when I set the PRIORITY(1 to the base object, not -1), everything works well. It means that need to set the priority of the base object higher?

Code: Streamer_SetIntData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_PRIORITY, 1);

@Tagic, @mmimix, @samp-incognito?

when a fix?

Such problem was also in 2.8.2, but if the attached object`s position(global) was defined as 0,0,0(I even made video https://www.youtube.com/watch?v=a48wswSNrwI). If the pos are some coords(near the main object), I have not this issue

In 2.9.0 and 2.9.1 the problem exists any way. Try to compare the code of old and current version to found a changing that causes this problem

Yes, those should all be INVALID_OBJECT_ID. I noticed that earlier as well. #193 is also affected by this.

I did some research (of this and #193). This may be my mistake. I did some cleanup inside the plugin related to IDs definitions (they were pretty messed up) and I think that I messed up few checks. Here are the lines that I think that should be changed:

  1. https://github.com/samp-incognito/samp-streamer-plugin/blob/b5b5257b12c0669b78e8c72528a39fcbf01aea05/src/natives/objects.cpp#L393
  2. https://github.com/samp-incognito/samp-streamer-plugin/blob/b5b5257b12c0669b78e8c72528a39fcbf01aea05/src/streamer.cpp#L1155
  3. https://github.com/samp-incognito/samp-streamer-plugin/blob/b5b5257b12c0669b78e8c72528a39fcbf01aea05/src/streamer.cpp#L1711
  4. https://github.com/samp-incognito/samp-streamer-plugin/blob/b5b5257b12c0669b78e8c72528a39fcbf01aea05/src/manipulation/int.cpp#L722
  5. https://github.com/samp-incognito/samp-streamer-plugin/blob/b5b5257b12c0669b78e8c72528a39fcbf01aea05/src/manipulation/int.cpp#L58

Shouldn’t INVALID_STREAMER_ID be INVALID_OBJECT_ID in all these lines ? Not sure if these are the problems related to this issue, as those are related only to valid ID checking, the OP’s code should work with both INVALID_STREAMER_ID and INVALID_OBJECT_ID.

@samp-incognito, can you take a quick look at this, if this is indeed the problem ?

same problem. It appears since 2.9.0. Please, try founding a solution