OnClientElementStreamOut: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Add info)
Line 2: Line 2:
__NOTOC__  
__NOTOC__  
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.
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.
Be aware that this event triggers for local player (as itself being the element that got streamed out) when said local player dies and respawns, as this is the removal & recreation of entity local ped.


==Parameters==
==Parameters==

Revision as of 02:58, 22 January 2023

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.

Be aware that this event triggers for local player (as itself being the element that got streamed out) when said local player dies and respawns, as this is the removal & recreation of entity local ped.

Parameters

No parameters.

Source

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

Remarks

This event is not triggered for elements that are streamed-in at the point of a destroyElement call. Use the onClientElementDestroy event in combination with the isElementStreamedIn function to handle such a case.

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


Client event functions