SA-MP Forums Archive
Get distance between player and object - 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: Get distance between player and object (/showthread.php?tid=633725)



Get distance between player and object - YouHack - 06.05.2017

Hello,
How I can get the distance between an object and player
Even if the object isn't from a custom map
Like radius in RemoveBuildingForPlayer


Re: Get distance between player and object - SyS - 06.05.2017

use
GetObjectPos(objectid, x, y, z)

to get pos of object

and use GetPlayerDistanceFromPoint(playerid, x, y, z)
to get distance from that coordinates


Re: Get distance between player and object - YouHack - 06.05.2017

and how to get id of that specified object ?


Re: Get distance between player and object - AndreiWow - 06.05.2017

Quote:
Originally Posted by YouHack
Посмотреть сообщение
and how to get id of that specified object ?
new object = CreateDynamic...

object will be the ID


Re: Get distance between player and object - YouHack - 06.05.2017

talking about original objects, not custom