fivem-hypnonema icon indicating copy to clipboard operation
fivem-hypnonema copied to clipboard

[FEATUREREQUEST] Autoplay on Server Startup

Open mikrolai opened this issue 3 years ago • 2 comments

Hi dude, first at all ur script is awesome and im very thankful for it! Can u add an option so hypnonema plays a video (that can be set in the config for example) automatically on server startup?

So we dont have to start it manually.

mikrolai avatar Feb 27 '22 10:02 mikrolai

You Could use the new exports he has added, Example:

Citizen.CreateThread(function()
    while not exports or not exports['hypnonema'] do Wait(1) end
    local URLTOPLAY = 'https://www.linktovideo.com/video,mp4'
    local screens = json.decode(exports.hypnonema:getScreenList())
    for k, v in pairs(screens) do
        if v.Name ~= nil then
            exports.hypnonema:play(v.Name, URLTOPLAY)
        end
    end
end)

Please note i have not tested this as i was not at a computer, but it seems correct at first glance :)

Simply just add this inside any server side file to run immediately on server startup, and your good,

I have edited to ensure the exports for hypnonema is ready before executing

Rosw3lluk avatar Mar 01 '22 09:03 Rosw3lluk

I'll implement it. This will come next after I finished the schedulable playback feature.

all-in-simplicity avatar Apr 30 '22 16:04 all-in-simplicity