SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/04/2019, 11:29 PM   #1
OneMillion
Little Clucker
 
Join Date: Apr 2017
Location: The Netherlands
Posts: 10
Reputation: 6
Default GetDynamicObjectPos returns old location after moving with SelectObject

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?
OneMillion is offline   Reply With Quote
Old 10/04/2019, 11:40 PM   #2
Freaksken
Gangsta
 
Freaksken's Avatar
 
Join Date: Mar 2009
Location: Belgium
Posts: 501
Reputation: 367
Default Re: GetDynamicObjectPos returns old location after moving with SelectObject

Are you using OnPlayerSelectObject instead of OnPlayerSelectDynamicObject by any chance?
__________________
Always keep in mind that a lot of people are active on this forum in their spare time.
They are sacrificing time they could easily spend on things they would rather do, to help you instead.


[Include] FCNPC A.I. - [Tutorial] Speedometer - [WIP] Single-player-like co-op mission - [Other] List of all my work
Freaksken is offline   Reply With Quote
Old 11/04/2019, 01:50 AM   #3
Ferman
Little Clucker
 
Ferman's Avatar
 
Join Date: Feb 2018
Posts: 21
Reputation: 4
Default Re: GetDynamicObjectPos returns old location after moving with SelectObject

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.
Ferman is offline   Reply With Quote
Old 11/04/2019, 09:48 AM   #4
OneMillion
Little Clucker
 
Join Date: Apr 2017
Location: The Netherlands
Posts: 10
Reputation: 6
Default Re: GetDynamicObjectPos returns old location after moving with SelectObject

Quote:
Originally Posted by Freaksken View Post
Are you using OnPlayerSelectObject instead of OnPlayerSelectDynamicObject by any chance?
I am using EditDynamicObject and OnPlayerEditDynamicObject.
OneMillion is offline   Reply With Quote
Old 11/04/2019, 09:52 AM   #5
OneMillion
Little Clucker
 
Join Date: Apr 2017
Location: The Netherlands
Posts: 10
Reputation: 6
Default Re: GetDynamicObjectPos returns old location after moving with SelectObject

Quote:
Originally Posted by Ferman View Post
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

Code:
SetDynamicObjectPos(objectid, x,y,z);
SetDynamicObjectRot(objectid, rx,ry,rz);
To OnPlayerEditDynamicObject fixed it, thank you for your suggestion.
OneMillion is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GetDynamicObjectPos & OnPlayerShootDynamicObject reading wrong coordinates Fmfan Scripting Help 3 02/04/2019 05:34 PM
GetDynamicObjectPos Banditukas Scripting Help 2 09/02/2015 03:10 PM
Thinking of moving the location of my RP Gamemode (unreleased). Dokins General 10 14/04/2014 05:52 AM
GetDynamicObjectPos & Rot incorrect? Phil_Cutcliffe Scripting Help 2 23/02/2014 01:23 PM
Moving scripted jobs from one location to another. Please help! MisterShady Scripting Help 2 28/08/2013 09:17 PM


All times are GMT. The time now is 07:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.