SA-MP Forums Archive
Way to detect object position while moving - 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: Way to detect object position while moving (/showthread.php?tid=466040)



Way to detect object position while moving - iJumbo - 25.09.2013

Hello.

There is no way to detect object position while moving right? (MoveObject)


Re: Way to detect object position while moving - Konstantinos - 25.09.2013

Wouldn't GetObjectPos return the object's position? I'm not sure if that would work while moving.


Re: Way to detect object position while moving - TonyII - 25.09.2013

Well there actaully is a way, you can do something like this
pawn Код:
new object123;
new Float:ObjX;
new Float:ObjY;
new Float:ObjZ;

//Under a cmd or something
object123= CreateObject(blabla
GetObjectPos(object123, ObjX,ObjY,ObjZ);
SetTimer("ObjectMoved",1000,true);

//
forward ObjectMoved;
public ObjectMoved
{
new Float:X,Float:Y,Float:Z;
GetObjectPos(object123, X,Y,Z);
if(X == ObjX && Y == ObjY && Z == ObjZ)
{
return 1;
}
else
{
SendClientMessage(playerid, -1,"Object moved!");
}
}



Re: Way to detect object position while moving - iJumbo - 25.09.2013

GetDynamicObjectPos i was talking about dynamic streamer plugin sorry.
Actually does not return the right position while the object is moving


Re: Way to detect object position while moving - Konstantinos - 25.09.2013

It might be a bug. It's better to report it to Incognito's thread.

PS: If it's about 1-2 objects, you can use CreateObject instead and try GetObjectPos to see if it works.


Re: Way to detect object position while moving - TonyII - 25.09.2013

Oh, sorry I realize that I'm wrong, but you can do something like this.
pawn Код:
new Float:ObjmoveX;
new Float:ObjmoveY;
new Float:ObjmoveZ;

forward ObjectMoved;
public ObjectMoved
{
new Float:X,Float:Y,Float:Z;
GetDynamicObjectPos(object123, X,Y,Z);
if(X == ObjX && Y == ObjY && Z == ObjZ)
{
return 1;
}
else
{
//This should show the current position of the object while it's moving
GetDynamicObjectPos(object123, ObjmoveX, ObjmoveY,ObjmoveZ);
format(string,sizeof(string),"The current object pos is f%, f%,f&",ObjmoveX,ObjmoveY,ObjmoveZ);
SendClientMessageToAll(string, -1);
//Here you can kill the timer or something
}
}



Re: Way to detect object position while moving - iJumbo - 25.09.2013

Man i know that thanks but that's not the problem.. the object seems to return back when using StopDynamicObject


Re: Way to detect object position while moving - Pottus - 25.09.2013

I know this from experience that the streamer performs very poorly when it comes to moving dynamic objects. I think your trying to get more out of it than it can do.