+Sommer Posted February 12, 2019 Share Posted February 12, 2019 (edited) local sW, sH = guiGetScreenSize() local x, y = (sW/1366), (sH/768) local font = dxCreateFont("font.ttf", 15) function dxLoginS() dxDrawImage(x*0, y*0, x*1366, y*768, "img/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*0, y*0, x*450, y*768, tocolor(255, 255, 255, 150)) dxDrawRectangle(x*0, y*0, x*450, y*55, tocolor(0, 0, 0, 255)) dxDrawRectangle(x*0, y*55, x*450, y*10, cores[cor]) end addEventHandler("onClientRender", root, dxLoginS) cor = 1 cores = { tocolor(5, 60, 210, alpha), tocolor(0, 210, 255, alpha), tocolor(160, 255, 0, alpha), tocolor(255, 140, 0, alpha), tocolor(255, 50, 50, alpha) } local theTimer = setTimer(function() if (cor < #cores) then cor = cor + 1 else cor = 1 end end, 1400, 0) alpha = 0 alphaState = true function alphaFunction() if alphaState == true then alpha = alpha + 10 if alpha >= 255 then alphaState = false end end if alphaState == false then alpha = alpha - 10 if alpha <= 0 then alphaState = true end end end addEventHandler("onClientRender", root, alphaFunction) Olá, recentemente estava tentando fazer um script de login (já estudei como vou fazer), porém queria adicionar algumas coisa extras, está é a minha duvida tem como colocar essas duas funções juntas? uma dessas funções faz com que alterne um retangulo de cor. E a outra faz com que mude o alpha, que quando chega a 0 ele retorna a 255 como se tivesse piscando, e queria que funcionassem juntas, TIPO ELE ALTERNE DE COR E AO MESMO TEMPO MUDE SEU ALPHA. Se poderem me ajudar agradeço. OBSERVAÇÃO: Esse código foi testado e ele está apenas alternando de cor. Edited February 12, 2019 by +Sommer Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 Acho que você pode usar essa linha. Para entender como ela funciona por favor leia com atenção a Página de explicação dela.InterpolateBetween ---Line função que abre o painel login tick = getTickCount() -- Line dentro da função que se encontra painel Login local Op = interpolateBetween(0, 0, 0, 255, 0, 0, ((getTickCount() - tick) / 2000), "SineCurve") dxDrawRectangle(707, 694, 225, 47, tocolor(0, 255, 0, Op), false) Ela vai ficar indo e vindo sempre e irá demorar 2 Segundos. Vai de 0 até 255 e retornara a 0. Não sei se é isso que procura.. Mas deve ajudar Meu comentário foi útil? Deixe um thanks Link to comment
+Sommer Posted February 12, 2019 Author Share Posted February 12, 2019 Olha é parecido, mas não funciona, pois ainda só alterna de cor mas o alpha continua em 255 Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 Como está fazendo pro seu Retângulo mudar de cor? Link to comment
+Sommer Posted February 12, 2019 Author Share Posted February 12, 2019 (edited) 1 minute ago, #DaNiLiN said: Como está fazendo pro seu Retângulo mudar de cor? cor = 1 cores = { tocolor(5, 60, 210, alpha), tocolor(0, 210, 255, alpha), tocolor(160, 255, 0, alpha), tocolor(255, 140, 0, alpha), tocolor(255, 50, 50, alpha) } local theTimer = setTimer(function() if (cor < #cores) then cor = cor + 1 else cor = 1 end end, 1400, 0) Estou utilizando este código Edited February 12, 2019 by +Sommer Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 Ué :\ e no dx? você não mudou nada ? tipo.. dxDrawRectangle(707, 694, 225, 47, Cores, false) ? 1 Link to comment
+Sommer Posted February 12, 2019 Author Share Posted February 12, 2019 (edited) Troquei muei no Dx, troquei no codigo que tu mandou, mas ele só fica trocando de cor mas não altera o alpha Edited February 12, 2019 by +Sommer Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 Você precisa mostrar pra eu apontar onde errou '= Link to comment
+Sommer Posted February 12, 2019 Author Share Posted February 12, 2019 Just now, #DaNiLiN said: Você precisa mostrar pra eu apontar onde errou '= Ata kkkk... local sW, sH = guiGetScreenSize() local x, y = (sW/1366), (sH/768) local font = dxCreateFont("font.ttf", 15) function dxLoginS() dxDrawImage(x*0, y*0, x*1366, y*768, "img/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*0, y*0, x*450, y*768, tocolor(255, 255, 255, 150)) dxDrawRectangle(x*0, y*0, x*450, y*55, tocolor(0, 0, 0, 255)) dxDrawRectangle(x*0, y*55, x*450, y*10, cores[cor]) ---- Retangulo que quero modificar o alpha junatmente com a alternancia de cores end addEventHandler("onClientRender", root, dxLoginS) cor = 1 cores = { tocolor(5, 60, 210, Op), ---- Nome da Variavel Local (OP) Função do InterpolateBetween tocolor(0, 210, 255, Op), tocolor(160, 255, 0, Op), tocolor(255, 140, 0, Op), tocolor(255, 50, 50, Op) ---- Termina aq } local theTimer = setTimer(function() if (cor < #cores) then cor = cor + 1 else cor = 1 end end, 500, 0) tick = getTickCount() local Op = interpolateBetween(0, 0, 0, 255, 0, 0, ((getTickCount() - tick) / 2000), "SineCurve") KKKK Mals, ta ai Link to comment
#DaNiLiN Posted February 12, 2019 Share Posted February 12, 2019 Dei uma mexida aqui e não conseguir fazer desse modo aqui por tabelas... Mas conseguir fazer assim Código tick = getTickCount() local theTimer = setTimer(function() Cor1 = math.random(0,255) Cor2 = math.random(0,255) Cor3 = math.random(0,255) end, 500, 0) function dxLoginS() local Op = interpolateBetween(0, 0, 0, 255, 0, 0, ((getTickCount() - tick) / 1000), "SineCurve") --dxDrawImage(x*0, y*0, x*1366, y*768, "img/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*0, y*0, x*450, y*768, tocolor(255, 255, 255, 150)) dxDrawRectangle(x*0, y*0, x*450, y*55, tocolor(0, 0, 0, 255)) dxDrawRectangle(x*0, y*55, x*450, y*10, tocolor(Cor1, Cor2, Cor3, Op)) ---- Retangulo que quero modificar o alpha junatmente com a alternancia de cores end addEventHandler("onClientRender", root, dxLoginS) As cores serão geradas aleatórias e não por tabelas como tinha feito, Assim deve te satisfazer.. Ou Então aguarde mais um pouco para ver se alguém consegue resolver seu problema.Meu comentário foi útil? Deixe um Thanks 1 Link to comment
+Sommer Posted February 12, 2019 Author Share Posted February 12, 2019 25 minutes ago, #DaNiLiN said: Dei uma mexida aqui e não conseguir fazer desse modo aqui por tabelas... Mas conseguir fazer assim Código tick = getTickCount() local theTimer = setTimer(function() Cor1 = math.random(0,255) Cor2 = math.random(0,255) Cor3 = math.random(0,255) end, 500, 0) function dxLoginS() local Op = interpolateBetween(0, 0, 0, 255, 0, 0, ((getTickCount() - tick) / 1000), "SineCurve") --dxDrawImage(x*0, y*0, x*1366, y*768, "img/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*0, y*0, x*450, y*768, tocolor(255, 255, 255, 150)) dxDrawRectangle(x*0, y*0, x*450, y*55, tocolor(0, 0, 0, 255)) dxDrawRectangle(x*0, y*55, x*450, y*10, tocolor(Cor1, Cor2, Cor3, Op)) ---- Retangulo que quero modificar o alpha junatmente com a alternancia de cores end addEventHandler("onClientRender", root, dxLoginS) As cores serão geradas aleatórias e não por tabelas como tinha feito, Assim deve te satisfazer.. Ou Então aguarde mais um pouco para ver se alguém consegue resolver seu problema.Meu comentário foi útil? Deixe um Thanks Porra mano!!!m foda dms, vlw ae men deu uma aparência top Brigadão msm mano Link to comment
Other Languages Moderators Lord Henry Posted February 13, 2019 Other Languages Moderators Share Posted February 13, 2019 Isso acontece pois é necessário 2 funções separadas com um interpolateBetween em cada uma para poder fazer duas coisas simultâneas, uma do alpha e outra da cor. Se usar a mesma função para 2 coisas diferentes, os valores entrarão em conflito. Link to comment
+Sommer Posted February 14, 2019 Author Share Posted February 14, 2019 Manos só para não abrir outro tópico pois é relacionado ao assunto(mais ou menos mas apliquei as funções deste tópico). Vocês poderiam me informar onde eu errei no debug aparece dois erros que não ser resolver e provavelmente deve ter mais, se poderem me ajudar muito obrigado ERROS! : https://prntscr.com/mktfzd ----------------------------------------------------- cliente.lua local sW, sH = guiGetScreenSize() local x, y = (sW/1366), (sH/768) editBox = {} editBox.__index = editBox editBox.instances = {} function onClientResourceStart() user = editBox.new{} user:setPosition(x*140, y*422, x*235, y*35) user.color = {0,0,0,155} user.font = font user.text = loadLoginFromXML() user.visible = true user.onInput = function() user.color = {255,140,0,155} end user.onOutput = function() user.color = {0,0,0,155} end pass = editBox.new() pass:setPosition(x*140, y*485, x*235, y*35) pass.color = {0,0,0,155} pass.font = font pass.masked = true pass.visible = true pass.onInput = function() pass.color = {255,140,0,155} end pass.onOutput = function() pass.color = {0,0,0,155} end ------- Register rUser = editBox.new() rUser:setPosition(x*601,y*364,x*213,y*41) rUser.color = {79,86,94,160} rUser.font = font rUser.onInput = function() rUser.color = {87, 95, 104, 160} end rUser.onOutput = function() rUser.color = {79,86,94,160} end rPass = editBox.new() rPass:setPosition(x*601,y*426,x*213,y*41) rPass.color = {79,86,94,160} rPass.font = font rPass.masked = true rPass.onInput = function() rPass.color = {87, 95, 104, 160} end rPass.onOutput = function() rPass.color = {79,86,94,160} end showChat(false) showCursor(true) setPlayerHudComponentVisible("all", true) addEventHandler("onClientRender", root, dxLoginS) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onClientResourceStart) cor = {} function dxLoginS() local fontLogin = dxCreateFont("font_login.ttf", x*15) -- local alpha = interpolateBetween(0, 0, 0, 255, 0, 0, ((getTickCount() - tick) / 2000), "SineCurve") dxDrawImage(x*0, y*0, x*1366, y*768, "img/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*0, y*0, x*500, y*768, tocolor(255, 255, 255, 255)) dxDrawRectangle(x*0, y*0, x*500, y*65, tocolor(39, 37, 38, 255)) dxDrawRectangle(x*0, y*65, x*500, y*15, tocolor(255, 140, 0, 255)) dxDrawImage(x*130, y*125, x*250, y*250, "img/logo.png", getTickCount()/35, 0, 0, tocolor(r, g, b, 255), false) dxDrawText("Painel de Login", x*465, y*35, x*25, y*25, tocolor(255, 255, 255, 255), 1, fontLogin, "center", "center", false, false, false, true, false) dxDrawRectangle(x*140, y*422, x*235, y*35, tocolor(0, 0, 0, 155)) dxDrawRectangle(x*140, y*422, x*15, y*35, tocolor(255, 140, 0, 255)) dxDrawBorder(x*140, y*422, x*235, y*35, tocolor(39, 37, 38, 255), 2) dxDrawImage(x*95, y*422, x*35, y*35, "img/user.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*140, y*485, x*235, y*35, tocolor(0, 0, 0, 155)) dxDrawRectangle(x*140, y*485, x*15, y*35, tocolor(255, 140, 0, 255)) dxDrawBorder(x*140, y*485, x*235, y*35, tocolor(39, 37, 38, 255), 2) dxDrawImage(x*95, y*485, x*35, y*35, "img/password.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) cor[1] = tocolor(0, 0, 0, 155) cor[2] = tocolor(255, 255, 255, 255) if cursorPosition(x*75, y*570, x*150, y*35) then cor[1] = tocolor(255, 140, 0, 255) end if cursorPosition(x*75, y*570, x*150, y*35) then cor[2] = tocolor(0, 0, 0, 255) end dxDrawRectangle(x*75, y*570, x*150, y*35, cor[1]) dxDrawRectangle(x*75, y*570, x*15, y*35, tocolor(255, 140, 0, 255)) dxDrawBorder(x*75, y*570, x*150, y*35, tocolor(39, 37, 38, 255), 2) dxDrawText("Entrar", x*270, y*1150, x*25, y*25, cor[2], 0.8, fontLogin, "center", "center", false, false, false, true, false) cor[3] = tocolor(0, 0, 0, 155) cor[4] = tocolor(255, 255, 255, 255) if cursorPosition(x*265, y*570, x*150, y*35) then cor[3] = tocolor(255, 140, 0, 255) end if cursorPosition(x*265, y*570, x*150, y*35) then cor[4] = tocolor(0, 0, 0, 255) end dxDrawRectangle(x*265, y*570, x*150, y*35, cor[3]) dxDrawRectangle(x*400, y*570, x*15, y*35, tocolor(255, 140, 0, 255)) dxDrawBorder(x*265, y*570, x*150, y*35, tocolor(39, 37, 38, 255), 2) dxDrawText("Registrar", x*640, y*1150, x*25, y*25, cor[4], 0.8, fontLogin, "center", "center", false, false, false, true, false) dxDrawText("Summer Scripting </> © CopyRigth 13/02/2019", x*465, y*1480, x*25, y*25, tocolor(0, 0, 0, 255), 0.6, fontLogin, "center", "center", false, false, false, true, false) for k, self in pairs(editBox.instances) do if self.visible then local px, py, pw, ph = self:getPosition() local text = self.masked and string.gsub(self.text, ".", "•") or self.text local alignX = dxGetTextWidth(text, self.scale, self.font) <= pw and "left" or "right" dxDrawRectangle(px, py, pw, ph, tocolor(unpack(self.color))) dxDrawText(text, px + x*5, py, px - x*5 + pw, py + ph, tocolor(unpack(self.textColor)), self.scale, self.font, alignX, "center", true) if self.input and dxGetTextWidth(text, self.scale, self.font) <= pw then local lx = dxGetTextWidth(text, self.scale, self.font) + px + x*8 local lx = dxGetTextWidth(text, self.scale, self.font) + px + x*8 dxDrawLine(lx, py + y*10, lx, py + ph - y*10, tocolor(255, 255, 255, math.abs(math.sin(getTickCount() / 300))*200), 1) end end end if getKeyState("backspace") then for k, self in pairs(editBox.instances) do if self.visible and self.input then if not keyState then keyState = getTickCount() + 400 self.text = string.sub(self.text, 1, string.len(self.text) - 1) elseif keyState and keyState < getTickCount() then keyState = getTickCount() + 100 self.text = string.sub(self.text, 1, string.len(self.text) - 1) end return end end keyState = nil end cor[5] = tocolor(0, 0, 0, 155) cor[6] = tocolor(255, 255, 255, 255) if cursorPosition(x*820, y*550, x*200, y*40) then cor[5] = tocolor(255, 140, 0, 255) end if cursorPosition(x*820, y*550, x*200, y*40) then cor[6] = tocolor(0, 0, 0, 255) end if not inRegisterTab then dxDrawBorder(x*820, y*410, x*200, y*35, tocolor(39, 37, 38, 255), 2) dxDrawBorder(x*820, y*480, x*200, y*35, tocolor(39, 37, 38, 255), 2) else dxDrawRectangle(x*710, y*185, x*425, y*425, tocolor(255, 255, 255, 255)) dxDrawRectangle(x*710, y*185, x*425, y*50, tocolor(39, 37, 38, 255)) dxDrawRectangle(x*710, y*230, x*425, y*10, tocolor(255, 140, 0, 255)) dxDrawText("Registrar-se", x*1815, y*388, x*25, y*25, tocolor(255, 255, 255, 255), 1, fontLogin, "center", "center", false, false, false, true, false) dxDrawImage(x*860, y*265, x*130, y*130, "img/register_logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*820, y*410, x*200, y*35, tocolor(0, 0, 0, 155)) dxDrawRectangle(x*820, y*410, x*15, y*35, tocolor(255, 140, 0, 255)) dxDrawBorder(x*820, y*410, x*200, y*35, tocolor(39, 37, 38, 255), 2) dxDrawImage(x*770, y*410, x*35, y*35, "img/user.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*820, y*480, x*200, y*35, tocolor(0, 0, 0, 155)) dxDrawRectangle(x*820, y*480, x*15, y*35, tocolor(255, 140, 0, 255)) dxDrawBorder(x*820, y*480, x*200, y*35, tocolor(39, 37, 38, 255), 2) dxDrawImage(x*770, y*480, x*35, y*35, "img/password.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*820, y*550, x*200, y*40, cor[5]) dxDrawRectangle(x*820, y*550, x*200, y*10, tocolor(255, 140, 0, 255)) dxDrawBorder(x*820, y*550, x*200, y*40, tocolor(39, 37, 38, 255), 2) dxDrawText("Criar Conta", x*1818, y*1120, x*25, y*25, cor[6], 0.8, fontLogin, "center", "center", false, false, false, true, false) end end function loginClick(botao, state) if botao == "left" and state == "down" then for k, self in pairs(editBox.instances) do if self.visible then if self.input then self.input = nil self.onOutput() end local x, y, w, h = self:getPosition() if cursorPosition(x, y, w, h) then self.input = true self.onInput() end end end elseif cursorPosition(x*75, y*570, x*150, y*35) then triggerServerEvent("login", getLocalPlayer(), user.text, pass.text, checksave) elseif cursorPosition(x*710, y*185, x*425, y*425) then triggerServerEvent("registrar", getLocalPlayer(), user.text, pass.text) end end addEventHandler("onClientClick", getRootElement(), loginClick) function onClientCharacter(character) if not isCursorShowing() then return end for k, self in pairs(editBox.instances) do if self.visible and self.input then if (string.len(self.text)) < self.maxLength then self.text = self.text..character end end end end addEventHandler("onClientCharacter", getRootElement(), onClientCharacter) tick = getTickCount() local theTimer = setTimer(function() r = math.random(0,255) g = math.random(0,255) b = math.random(0,255) end, 1000, 0) function cursorPosition(x, y, w, h) if (not isCursorShowing) then return false end local sx, sy = guiGetScreenSize() local cx, cy = getCursorPosition() local cx, cy = (cx*sx), (cy*sy) if (cx >= x and cx <= x + w) and (cy >= y and cy <= y + h) then return true else return false end end function editBox.new() local self = setmetatable({}, editBox) self.text = "" self.maxLength = 15 self.scale = y*0.8 self.state = "normal" self.font = font_login self.color = {255,255,255,255} self.textColor = {255,255,255,255} table.insert(editBox.instances, self) return self end function editBox:getPosition() return self.x, self.y, self.w, self.h end function editBox:setPosition(x,y,w,h) self.x, self.y, self.w, self.h = x,y,w,h return true end function loadLoginFromXML() local xml_save_log_File = xmlLoadFile("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end local usernameNode = xmlFindChild(xml_save_log_File, "username", 0) local passwordNode = xmlFindChild(xml_save_log_File, "password", 0) if usernameNode and passwordNode then return xmlNodeGetValue(usernameNode), xmlNodeGetValue(passwordNode) else return "", "" end xmlUnloadFile(xml_save_log_File) end function saveLoginToXML(username, password) local xml_save_log_File = xmlLoadFile("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild(xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue(usernameNode, tostring(username)) end if (password ~= "") then local passwordNode = xmlFindChild(xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue(passwordNode, tostring(password)) end xmlSaveFile(xml_save_log_File) xmlUnloadFile(xml_save_log_File) end addEvent("saveLoginToXML", true) addEventHandler("saveLoginToXML", getRootElement(), saveLoginToXML) function resetSaveXML() local xml_save_log_File = xmlLoadFile("files/xml/userdata.xml") if not xml_save_log_File then xml_save_log_File = xmlCreateFile("files/xml/userdata.xml", "login") end if (username ~= "") then local usernameNode = xmlFindChild(xml_save_log_File, "username", 0) if not usernameNode then usernameNode = xmlCreateChild(xml_save_log_File, "username") end xmlNodeSetValue(usernameNode, "") end if (password ~= "") then local passwordNode = xmlFindChild(xml_save_log_File, "password", 0) if not passwordNode then passwordNode = xmlCreateChild(xml_save_log_File, "password") end xmlNodeSetValue(passwordNode, "") end xmlSaveFile(xml_save_log_File) xmlUnloadFile(xml_save_log_File) end addEvent("resetSaveXML", true) addEventHandler("resetSaveXML", getRootElement(), resetSaveXML) function removeLogin() stopSound( sound ) user.visible = false pass.visible = false guiSetVisible(checkBox1, false) guiSetVisible(checkBox2, false) removeEventHandler("onClientRender", getRootElement(), dxLogin) removeEventHandler("onClientRender", getRootElement(), renderMensagesLogin) removeEventHandler("onClientClick", getRootElement(), loginClick) removeEventHandler("onClientCharacter", getRootElement(), onClientCharacter) showCursor(false) showChat(true) end addEvent("removeLogin", true) addEventHandler("removeLogin", getRootElement(), removeLogin) function dxDrawBorder(posX, posY,posW,posH,color,scale) dxDrawLine(posX, posY, posX+posW, posY, color, scale,false) dxDrawLine(posX, posY, posX, posY+posH, color, scale,false) dxDrawLine(posX, posY+posH, posX+posW, posY+posH, color, scale,false) dxDrawLine(posX+posW, posY, posX+posW, posY+posH, color, scale,false) end mensages = {} messagetick = 0 function servermessagesLogin(message, type) table.insert(mensages, {message, type or "confirm", getTickCount(), dxGetTextWidth(message, fontScale*0.08, fontMsg) + screenW*0.01, 0, 0, 0}) messagetick = getTickCount() end addEvent("servermessagesLogin", true) addEventHandler("servermessagesLogin", getRootElement(), servermessagesLogin) function renderMensagesLogin() local msgd = mensages if #msgd ~= 0 then local startY = screenH*0.5 local i = 1 repeat mData = msgd[i] local drawThis = true if i~= 1 then startY = startY + screenH*0.0425 end if mData[5] == 0 and mData[6] == 0 then mData[5] = - mData[4] - screenW*0.015 mData[6] = startY mData[7] = startY end local tick = getTickCount() - mData[3] local posX, posY, alpha if tick < 1000 then local progress = math.min(tick/1000,1) mData[5] = interpolateBetween(mData[5], 0, 0, 0, 0, 0, progress, "Linear") elseif tick >= 1000 and tick <= 7000 then mData[5] = 0 elseif tick > 7000 then local progress = math.min((tick - 7000)/1000,1) mData[5] = interpolateBetween(mData[5], 0, 0, - mData[4] - mData[4] - screenW*0.015, 0, 0, progress, "Linear") if progress >= 1 then table.remove(msgd, i) drawThis = false messagetick = getTickCount() end end local globalTick = getTickCount() - messagetick if drawThis then mData[7] = startY mData[6] = interpolateBetween(mData[6], 0, 0, mData[7], 0, 0, math.min(globalTick/1000,1), "Linear") posX = mData[5] posY = mData[6] alpha = 255 dxDrawRectangle(posX, posY, mData[4], screenH*0.04, tocolor(0, 0, 0, 100), true) local r, g, b = 0, 255, 0 if mData[2] == "warning" then r, g, b = 255, 0, 0 end dxDrawRectangle(posX + mData[4], posY, screenW*0.006, screenH*0.04, tocolor(r, g, b, alpha), true) dxDrawText(mData[1], posX, posY, posX + mData[4], posY + screenH*0.04, tocolor(255, 255, 255, alpha), fontScale*0.07, fontMsg, "center", "center", false, false, true, false, false) end i = i + 1 until i > #msgd mensages = msgd end end function apagarScript() if fileExists("client.lua") then fileDelete("client.lua") end end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), apagarScript) addEventHandler("onClientPlayerQuit", getRootElement(), apagarScript) addEventHandler("onClientPlayerJoin", getRootElement(), apagarScript) --------------------------------------------------- server.lua function login(username, password, checksave) if not (username == "") then if not (password == "") then local account = getAccount(username, password) if (account ~= false) then logIn(source, account, password) triggerClientEvent(source, "removeLogin", getRootElement()) displayServerMessageLogin(source, "Logado com sucesso", "confirm") if checksave == true then triggerClientEvent(source, "saveLoginToXML", getRootElement(), username, password) else triggerClientEvent(source, "resetSaveXML", getRootElement(), username, password) end else displayServerMessageLogin(source, "Usuario ou senha incorretos", "warning") end else displayServerMessageLogin(source, "Digite sua senha", "warning") end else displayServerMessageLogin(source, "Digite seu nome de usuario", "warning") end end addEvent("login", true) addEventHandler("login", getRootElement(), login) function registrar(username, password) if not (username == "") then if not (password == "") then local account = getAccount(username, password) if (account == false) then local accountAdded = addAccount(tostring(username), tostring(password)) if (accountAdded) then displayServerMessageLogin(source, "Login: "..username.." | Senha: "..password.."", "confirm") else displayServerMessageLogin(source, "Erro, tente novamente", "warning") end else displayServerMessageLogin(source, "Este nome de usuario ja existe", "warning") end else displayServerMessageLogin(source, "Digite sua senha", "warning") end else displayServerMessageLogin(source, "Digite seu nome de usuario", "warning") end end addEvent("registrar", true) addEventHandler("registrar", getRootElement(), registrar) function displayServerMessageLogin(source, message, type) triggerClientEvent(source, "servermessagesLogin", getRootElement(), message, type) end Link to comment
Other Languages Moderators Lord Henry Posted February 14, 2019 Other Languages Moderators Share Posted February 14, 2019 Já tentou traduzir os erros e descobrir oq significam? Link to comment
+Sommer Posted February 14, 2019 Author Share Posted February 14, 2019 11 hours ago, Lord Henry said: Já tentou traduzir os erros e descobrir oq significam? Sim mas não consegui resolvelos 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