Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-09-29, 17:56


vAnimo

Zielony w luła






Wiek: 20
Na forum: 2453 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 883

Respekt: 70

https://imgur.com/a/5GZAEUV
Po za?adowaniu filmu logowanie si? zamienia w 2 puste editboxy i znika reszta jego tekstur kod: a i pytanie czy da sie odpalic mp4 zamiast tej funkcji playVideo z browserem?
if getElementData(localPlayer, "player:sid") then return end

local root = getRootElement()
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()


local akcja = false

local blurStrength = 10

mojeW,mojeH = 1920, 1080 -- Twoja rozdzielczo?? ekranu u?ywana w MTA:SA
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)
skalaX = (sW/mojeW)
skalaY = (sH/mojeH)
local dxfont0_font = dxCreateFont(":pystories-logowanie/font.ttf", 25*w)

local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")

function dxDrawButton(x, y, w, h, color)
  local color2 = tocolor(0,205,255)
  dxDrawRectangle(x, y, w, h, color, false)
  dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
  dxDrawRectangle(x-0.4660164, y + h-1.6, w+1.5, 2, color2, false)
  dxDrawRectangle(x - 1, y + 2, 1, h - 3, color, false)
  dxDrawRectangle(x + w, y + 2, 1, h - 3, color, false)
end

function roundedRectangle(x, y, w, h, color)
  dxDrawRectangle(x, y, w, h, color, false)
  dxDrawRectangle(x + 2, y - 1, w - 4, 1, color, false)
  dxDrawRectangle(x + 2, y + h, w - 4, 1, color, false)
  dxDrawRectangle(x - 1, y + 2, 1, h - 4, color, false)
  dxDrawRectangle(x + w, y + 2, 1, h - 4, color, false)
end

function renderblur()
    if blur == true then
        dxUpdateScreenSource(myScreenSource)
        
        dxSetShaderValue(blurShader, "ScreenSource", myScreenSource);
        dxSetShaderValue(blurShader, "BlurStrength", blurStrength);
        dxSetShaderValue(blurShader, "UVSize", screenWidth, screenHeight);

        dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
    end
end
addEventHandler("onClientRender", root, renderblur)

addEventHandler("onClientResourceStop", resourceRoot,
function()
    if (blurShader) then
        destroyElement(blurShader)
        blurShader = nil
    end
end)

font = dxCreateFont("font.ttf",20) or "defaul-bold"

x,y=1738.69,-1678.98-- my width
intro_step=math.random(0,100)

local zoom = 1.2 -- size GUI
local baseX = 1920 -- width GUI
local minZoom = 2 -- minisize GUI

local sx,sy=guiGetScreenSize()
local screenW, screenH = guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }

if screenW < baseX then
    zoom = math.min(minZoom, baseX/screenW)
end

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end
local dist = 900
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
    local a = math.rad(10 - angler)
    local dx = math.cos(a) * dist;
    local dy = math.sin(a) * dist;
    return x+dx, y+dy;
end

function renderLoginBox()
    --blur = true
        dxDrawImage(310*w, 189*h, 1300*w, 700*h, ":pystories-logowanie/gitowa.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    --exports["Blur"]:dxDrawBluredRectangle(screenW * 0.3637, screenH * 0.0000, screenW * 0.2702, screenH * 1.0000, tocolor(150, 150, 150, 255), false)


    if data.info then dxDrawText(data.info,340*w, 119*h, 1577*w, 205*h, tocolor(0, 0, 0, 255), 1.30, font, "center", "center", false) 
dxDrawText(data.info,340*w-1, 119*h-1, 1577*w-1, 205*h-1, tocolor(255, 255, 255, 255), 1.30, font, "center", "center", false) end

    if not isMouseIn(400*w, 645*h, 378*w, 102*h) then dxDrawImage(386*w, 635*h, 400*w, 110*h, "zax.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else dxDrawImage(386*w, 635*h, 400*w, 110*h, "zai.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end

    if not isMouseIn(1137*w, 653*h, 384*w, 97*h) then dxDrawImage(1125*w, 638*h, 400*w, 110*h, "zrx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else dxDrawImage(1125*w, 638*h, 400*w, 110*h, "zri.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end
end




function playVideo (posX, posY, width, height, url, duration, canClose, postGUI)
    if not posX or not posY or not width or not height or not url then
        return false
    end
    local webBrowser = false
    closeButton = guiCreateButton ( 0.2859,  0.6769, 0.1734, 0.1250, "X", true)
    guiSetAlpha (closeButton, 0.5)
    guiSetVisible (closeButton, false)
    if not isElement (webBrowser) then
        webBrowser = createBrowser (width, height, false, false)
        function createVideoPlayer ()
            function webBrowserRender ()
                dxDrawImage (posX, posY, width, height, webBrowser, 0, 0, 0, tocolor(255,255,255,255), postGUI)
            end
            loadBrowserURL (webBrowser, url)
            
            setTimer (function()
                addEventHandler ("onClientRender", getRootElement(), webBrowserRender)
                showChat (false)
                if canClose then
                    guiSetVisible (closeButton, true)
                    showCursor (true)
                end
            end, 500, 1)
            setElementFrozen (localPlayer, true)
            if duration then
                videoTimer = setTimer (function()
                    removeEventHandler ("onClientRender", getRootElement(), webBrowserRender)
                    setElementFrozen (localPlayer, false)
                    guiSetVisible (closeButton, false)
                    destroyElement (webBrowser)
                end, duration, 1)
            end
            
            addEventHandler ("onClientGUIClick", closeButton, function (button, state)
                if button == "left" then
                    if isTimer (videoTimer) then
                        killTimer (videoTimer)
                        videoTimer = nil
                        removeEventHandler ("onClientRender", getRootElement(), webBrowserRender)
                        setElementFrozen (localPlayer, false)
                        guiSetVisible (closeButton, false)
                        destroyElement (webBrowser)
                    end
                end
            end, false)
        end
        setTimer (createVideoPlayer, 500, 1)
    end
end

addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(400*w, 645*h, 378*w, 102*h) and data.showed then
        if akcja then return end
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) < 2 or string.len(pass) < 2 then
                data.info="Wypelnij wszystkie pola!"
                return
            end
            triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
        akcja = true
        setTimer(function() akcja = false end, 5000,1)
        end
        if isMouseIn(1137*w, 653*h, 384*w, 97*h) and data.showed then
        if akcja then return end
            local login=guiGetText(data.button[1])
            local pass=guiGetText(data.button[2])
            if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
                data.info="Login/Haslo musza miec\nod 3 do 22 znakow."
                return
            end
            triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
        akcja = true
        setTimer(function() akcja = false end, 5000,1)
        end
    end
end)

addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
    if not info then info="" end
    if value then
        data.showed=false
        showZones(data.misc)
        
        -- Usuwamy elementy
        destroyElement(data.button[1])
        destroyElement(data.button[2])
        removeEventHandler("onClientRender", root, renderLoginBox)
    else
        data.info=tostring(info)
        setTimer(function() data.info=nil end, 3000, 1)
    end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
    playVideo (0, 0, screenW, screenH, "https://www.youtube.com/embed/K6pTnhOCmBQ?autoplay=1&showinfo=0&rel=0&controls=0&disablekb=1", 300000, false, false)
    addEventHandler("onClientRender", root, film)
    showChat(false)
    showCursor(true)
    fadeCamera(true)
    data.showed=true
    --setElementAlpha(localPlayer,0)
    local los = math.random(1,1)
     if los == 1 then
   --data.misc = playSound("muzyka/muza1.mp3", true)
  -- tytul = "&#9835; My Songs Know What You Did In The Dark &#9835;"
     elseif los == 2 then
   data.misc = playSound("muzyka/muza2.mp3", true)
  -- tytul = "&#9835; Memories (KSHMR Remix) &#9835;"
     elseif los == 3 then
   data.misc = playSound("muzyka/muza3.mp3", true)
 --tytul = "&#9835; Aero Chord - Wanchu Back [Monstercat Release] &#9835;"
     elseif los == 4 then
   data.misc = playSound("muzyka/muza4.mp3", true)
   --tytul = "&#9835; why mona - Wannabe (Spice Girls Cover) &#9835;"
end
    --setSoundVolume(muza, 4.0)
    showPlayerHudComponent("all",false)
    guiSetInputMode("no_binds_when_editing")
    setElementData(localPlayer,"status","Loguje sie")
    --setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender", root, renderLoginBox)
    data.button[1]=guiCreateEdit(400*w, 289*h, 1115*w, 101*h, "", false)
    data.button[2]=guiCreateEdit(400*w, 467*h, 1115*w, 101*h, "", false)
    guiEditSetMasked(data.button[2],true)
end)


Postaw piwo autorowi tego posta
 

 
Tagi: funkcja :: playvideo :: logowaniu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » funkcja playVideo w logowaniu Odpowiedz do tematu

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku