[Request] Police Mission

Started by Kewun, Aug 06, 2016, 07:49 PM

Previous topic - Next topic

Kewun


EK.IceFlake

Quote from: Stormeus on Aug 10, 2016, 05:52 PM
Quote from: Thijn on Aug 07, 2016, 10:13 AMYou don't need to script one since it's already in the squirrel plugin. Vector.Distance(Vector) or DistanceFromPoint( x1, y1, x2, y2 )

You probably want to do player.Pos.Distance(target.Pos) instead.

Quote from: EK.CrystalBlue on Aug 07, 2016, 10:07 AMfunction GetDistance(pos1, pos2)
{
    local dist = 0;
    (pos1.x < pos2.x) ? dist += pos2.x - pos1.x : dist += pos1.x - pos2.x;
    (pos1.y < pos2.y) ? dist += pos2.y - pos1.y : dist += pos1.y - pos2.y;
    (pos1.z < pos2.z) ? dist += pos2.z - pos1.z : dist += pos1.z - pos2.z;
    return dist / 3;
}

This is absolutely mathematically incorrect.
Elaborate.

.

Quote from: EK.CrystalBlue on Aug 10, 2016, 11:08 PMElaborate.

Because:

function GetDistance(pos1, pos2)
{
    return sqrt(pow(pos1.x - pos2.x, 2) + pow(pos1.y - pos2.y, 2) + pow(pos1.z - pos2.z, 2));
}
.

Stormeus

#18
@EK.CrystalBlue Your example suggests that the points (6, 6, 6) and (3, 3, 3) are 1 unit apart from each other. This is clearly erroneous. The Pythagorean method is the only way to accurately find the distance between two points.

EK.IceFlake

Okay, well, ./SLC released a Pythagoras Theorem function, so he can use that instead

Thijn

Quote from: EK.CrystalBlue on Aug 11, 2016, 09:45 PMOkay, well, ./SLC released a Pythagoras Theorem function, so he can use that instead
Like we said before, it's build into the plugin so there's absolutely no reason why you would use the pure-squirrel option.

Thijn

Quote from: vito on Aug 17, 2016, 03:10 PM
Quote from: Thijn on Aug 12, 2016, 06:01 AM
Quote from: EK.CrystalBlue on Aug 11, 2016, 09:45 PMOkay, well, ./SLC released a Pythagoras Theorem function, so he can use that instead
Like we said before, it's build into the plugin so there's absolutely no reason why you would use the pure-squirrel option.
Client-side scripting is that reason...
You shouldn't handle checking critical things on the client side :P
If you're not allowed to do something while being too far away, the server needs to verify that, not the client.

W3aPoN^

Oh Can You Send Me Full Script Of That THANKS