.Doctor Posted February 11, 2019 Share Posted February 11, 2019 (edited) Salve Guys blz? bom manos estou tento problemas com esse meu "sistema de tela de download" bom ele está funcionando mas quando um player termina o download o script continua rodando como posso remove-lo assim que o usuario terminar o download? local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser) addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) addEventHandler("onClientResourceStart", getResourceRootElement(), showPreload); function renderLoaldLogin() if getElementData(getLocalPlayer(),"load_notLogin") then if isTransferBoxActive() then return end setElementData(getLocalPlayer(),"load_notLogin",false) destroyElement(initBrowser) showCursor(false) browser = nil; initBrowser = nil; removeEventHandler("onClientBrowserCreated", getResourceRootElement(), browser); showChat(true) end end addEventHandler("onClientRender", root, renderLoaldLogin) Edited February 11, 2019 by .Doctor Link to comment
#DaNiLiN Posted February 11, 2019 Share Posted February 11, 2019 Reparei que tem 2 Eventos inúteis que não está sendo usado. addEventHandler("onClientResourceStart", getResourceRootElement(), showPreload)addEventHandler("onClientBrowserCreated", browser) Você errou na hora de destruir o elemento gui. Pois tu não destruiu. Tente dessa forma. local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) function renderLoaldLogin() if getElementData(getLocalPlayer(),"load_notLogin") then if isTransferBoxActive() then return end setElementData(getLocalPlayer(),"load_notLogin",false) initBrowser = nil; destroyElement(initBrowser) showCursor(false) browser = nil; removeEventHandler("onClientBrowserCreated", getResourceRootElement(), browser); showChat(true) end end addEventHandler("onClientRender", root, renderLoaldLogin) Foi útil meu comentário? Deixe o thanks 1 Link to comment
.Doctor Posted February 12, 2019 Author Share Posted February 12, 2019 16 minutes ago, #DaNiLiN said: Reparei que tem 2 Eventos inúteis que não está sendo usado. addEventHandler("onClientResourceStart", getResourceRootElement(), showPreload)addEventHandler("onClientBrowserCreated", browser) Você errou na hora de destruir o elemento gui. Pois tu não destruiu. Tente dessa forma. local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) function renderLoaldLogin() if getElementData(getLocalPlayer(),"load_notLogin") then if isTransferBoxActive() then return end setElementData(getLocalPlayer(),"load_notLogin",false) initBrowser = nil; destroyElement(initBrowser) showCursor(false) browser = nil; removeEventHandler("onClientBrowserCreated", getResourceRootElement(), browser); showChat(true) end end addEventHandler("onClientRender", root, renderLoaldLogin) Foi útil meu comentário? Deixe o thanks O Erro Continua :3 local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) function renderLoaldLogin() if getElementData(getLocalPlayer(),"load_notLogin") then if isTransferBoxActive() then return end setElementData(getLocalPlayer(),"load_notLogin",false) initBrowser = nil; destroyElement(initBrowser) showCursor(false) browser = nil; removeEventHandler("onClientBrowserCreated", getResourceRootElement(), browser); showChat(true) end end addEventHandler("onClientRender", root, renderLoaldLogin) Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 Uma pergunta, você testou com um outputChatBox pra ver se a função de quando acabar o download ta funcionando certinho ? :\ 1 Link to comment
.Doctor Posted February 12, 2019 Author Share Posted February 12, 2019 Just now, #DaNiLiN said: Uma pergunta, você testou com um outputChatBox pra ver se a função de quando acabar o download ta funcionando certinho ? Sim, mas a função nao destroi o guibrowser ;3 Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 o Erro dai não e ali pois eu testei com um comando e funfou. function Remove () setElementData(getLocalPlayer(),"load_notLogin",false) showCursor(false) showChat(true) initBrowser = nil browser = nil destroyElement(initBrowser) removeEventHandler("onClientBrowserCreated", getResourceRootElement(), browser) end addCommandHandler("b", Remove) Leia também a funçãoIsTransferBoxActive Acho que tu errou, Acho que não se deve usar onClientRender 1 Link to comment
iDannz [Breno] Posted February 12, 2019 Share Posted February 12, 2019 Boa noite, poderia me dizer onde está o setElementData que seta o "load_notLogin" pro player? Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 @iDannz fiz essa mesma pergunta a ele no discord. Porém dai não sei se o código tá completo e nem levei adiante aqui. 1 Link to comment
.Doctor Posted February 12, 2019 Author Share Posted February 12, 2019 20 minutes ago, #DaNiLiN said: o Erro dai não e ali pois eu testei com um comando e funfou. function Remove () setElementData(getLocalPlayer(),"load_notLogin",false) showCursor(false) showChat(true) initBrowser = nil browser = nil destroyElement(initBrowser) removeEventHandler("onClientBrowserCreated", getResourceRootElement(), browser) end addCommandHandler("b", Remove) Leia também a funçãoIsTransferBoxActive Acho que tu errou, Acho que não se deve usar onClientRender O erro persiste, realmente nao é mais um erro pois li IsTransferBoxActive e agora apenas não desativa resourceRoot = getResourceRootElement() local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) function checkTransfer() if isTransferBoxActive() then setTimer(checkTransfer,2000) -- Check again after 2 seconds else destroyElement(initBrowser) end end addEventHandler("onClientResourceStart",resourceRoot,checkTransfer) Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 Seu seTimer está incompleto. resourceRoot = getResourceRootElement() local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) function checkTransfer() if isTransferBoxActive() then setTimer(checkTransfer,2000, 1) -- Check again after 2 seconds else destroyElement(initBrowser) fadeCamera(true) end end addEventHandler("onClientResourceStart",resourceRoot,checkTransfer) 1 Link to comment
Vazern Posted February 12, 2019 Share Posted February 12, 2019 1 hour ago, .Doctor said: Salve Guys blz? bom manos estou tento problemas com esse meu "sistema de tela de download" bom ele está funcionando mas quando um player termina o download o script continua rodando como posso remove-lo assim que o usuario terminar o download? local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser) addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) addEventHandler("onClientResourceStart", getResourceRootElement(), showPreload); function renderLoaldLogin() if getElementData(getLocalPlayer(),"load_notLogin") then if isTransferBoxActive() then return end setElementData(getLocalPlayer(),"load_notLogin",false) destroyElement(initBrowser) showCursor(false) browser = nil; initBrowser = nil; removeEventHandler("onClientBrowserCreated", getResourceRootElement(), browser); showChat(true) end end addEventHandler("onClientRender", root, renderLoaldLogin) Só fazer uma função que remova esta "tela de carregamento", e exporta-la no script do painel de login. 1 Link to comment
.Doctor Posted February 12, 2019 Author Share Posted February 12, 2019 1 minute ago, Vazern said: Só fazer uma função que remova esta "tela de carregamento", e exporta-la no script do painel de login. Já Foi Resolvido! 4 minutes ago, #DaNiLiN said: Seu seTimer está incompleto. resourceRoot = getResourceRootElement() local sx, sy = guiGetScreenSize() local link = "http://mta/n_Download/html/index.html" local initBrowser = guiCreateBrowser(0, 0, sx, sy, true, false, false) local browser = guiGetBrowser(initBrowser) guiSetInputMode("no_binds_when_editing") addEventHandler("onClientBrowserCreated", browser, function () fadeCamera(false,0) showCursor(true) loadBrowserURL(source, link) end ) function checkTransfer() if isTransferBoxActive() then setTimer(checkTransfer,2000, 1) -- Check again after 2 seconds else destroyElement(initBrowser) fadeCamera(true) end end addEventHandler("onClientResourceStart",resourceRoot,checkTransfer) Thanks bb, Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now