SetElementLighting: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 19: | Line 19: | ||
==Example== | ==Example== | ||
This example sets the lighting value of all players and vehicles to 10 | |||
<syntaxhighlight lang="lua">addEventHandler("onClientPedsProcessed",root,function() | <syntaxhighlight lang="lua">addEventHandler("onClientPedsProcessed",root,function() | ||
for _, v in pairs(getElementsByType('player')) do | for _, v in pairs(getElementsByType('player')) do | ||
setElementLighting(v, 10) | setElementLighting(v, 10) | ||
end | end | ||
for _, v in pairs(getElementsByType('vehicle')) do | for _, v in pairs(getElementsByType('vehicle')) do | ||
setElementLighting(v, 10) | setElementLighting(v, 10) | ||
end | end | ||
end)</syntaxhighlight> | end)</syntaxhighlight> | ||
This example sets the lighting value to 10 only for our player, while keeping other players at the default value. | |||
<syntaxhighlight lang="lua">addEventHandler("onClientPedsProcessed",root,function() | <syntaxhighlight lang="lua">addEventHandler("onClientPedsProcessed",root,function() | ||
setElementLighting(localPlayer, 10) | setElementLighting(localPlayer, 10) | ||
end)</syntaxhighlight> | end)</syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Client element functions}} | {{Client element functions}} |
Latest revision as of 09:24, 6 January 2025
Syntax
bool setElementLighting ( element theElement, float lighting )
OOP Syntax Help! I don't understand this!
- Method: element:setLighting(...)
- Variable: .lighting
- Counterpart: getElementLighting
Required Arguments
- theElement: The element whose lighting you want to change.
- lighting: The lighting value that you want to set.
Returns
Returns true if the function was successful, false otherwise. This function can fail if called right after element creation.
Example
This example sets the lighting value of all players and vehicles to 10
addEventHandler("onClientPedsProcessed",root,function() for _, v in pairs(getElementsByType('player')) do setElementLighting(v, 10) end for _, v in pairs(getElementsByType('vehicle')) do setElementLighting(v, 10) end end)
This example sets the lighting value to 10 only for our player, while keeping other players at the default value.
addEventHandler("onClientPedsProcessed",root,function() setElementLighting(localPlayer, 10) end)
See Also
- getElementBoneMatrix
- getElementBonePosition
- getElementBoneRotation
- getElementBoundingBox
- getElementDistanceFromCentreOfMassToBaseOfModel
- getElementLighting
- getElementRadius
- isElementCollidableWith
- isElementLocal
- isElementOnScreen
- isElementStreamable
- isElementStreamedIn
- isElementSyncer
- isElementWaitingForGroundToLoad
- setElementBoneMatrix
- setElementBonePosition
- setElementBoneRotation
- setElementCollidableWith
- setElementStreamable
- updateElementRpHAnim
- Shared
- 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