GetElementColShape: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Remove spaces) |
||
(One intermediate revision by one other user not shown) | |||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
colshape getElementColShape ( element theElement ) | colshape getElementColShape ( element theElement ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:getColShape|colShape|}} | {{OOP||[[element]]:getColShape|colShape|}} | ||
Line 46: | Line 46: | ||
{{Element_functions}} | {{Element_functions}} | ||
[[ar:getElementColShape]] | |||
[[en:getElementColShape]] | |||
[[hu:getElementColShape]] | [[hu:getElementColShape]] |
Latest revision as of 18:45, 29 October 2023
Some elements have an associated colshape, for example Marker and Pickup. This function is used to get the associated colshape.
Syntax
colshape getElementColShape ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:getColShape(...)
- Variable: .colShape
Required Arguments
- theElement: The element you want to get the colshape of
Returns
Returns colshape of the element, false if not or an invalid argument was passed to the function.
Example
Click to collapse [-]
ServerThis example creates a marker inside Toreno's house and adds a command to check whether you are standing on it.
theMarker = createMarker( -687.9, 937.8, 13.6, "cylinder", 2.0, 255, 0, 0, 80 ) -- create a red cylinder marker inside Toreno's house function checkOnMarker ( thePlayer ) local isIn = isPlayerInMarker( thePlayer, theMarker ) -- use the function to check if player is in the marker if isIn then outputChatBox( "You are on the marker.", thePlayer ) else outputChatBox( "You are not on the marker.", thePlayer ) end end addCommandHandler ( "amionmarker", checkOnMarker ) -- define the isPlayerInMarker function function isPlayerInMarker( thePlayer, theMarker ) local theShape = getElementColShape( theMarker ) -- get markers colshape if isElementWithinColShape( thePlayer, theShape ) then -- check if the player is in it return true else -- he isn't on the marker return false end end
See Also
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement