Developer

2 min readUpdated 3 weeks ago

Overview

ML MasterVideo provides client exports for accessing scene data and controlling the HUD, server exports for initialization status, and handler hooks in the open/ folder.

Client Exports

lua
1local sceneManager = exports.ml_mastervideo:GetSceneManager()
2local playback = exports.ml_mastervideo:GetPlaybackModule()
3local scene = exports.ml_mastervideo:GetSceneById(sceneId)
4local current = exports.ml_mastervideo:GetCurrentSceneData()
5local synced = exports.ml_mastervideo:GetSyncedScenesModule()
6exports.ml_mastervideo:SetHudActive(false)
7local active = exports.ml_mastervideo:IsHudActive()
  • GetSceneManager(): Returns the SceneManager module for direct entity control
  • GetPlaybackModule(): Returns the Playback module for starting scenes programmatically
  • GetSceneById(sceneId): Returns scene data by ID
  • GetCurrentSceneData(): Returns the currently loaded scene
  • GetSyncedScenesModule(): Returns the SyncedScenes module
  • SetHudActive(active): Show/hide the editor HUD
  • IsHudActive(): Returns true if the HUD is visible

Server Exports

lua
1local ready = exports.ml_mastervideo:IsInitialized()
2local count = exports.ml_mastervideo:GetSceneCount()
  • IsInitialized(): Returns true when the database is ready
  • GetSceneCount(): Returns the number of stored scenes

Server Handlers

Located in open/server.lua.

open/server.lua
1function OpenServer.BeforeGiveItem(src, item, amount)
2    return true
3end
4
5function OpenServer.OnActionComplete(src, actionType, data)
6end

Client Handlers

Located in open/client.lua.

open/client.lua
1function OpenClient.BeforeOpenUI(data)
2    return true -- return false to block
3end
4
5function OpenClient.Notify(message, type)
6    Bridge.Notify(message, type)
7end

Shared Handlers

Located in open/shared.lua.

open/shared.lua
1function OpenHandlers.OnPlayerAction(src, data)
2    return true
3end
4
5function OpenHandlers.ValidateAction(src, actionType)
6    return true
7end

Scene Data Structure

Each scene contains entities, camera tracks, and a timeline:

  • Entities: Peds, vehicles, and props with position, appearance, and behavior (idle, animation, scenario, driving, recorded path)
  • Camera Tracks: Named tracks with keyframes (position, rotation, FOV, interpolation mode: linear/smooth/ease_in_out)
  • Timeline: Clips per entity with start time, duration, animation/scenario/recording references

Examples

your_script/client.lua
1local playback = exports.ml_mastervideo:GetPlaybackModule()
2playback.StartScene('my_scene_id', { countdown = 0 })
your_script/client.lua
1exports.ml_mastervideo:SetHudActive(false)
2-- ... run cutscene ...
3exports.ml_mastervideo:SetHudActive(true)