function for to check 2 points ( area ) - 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: function for to check 2 points ( area ) (
/showthread.php?tid=546482)
function for to check 2 points ( area ) -
ombre - 15.11.2014
Hello,
I need to help.
I have 2 coords: X Y Z = A and X1 Y2 Z2 = B
I want to check if( X Y Z AND X1 Y2 Z2 AND range < 50) so if A and B are close ( < 50 )
I don't want to call the playerid.
Regards.
Re: function for to check 2 points ( area ) -
Kwarde - 15.11.2014
There's a (custom) function to check the distance between two points -Just found it via ******; did you search before asking?-
pawn Код:
stock GetDistance( Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2 )
{
return floatround( floatsqroot( ( ( x1 - x2 ) * ( x1 - x2 ) ) + ( ( y1 - y2 ) * ( y1 - y2 ) ) + ( ( z1 - z2 ) * ( z1 - z2 ) ) ) ) );
}
So, for what you want you could add this:
pawn Код:
stock IsPointNearPoint(Float:aX, Float:aY, Float:aZ, Float:bX, Float:bY, Float:bZ, range = 50)
return GetDistance(aX, aY, aZ, bX, bY, bZ) <= range;
Don't forget to add GetDistance aswell then!
Re : function for to check 2 points ( area ) -
ombre - 16.11.2014
thanks I know but I don't remember regards.