PDA

View Full Version : GetDynamicObjectPos returns old location after moving with SelectObject


OneMillion
10/04/2019, 10:29 PM
So I have a system in my server where people can create doors which can be opened and closed.
People can also place the door anywhere to their liking after it has been created with the usage of the SelectObject function.
Problem is, when the door is moved by the player, the new location is not returned by GetDynamicObjectPos.
This results in the door not being openable while standing next to it on it's new location, the door can still be opened while standing on the old location by pressing the open key.

Any idea why the old location of the object is returned and not the new location of the object?

Freaksken
10/04/2019, 10:40 PM
Are you using OnPlayerSelectObject instead of OnPlayerSelectDynamicObject by any chance?

Ferman
11/04/2019, 12:50 AM
Maybe you need to get your cordinates from a callback, example after editing with EditObject you need to use SetObjectPos in OnPlayerEditObject and aftar that you can use GetObjectPos.

OneMillion
11/04/2019, 08:48 AM
Are you using OnPlayerSelectObject instead of OnPlayerSelectDynamicObject by any chance?

I am using EditDynamicObject and OnPlayerEditDynamicObject.

OneMillion
11/04/2019, 08:52 AM
Maybe you need to get your cordinates from a callback, example after editing with EditObject you need to use SetObjectPos in OnPlayerEditObject and aftar that you can use GetObjectPos.

Adding

SetDynamicObjectPos(objectid, x,y,z);
SetDynamicObjectRot(objectid, rx,ry,rz);

To OnPlayerEditDynamicObject fixed it, thank you for your suggestion.