HU/isElementWithinColShape: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Shared function hu}} __NOTOC__ This function is used to determine if an element is within a collision shape. Please note that for legacy reasons, a colshape created on the c...")
 
No edit summary
Line 1: Line 1:
{{Shared function hu}}
{{Shared function hu}}
__NOTOC__
__NOTOC__
This function is used to determine if an element is within a collision shape. Please note that for legacy reasons, a colshape created on the client does not collide with elements already existing at that location until they first move. Please also note that before 1.0.3, this did not function correctly when moving a colshape.
Ez a function arra szolgál, hogy meghatározza, hogy egy elem a collision shape-n belüle van-e. Please note that for legacy reasons, a colshape created on the client does not collide with elements already existing at that location until they first move. Azt is vegye figyelembe, hogy 1.0.3 előtt, ez nem funkcionált megfelelően, amikor a colshape mozgott.


Please note that this function doesn't verify whether element is in the same dimension and interior, additional checks could be implemented manually if they are needed.
Valamint vegye figyelembe, hogy ez a function nem elleőrzni, hogy az elemek azonos dimenzióban és interiorban vannak-e, a további ellenőrzések manuálisan is végrehajthatóak szükség esetén


==Szintaxis==
==Szintaxis==

Revision as of 12:14, 10 October 2018

Ez a function arra szolgál, hogy meghatározza, hogy egy elem a collision shape-n belüle van-e. Please note that for legacy reasons, a colshape created on the client does not collide with elements already existing at that location until they first move. Azt is vegye figyelembe, hogy 1.0.3 előtt, ez nem funkcionált megfelelően, amikor a colshape mozgott.

Valamint vegye figyelembe, hogy ez a function nem elleőrzni, hogy az elemek azonos dimenzióban és interiorban vannak-e, a további ellenőrzések manuálisan is végrehajthatóak szükség esetén

Szintaxis

bool isElementWithinColShape ( element theElement, colshape theShape )

OOP Syntax Help! I don't understand this!

Method: element:isWithinColShape(...)


Kötelező paraméterek

  • theElement: Az elem, amit ellenőriz
  • theShape: A colshape amit ellenőriz

Visszatérési érték

Visszatérési értéke true, ha az elem a colshape-n belül van, egyébként false

Példa

This small script is an example of detecting if a player is within a certain defined colshape. This could serve as a base to perform many functions, rather than just an output.

local circlearea = createColCircle ( 0, 0, 10 )

function ColShapeHit ( thePlayer, matchingDimension )
	local detection = isElementWithinColShape ( thePlayer, circlearea )
	--A variable called 'detection' stores the result of asking if the player
	--who entered a colshape is within the specific colshape called 'circlearea'.
	--The result is either true or false.
	detection = detection and getElementDimension( thePlayer ) == getElementDimension( circlearea )
	--Let's additionally check element dimensions.
	if detection then
		outputChatBox ( getPlayerName(thePlayer).." is in the 'circle area' col shape" )
	end
	--if detection was true then the player is in the col shape. Output a
	--message to confirm this
end
addEventHandler ( "onColShapeHit", root, ColShapeHit )

Lásd még

Fordította