M MY Multiplayer: Wiki
Side
Kind

onClientElementStreamIn

ClientEvent

Fired when an element streams in on this client and comes into the game world.

addEventHandler("onClientElementStreamIn", root, function() … end)

Source

The player, ped, vehicle, object or sound that streamed in.

Streaming rules

  • World elements (player, ped, vehicle, object): stream in within 250 m of the camera's focus and stream out past 300 m, only in the focused dimension. An element with setElementStreamable(element, false) always stays streamed in.
  • Frame budget: at most 6 elements stream in and 6 stream out per frame.
  • Sounds (sound): stream in when the listener is within 20 m of the sound's maximum distance and stream out past 40 m or outside the focused dimension.

Example

addEventHandler("onClientElementStreamIn", root, function()
    if getElementType(source) == "vehicle" then
        setElementCastShadow(source, true)
    end
end)

See also