SA-MP Forums Archive
GetDynamicObjectPos returns old location after moving with SelectObject - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetDynamicObjectPos returns old location after moving with SelectObject (/showthread.php?tid=665613)



GetDynamicObjectPos returns old location after moving with SelectObject - OneMillion - 10.04.2019

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?


Re: GetDynamicObjectPos returns old location after moving with SelectObject - Freaksken - 10.04.2019

Are you using OnPlayerSelectObject instead of OnPlayerSelectDynamicObject by any chance?


Re: GetDynamicObjectPos returns old location after moving with SelectObject - Ferman - 11.04.2019

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.


Re: GetDynamicObjectPos returns old location after moving with SelectObject - OneMillion - 11.04.2019

Quote:
Originally Posted by Freaksken
Посмотреть сообщение
Are you using OnPlayerSelectObject instead of OnPlayerSelectDynamicObject by any chance?
I am using EditDynamicObject and OnPlayerEditDynamicObject.


Re: GetDynamicObjectPos returns old location after moving with SelectObject - OneMillion - 11.04.2019

Quote:
Originally Posted by Ferman
Посмотреть сообщение
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.