SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 01/10/2019, 03:11 PM   #1
ShadowMortar
Big Clucker
 
Join Date: Jul 2016
Location: Croatia
Posts: 107
Reputation: 10
Default A question about dynamic actors.

My question is how can I get dynamic actor's current position and if the current position is not that which should be, to update its position.
ShadowMortar is offline   Reply With Quote
Old 01/10/2019, 03:31 PM   #2
Gforcez
Gangsta
 
Gforcez's Avatar
 
Join Date: Jul 2010
Location: The Netherlands.
Posts: 746
Reputation: 418
Default Re: A question about dynamic actors.

Quote:
Originally Posted by ShadowMortar View Post
My question is how can I get dynamic actor's current position and if the current position is not that which should be, to update its position.
Assuming you're using incognito's streamer:

Code:
GetDynamicActorPos(actorid, &Float:x, &Float:y, &Float:z)
You can check that to see if the actor is still in the position it's suppose to be. if not, you can update the position with
Code:
SetDynamicActorPos(actorid, Float:x, Float:y, Float:z)
You can find the natives for Dynamic Actors here: https://github.com/samp-incognito/sa...atives-(Actors)
__________________

Gforcez is offline   Reply With Quote
Old 01/10/2019, 11:27 PM   #3
NaS
High-roller
 
NaS's Avatar
 
Join Date: Mar 2008
Location: 🇩🇪
Posts: 1,651
Reputation: 558
Default Re: A question about dynamic actors.

Quote:
Originally Posted by Gforcez View Post
Assuming you're using incognito's streamer:

Code:
GetDynamicActorPos(actorid, &Float:x, &Float:y, &Float:z)
You can check that to see if the actor is still in the position it's suppose to be. if not, you can update the position with
Code:
SetDynamicActorPos(actorid, Float:x, Float:y, Float:z)
You can find the natives for Dynamic Actors here: https://github.com/samp-incognito/sa...atives-(Actors)
That's useless for what OP was asking. The server doesn't know about any possible position changes if it happens on client-side (since actors sometimes fall through the ground and despawn elsewhere). Get(Dynamic)ActorPos just returns whatever position you gave it in the first place regardless of them falling through the ground or getting pushed away.

You cannot detect if they change positions client-side, what you can do however is update their position in a certain interval (by using GetDynamicActorPos + SetDynamicActorPos in a timer - you can ignore those actors that aren't streamed in for anyone or use a loop that only resets a certain amount of actors per tick to avoid a huge loop).
Also use a low stream distance which makes sure the actors spawn in when the world is most likely loaded. But even that is not perfect, as dynamic actors still use global actors (just streaming those where there's at least 1 player within streaming distance, similar to pickups).

The lower streaming distance will barely have any visual impact, as actors become visible at a pretty low range (their draw distance is much lower than SAMP's streaming distance which is somewhere between 300-400m, so if you use a streaming distance of 150.0 or so it won't make a difference). But that alone doesn't fix the main problem as the stream distance of existing actors is still SAMP's default streaming distance.
NaS 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
Dynamic actors m4karow Scripting Help 3 01/01/2019 09:05 PM
[FilterScript] Dynamic Actors System [MySQL R41-4] KinderClans Filterscripts 5 23/10/2018 07:58 PM
Dynamic job script - actors and saving? TheBigFive Scripting Help 7 12/08/2016 05:18 PM
[FilterScript] Dynamic Actors TwinkiDaBoss Filterscripts 3 14/06/2016 02:22 AM


All times are GMT. The time now is 03:10 AM.


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