OnClientElementStreamOut: Difference between revisions
Jump to navigation
Jump to search
m (→Source) |
No edit summary |
||
Line 9: | Line 9: | ||
This example shows you how to tell player that a marker was streamed out and the distance between player and the marker. | This example shows you how to tell player that a marker was streamed out and the distance between player and the marker. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addEventHandler( "onClientElementStreamOut", | addEventHandler( "onClientElementStreamOut", root, | ||
function ( ) | function ( ) | ||
if getElementType( source ) == "marker" then | if getElementType( source ) == "marker" then | ||
local myPosTab = { getElementPosition( | local myPosTab = { getElementPosition( localPlayer ) }; | ||
local markerPosTab = { getElementPosition( source ) }; | local markerPosTab = { getElementPosition( source ) }; | ||
local distance = getDistanceBetweenPoints3D( unpack( myPosTab ), unpack( markerPosTab ) ); | local distance = getDistanceBetweenPoints3D( unpack( myPosTab ), unpack( markerPosTab ) ); |
Revision as of 14:51, 19 July 2020
This event is triggered whenever a physical element is streamed out. This is triggered for all elements that are streamable, such as players, peds, vehicles, objects and markers when the local player is leaving the element. When this event is triggered, that element is no longer physical and is now virtualized by MTA.
Source
The source of this event is the element that streamed out.
Example
This example shows you how to tell player that a marker was streamed out and the distance between player and the marker.
addEventHandler( "onClientElementStreamOut", root, function ( ) if getElementType( source ) == "marker" then local myPosTab = { getElementPosition( localPlayer ) }; local markerPosTab = { getElementPosition( source ) }; local distance = getDistanceBetweenPoints3D( unpack( myPosTab ), unpack( markerPosTab ) ); outputChatBox( "A marker has just streamed out. Distance to the marker: " .. 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