distance from player pos
#1

Like I am getting player pos x y and z.. I want to know how can I get players distance from that point after he reaches 1km ingame.. like after he reaches -100$ .. as soon as 1km up -$100.. how can I do it?
Reply
#2

https://en.wikipedia.org/wiki/Distance#Geometry

Quote:

In 2D
Define your two points. Point 1 at (x1, y1) and Point 2 at (x2, y2).

xd = x2-x1
yd = y2-y1
Distance = SquareRoot(xd*xd + yd*yd)

In 3D
Define your two points. Point 1 at (x1, y1, z1) and Point 2 at (x2, y2, z2).

xd = x2-x1
yd = y2-y1
zd = z2-z1
Distance = SquareRoot(xd*xd + yd*yd + zd*zd)

Source: http://freespace.virgin.net/hugo.eli...nes/r_dist.htm

https://sampwiki.blast.hk/wiki/GetPlayerDistanceFromPoint

Код:
Float:GetDistance3D(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
	return VectorSize(x1 - x2, y1 - y2, z1 - z2);
}
Did you sleep at school?
Reply
#3

Quote:

Scripting for money , except Mysql and textdraws , I can script everything.

A very ironic signature.
Reply
#4

Still didn't got The thing I need.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)