From Multi Theft Auto: Wiki
Revision as of 22:25, 2 April 2018 by Myonlake (talk | contribs) (Source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.


The source of this event is the element that streamed in.


This example shows you how to tell player that a marker was streamed in and the distance between player and the marker.

addEventHandler( "onClientElementStreamIn", getRootElement( ),
    function ( )
        if getElementType( source ) == "marker" then
            local myPosTab = { getElementPosition( getLocalPlayer( ) ) };
            local markerPosTab = { getElementPosition( source ) };
            local distance = getDistanceBetweenPoints3D( unpack( myPosTab ), unpack( markerPosTab ) );
            outputChatBox( "A marker has just streamed in. Distance to the marker: " .. tostring( distance ) .."." );

See Also

Client element events

Client event functions