SetElementLighting: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
{{New feature/item|3.0161|1.6.0|22862|This function changes the lighting value for the specified [[element]]. This can be a [[player]], [[ped]], [[vehicle]], [[object]], [[Element/Weapon|weapon]].}} | {{New feature/item|3.0161|1.6.0|22862|This function changes the lighting value for the specified [[element]]. This can be a [[player]], [[ped]], [[vehicle]], [[object]], [[Element/Weapon|weapon]].}} | ||
{{Note|Lighting is calculated in real-time, | {{Note|Lighting is calculated in real-time every frame. Therefore, to correctly override the lighting, you should use this function in combination with the [[onClientPedsProcessed]] event, not only for peds, but also for vehicles and objects.}} | ||
==Syntax== | ==Syntax== | ||
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() | |||
for _, v in pairs(getElementsByType('player')) do | |||
setElementLighting(v, 10) | |||
end | |||
for _, v in pairs(getElementsByType('vehicle')) do | |||
setElementLighting(v, 10) | |||
end | |||
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() | |||
setElementLighting(localPlayer, 10) | |||
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