OnClientElementStreamIn: Difference between revisions
Jump to navigation
Jump to search
(Add parameters section (without parameters)) |
Dutchman101 (talk | contribs) m (Example) |
||
Line 10: | Line 10: | ||
==Example== | ==Example== | ||
This example shows you how to tell player that | This example shows you how to tell player that another player was streamed in and the distance between them and said player | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler( "onClientElementStreamIn", root, | addEventHandler( "onClientElementStreamIn", root, | ||
function ( ) | function () | ||
if getElementType( source ) == " | if getElementType(source) == "player" then | ||
local | local x, y, z = getElementPosition(localPlayer) | ||
local | local xh, xy, xz = getElementPosition(source) | ||
local distance = getDistanceBetweenPoints3D( | local distance = getDistanceBetweenPoints3D(x, y, z, xh, xy, xz ) | ||
outputChatBox( "A | outputChatBox( "A player has just streamed in. Distance to the player: " .. tostring(distance) .."." ) | ||
end | end | ||
end | end | ||
) | ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== |
Revision as of 02:44, 22 January 2023
This event is triggered whenever a physical element is streamed in. This is triggered for all elements that are streamable, such as players, peds, vehicles, objects and markers. When this event is triggered, that element is guaranteed to be physically created as a GTA object.
Parameters
No parameters.
Source
The source of this event is the element that streamed in.
Example
This example shows you how to tell player that another player was streamed in and the distance between them and said player
addEventHandler( "onClientElementStreamIn", root, function () if getElementType(source) == "player" then local x, y, z = getElementPosition(localPlayer) local xh, xy, xz = getElementPosition(source) local distance = getDistanceBetweenPoints3D(x, y, z, xh, xy, xz ) outputChatBox( "A player has just streamed in. Distance to the player: " .. tostring(distance) .."." ) end end )
See Also
Client element events
- onClientElementColShapeHit
- onClientElementColShapeLeave
- onClientElementDataChange
- onClientElementDestroy
- onClientElementDimensionChange
- onClientElementInteriorChange
- onClientElementModelChange
- onClientElementStreamIn
- onClientElementStreamOut
Client event functions
- triggerLatentServerEvent
- triggerServerEvent
- Shared
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled