-- ============================================================ -- Eventos de Rede do Cliente | [Metropoles]telao -- Agora recebe elementos (createObject 16000) do servidor -- ============================================================ addEventHandler("onClientResourceStart", resourceRoot, function() outputDebugString("[Metropoles]telao: Resource iniciado no cliente") triggerServerEvent("webplayer:requestSync", resourceRoot) end) -- syncAll: recebe {[id] = element} + URL atual addEvent("webplayer:syncAll", true) addEventHandler("webplayer:syncAll", resourceRoot, function(serverScreens, currentUrl) clearScreens() if type(serverScreens) == "table" then for id, screenElement in pairs(serverScreens) do if isElement(screenElement) then addScreen(id, screenElement) else outputDebugString("[Metropoles]telao: syncAll - elemento inválido para ID " .. tostring(id), 2) end end end if currentUrl and currentUrl ~= "" then playVideoUrl(currentUrl) end end) -- syncOne: novo objeto 16000 criado pelo servidor addEvent("webplayer:syncOne", true) addEventHandler("webplayer:syncOne", resourceRoot, function(id, screenElement) if id and isElement(screenElement) then addScreen(id, screenElement) outputDebugString("[Metropoles]telao: syncOne - tela " .. tostring(id) .. " registrada") else outputDebugString("[Metropoles]telao: syncOne - elemento inválido! ID=" .. tostring(id), 2) end end) -- remove addEvent("webplayer:remove", true) addEventHandler("webplayer:remove", resourceRoot, function(id) removeScreen(id) end) -- play addEvent("webplayer:play", true) addEventHandler("webplayer:play", resourceRoot, function(url) outputDebugString("[Metropoles]telao: play -> " .. tostring(url)) playVideoUrl(url) end) -- stop addEvent("webplayer:stop", true) addEventHandler("webplayer:stop", resourceRoot, function() stopVideo() end)