IsInsideRadarArea: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added documentation page)
 
mNo edit summary
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server client function}}
This function checks if a 2D position is inside a radararea or not.
This function checks if a 2D position is inside a [[radararea|radar area]] or not.
 
{{MessageBox|bordercolorhex=FFB2B2|bgcolorhex=FFE5E5|image=File:Dialog-warning.png|title=Warning:|message= Before 1.5.5 [https://buildinfo.mtasa.com/?Author=&Branch=&Revision=11746 r11746], this function does not always work correctly if dimensions of the radararea (sizeX or sizeY) are negative numbers.}} <!-- The {Warning} template didn't want to work with an external link to buildinfo, so I had to use the {MessageBox} template -->
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool isInsideRadarArea ( radararea theArea, float posX, float posY )
bool isInsideRadarArea ( radararea theArea, float posX, float posY )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[radararea]]:isInside}}


===Required Arguments===  
===Required Arguments===  
Line 26: Line 27:
end
end
</syntaxhighlight>
</syntaxhighlight>
===Issues===
{{Issues|
{{Issue|9699|[Fixed in 1.5.5-r11746] isInsideRadarArea returns always false, when sizeX or sizeY of radarArea is negative}}
}}


==See Also==
==See Also==
{{Radar area functions}}
{{Radar area functions}}

Revision as of 00:07, 2 July 2018

This function checks if a 2D position is inside a radar area or not.

Dialog-warning.png Warning: Before 1.5.5 r11746, this function does not always work correctly if dimensions of the radararea (sizeX or sizeY) are negative numbers.

Syntax

bool isInsideRadarArea ( radararea theArea, float posX, float posY )

OOP Syntax Help! I don't understand this!

Method: radararea:isInside(...)


Required Arguments

  • theArea: The radar area you're checking the position against.
  • posX: The X coordinate of the position you're checking.
  • posY: The Y coordinate of the position you're checking.

Returns

Returns true if the position is inside the radar area, false if it isn't or if any parameters are invalid.

Example

This function checks if an element is within a radar area.

function isElementInsideRadarArea ( theElement, theArea )
	-- get the x, y coordinates from getElementPosition (z gets silently discarded)
	local posX, posY = getElementPosition( theElement )
	-- call isInsideRadarArea with those coordinates and return its result
	return isInsideRadarArea ( theArea, posX, posY )
end

Issues

Issue ID Description
#9699 [Fixed in 1.5.5-r11746] isInsideRadarArea returns always false, when sizeX or sizeY of radarArea is negative

See Also