27.10.2015, 17:56
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?
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) |
Float:GetDistance3D(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2) { return VectorSize(x1 - x2, y1 - y2, z1 - z2); }
Scripting for money , except Mysql and textdraws , I can script everything. |