GetElementsWithinColShape
From Multi Theft Auto: Wiki
This function is used to retrieve a list of all elements in a colshape, of the specified type.
Note:
|
Syntax
table getElementsWithinColShape ( colshape theShape [, string elemType = nil ] )
OOP Syntax Help! I don't understand this!
- Method: colshape:getElementsWithin(...)
- Variable: .elementsWithin
Required Arguments
- theShape: The colshape you want to get the elements from.
Optional Arguments
- elemType: The type of element you want a list of. This can be any element type, the common ones being:
- "player": A player connected to the server
- "ped": A ped
- "vehicle": A vehicle
- "object": An object
- "pickup": A pickup
- "marker": A marker
Returns
Returns a table containing all the elements inside the colshape, of the specified type. Returns an empty table if there are no elements inside. Returns false if the colshape is invalid.
Example
This example retrieves a table of players inside a colshape and prints their name to the chat.
local newColShape = createColSphere( 1, 2, 3, 4 ) -- create our new colshape local players = getElementsWithinColShape( newColShape, "player" ) -- get all the players inside the sphere for _, thePlayer in ipairs( players ) do -- use a generic for loop to step through each player outputChatBox( getPlayerName( thePlayer ) .. " is in our new sphere" ) -- print their name to the chat end
Changelog
Version | Description |
---|
1.5.5-3.12286 | Added elementsWithin OOP variable |
See Also
- attachElements
- clearElementVisibleTo
- cloneElement
- createElement
- destroyElement
- detachElements
- getAllElementData
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementCollisionsEnabled
- getElementByID
- getElementByIndex
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementColShape
- getElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementSyncer
- getElementType
- getElementVelocity
- getElementZoneName
- getElementsByType
- getElementsWithinColShape
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementVisibleTo
- isElementWithinColShape
- isElementWithinMarker
- removeElementData
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementSyncer
- setElementVelocity
- setElementVisibleTo
- setLowLODElement