Object Streamer [STA

This item is free.

🌍 REDM - Object Streamer [Free Script]

Introducing ctrl_streamer, a free and powerful module for dynamic object management in your RedM server. Designed for efficiency and immersion, ctrl_streamer ensures objects spawn and despawn dynamically based on player location, improving performance and gameplay.

Join Our Discord

Key Features:

  • 🔄 Dynamic Object Streaming: Objects spawn and despawn based on player proximity.
  • Optimized Performance: Chunk-based system reduces server and client load.
  • 🔗 Server-Client Sync: Keeps objects consistent for all players.
  • 📂 Custom Metadata: Attach data like ownership or usage info to objects.
  • 🛠️ Easy Object Management: Create, delete, and retrieve objects via simple commands or exports.

How It Works:

  • 🛠️ Server-Side: Tracks all objects, syncing them with clients and managing creation and deletion.
  • 🎮 Client-Side: Streams nearby objects, limits display, and cleans up out-of-range objects.

Examples:

🔨 Creating an Object

Create an object using the server event or export:

TriggerEvent('objectStreamer:createObject', 'prop_chair_01a', 100.0, 200.0, 300.0, 90.0, { owner = 'Player1' })

-- Or using the export
local objectId = exports['ctrl_streamer']:CreateObject('prop_chair_01a', 100.0, 200.0, 300.0, 90.0, { owner = 'Player1' })
print("Object ID:", objectId)
🗑️ Deleting an Object

Delete an object by its unique ID:

TriggerEvent('objectStreamer:deleteObject', 12345678)
🔍 Retrieving Objects
  • Find an Object by ID:
      local object = exports['ctrl_streamer']:GetObjectById(12345678)
      if object then
        print("Object found:", object.model)
      end
      
  • Find an Object by Coordinates:
      local object = exports['ctrl_streamer']:GetObjectByCoords(100.0, 200.0, 300.0)
      if object then
        print("Object found at coordinates:", object.model)
      end
      
  • Retrieve All Cached Objects:
      TriggerServerEvent('objectStreamer:getObjects')
      -- The server will send all objects to the client via the 'objectStreamer:loadObjects' event.
      
⚙️ Advanced Configuration

Customize the client behavior with these configuration options:

  • chunkSize: Size of map chunks for object streaming (default: 75 units).
  • MaxDisplayDistance: Max distance to display objects (default: 50 units).
  • MaxObjectsDisplayed: Limit on objects displayed at once (default: 300).
  • CheckInterval: Time in milliseconds between object checks (default: 1000ms).
📜 Practical Use Cases
Scenario 1: Dynamic Campfire

Allow players to dynamically place campfires:

RegisterCommand('campfire', function(source, args)
    local playerCoords = GetEntityCoords(GetPlayerPed(source))
    TriggerEvent('objectStreamer:createObject', 'p_campfire04x', playerCoords.x, playerCoords.y, playerCoords.z, 0.0, { owner = GetPlayerName(source) })
end)
Scenario 2: Cleanup Nearby Objects

Enable players to delete nearby objects:

RegisterCommand('cleanup', function(source)
    local playerCoords = GetEntityCoords(GetPlayerPed(source))
    local object = exports['ctrl_streamer']:GetObjectByCoords(playerCoords.x, playerCoords.y, playerCoords.z)
    if object then
        exports['ctrl_streamer']:DeleteObject(object.id)
        print("Object deleted:", object.model)
    else
        print("No object found nearby!")uj
    end
end)
Scenario 3: Advanced Metadata Usage

Attach custom metadata to objects for ownership or gameplay:

TriggerEvent('objectStreamer:createObject', 'prop_safe_01', 150.0, 250.0, 50.0, 180.0, { owner = 'Player123', locked = true })
🛠️ Why Use ctrl_streamer?
  • Improved Performance: Efficient object streaming avoids client overload.
  • 🎮 Dynamic Gameplay: Create props, decorations, or interactable objects on-the-fly for immersive scenarios.
  • 🛠️ Customizable: Configure chunks, distances, and limits to suit your server’s unique needs.

Need Help?

Join our Discord for support or questions:

Join Our Discord

FYI: Only limited, non-priority support is offered due to the package price (which is free).