IsElementWaitingForGroundToLoad: Difference between revisions
Jump to navigation
Jump to search
(Fixed example (?)) |
m (The example it's fixed now, my bad) |
||
Line 1: | Line 1: | ||
{{Server client function}} | {{Server client function}} | ||
__NOTOC__ | __NOTOC__ | ||
Line 22: | Line 21: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function notifyFarRespawn() | function notifyFarRespawn() | ||
if isElementWaitingForGroundToLoad(source) then | |||
outputChatBox("* A " .. getVehicleName(source) .. " respawned far away! Find it quick!", root, 128, 255, 0) | |||
end | |||
end | end | ||
addEventHandler("onVehicleRespawn", root, notifyFarRespawn) | addEventHandler("onVehicleRespawn", root, notifyFarRespawn) |
Revision as of 21:39, 7 August 2014
This function checks if an element is frozen (unable to move without scripting) waiting until a client loads collisions of the area it is in. This allows MTA to automatically freeze vehicles when nobody is near them so they don't fall through the map, for example.
Syntax
bool isElementWaitingForGroundToLoad ( element theElement )
Required arguments
- theElement: the element to check its frozen waiting for collisions to load status. It can be a vehicle, ped or player.
Returns
Returns true if the specified element is frozen waiting for collisions of the area to load. Returns false if it's not or if the specified variable is invalid.
Example
Click to collapse [-]
Serverside exampleThe next code snippet outputs a message when a vehicle respawns far away from players.
function notifyFarRespawn() if isElementWaitingForGroundToLoad(source) then outputChatBox("* A " .. getVehicleName(source) .. " respawned far away! Find it quick!", root, 128, 255, 0) end end addEventHandler("onVehicleRespawn", root, notifyFarRespawn)
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