#Silvery' Posted March 29, 2014 Share Posted March 29, 2014 Codigo lua: este es el client-side GUIEditor = { button = {}, edit = {}, } ------ gui buttonguest = guiCreateButton(313, 515, 108, 61, "Play as guest", false) buttonlog = guiCreateButton(399, 428, 168, 61, "Login", false) buttonreg = guiCreateButton(756, 430, 168, 61, "Register", false) loginuser = guiCreateEdit(315, 306, 336, 35, "", false) reguser = guiCreateEdit(675, 306, 336, 35, "", false) logpass = guiCreateEdit(315, 380, 336, 35, "", false) regpass = guiCreateEdit(675, 380, 336, 35, "", false) ------ dx window = dxDrawRectangle(308, 226, 714, 352, tocolor(0, 0, 0, 194), false) titulo = dxDrawRectangle(308, 200, 714, 26, tocolor(6, 120, 200, 179), false) titulotext = dxDrawText("LOGIN PANEL BETA 1.0", 539, 175, 799, 250, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxline = dxDrawLine(660, 226, 660, 577, tocolor(6, 120, 200, 255), 1, false) dxtext = dxDrawText("LOGIN", 318, 236, 646, 260, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxtext2 = dxDrawText("REGISTER", 683, 236, 1012, 259, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxtext3 = dxDrawText("USER", 326, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) dxtext4 = dxDrawText("USER", 1050, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) showCursor(true) function Guest ( ) guiSetVisible(window,false) guiSetVisible(buttonguest,false) guiSetVisible(buttonlog,false) guiSetVisible(buttonreg,false) guiSetVisible(loginuser,false) guiSetVisible(reguser,false) guiSetVisible(logpass,false) guiSetVisible(regpass,false) guiSetVisible(titulo,false) guiSetVisible(titulotext,false) guiSetVisible(dxline,false) guiSetVisible(dxtext,false) guiSetVisible(dxtext2,false) guiSetVisible(dxtext3,false) guiSetVisible(dxtext4,false) showCursor(false) end addEventHandler("onClientGUIClick",buttonguest,Guest,false) function cerrarPanel () guiSetVisible(window,false) guiSetVisible(buttonguest,false) guiSetVisible(buttonlog,false) guiSetVisible(buttonreg,false) guiSetVisible(loginuser,false) guiSetVisible(reguser,false) guiSetVisible(logpass,false) guiSetVisible(regpass,false) guiSetVisible(titulo,false) guiSetVisible(titulotext,false) guiSetVisible(dxline,false) guiSetVisible(dxtext,false) guiSetVisible(dxtext2,false) guiSetVisible(dxtext3,false) guiSetVisible(dxtext4,false) showCursor(false) end addEvent("cerrarPanel",true) addEventHandler("cerrarPanel",getRootElement(),cerrarPanel) function onRegister () local username = guiGetText(loginuser) local password = guiGetText(regpass) if username ~= "" and password ~= "" then triggerServerEvent("register",getLocalPlayer(),getLocalPlayer(),username,password) end end addEventHandler("onClientGUIClick",buttonreg,onRegister,false) function onLogin () local username = guiGetText(loginuser) local password = guiGetText(logpass) if username ~= "" and password ~= "" then triggerServerEvent("login",getLocalPlayer(),getLocalPlayer(),username,password) end end addEventHandler("onClientGUIClick",buttonlog,onLogin,false) un poco largo no bueno el problema es que los dxdraw no aparecen y en el server-side me dice que no esta en UTF-8 y qué lo esta cargando en ANSI ¿Alguna solución? gracias por leer esto. Link to comment
Tomas Posted March 29, 2014 Share Posted March 29, 2014 Tus errores: Los DX como los FX deben ser ejecutados con el evento: onClientRender Por ejemplo: function creartexto ( ) local playerX, playerY, playerZ = getElementPosition ( localPlayer ) - local playerzona= getZoneName ( playerX, playerY, playerZ ) dxDrawText ( playerzona, 44, screenHeight - 41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) function ejecutardx ( ) addEventHandler ( "onClientRender", root, creartexto) -- keep the text visible with onClientRender. end addEventHandler ( "onClientResourceStart", resourceRoot, ejecutardx) Otro: Para cerrar las GUI no es necesario que le agregues tantas líneas al guiSetVisible. Solo con guiSetVisible(VariableWindow, false) ya se cierra todo ya que TODOS estan "attachados" o "pegados" a la window. EDIT: Perdón, recién veo que tu script no esta pegado a la Window, ignora lo anterior e_e Para pasarlo a UTF abre el script con Bloc de notas, guardar como, seleccionas abajo Ansi, en archivo "Otros" y lo guardas con el .lua Suerte! Link to comment
#Silvery' Posted March 29, 2014 Author Share Posted March 29, 2014 tomas lo hice asi mira : addEventHandler("onClientRender", root, function() local window = dxDrawRectangle(308, 226, 714, 352, tocolor(0, 0, 0, 194), false) local titulo = dxDrawRectangle(308, 200, 714, 26, tocolor(6, 120, 200, 179), false) local titulotext = dxDrawText("LOGIN PANEL BETA 1.0", 539, 175, 799, 250, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxline = dxDrawLine(660, 226, 660, 577, tocolor(6, 120, 200, 255), 1, false) local dxtext = dxDrawText("LOGIN", 318, 236, 646, 260, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext2 = dxDrawText("REGISTER", 683, 236, 1012, 259, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext3 = dxDrawText("USER", 326, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext4 = dxDrawText("USER", 1050, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext5 = dxDrawText("USER", 326, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext6 = dxDrawText("USER", 1050, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) end ) lo que pasa ahora es que los dx no desaparecen cuando toco login , play as guest o otros botones... Link to comment
#Silvery' Posted March 29, 2014 Author Share Posted March 29, 2014 PD: Los users repetidos los estoy editando para que sean PASSWORD Link to comment
Alexs Posted March 29, 2014 Share Posted March 29, 2014 Podrías usar: cancelEvent No se si te haz fijado alguna vez en la wiki, pero el evento 'onClientRender' no es cancelable. @Seku utiliza 'removeEventHandler'. Link to comment
#Silvery' Posted March 29, 2014 Author Share Posted March 29, 2014 ¿Algun ejemplo de como podria de hacerlo @Alexs ? Porqué la verdad lei la wiki , nunca use removeEventHandler y no tengo ni minima idea de como hacerlo Link to comment
Alexs Posted March 29, 2014 Share Posted March 29, 2014 ¿Algun ejemplo de como podria de hacerlo @Alexs ?Porqué la verdad lei la wiki , nunca use removeEventHandler y no tengo ni minima idea de como hacerlo Es en realidad sencillo, algo así: function drawWindows() local window = dxDrawRectangle(308, 226, 714, 352, tocolor(0, 0, 0, 194), false) local titulo = dxDrawRectangle(308, 200, 714, 26, tocolor(6, 120, 200, 179), false) local titulotext = dxDrawText("LOGIN PANEL BETA 1.0", 539, 175, 799, 250, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxline = dxDrawLine(660, 226, 660, 577, tocolor(6, 120, 200, 255), 1, false) local dxtext = dxDrawText("LOGIN", 318, 236, 646, 260, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext2 = dxDrawText("REGISTER", 683, 236, 1012, 259, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext3 = dxDrawText("USER", 326, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext4 = dxDrawText("USER", 1050, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext5 = dxDrawText("USER", 326, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) local dxtext6 = dxDrawText("USER", 1050, 281, 636, 308, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, true, false, false) end addEventHandler("onClientRender", root, drawWindows ) function cerrarPanel () guiSetVisible(window,false) showCursor(false) removeEventHandler( 'onClientRender', root, drawWindows ) --los mismos argumentos que en 'addEventHandler'. end Link to comment
#Silvery' Posted March 29, 2014 Author Share Posted March 29, 2014 wow , gracias alexs ya me funciono y una pregunta en algunos paneles la contraseña se ponen como * , como lo puedo hacer yo ( no me juzges recien estoy aprendiendo jaja ) Link to comment
Tomas Posted March 30, 2014 Share Posted March 30, 2014 wow , gracias alexs ya me funciono y una pregunta en algunos paneles la contraseña se ponen como * , como lo puedo hacer yo ( no me juzges recien estoy aprendiendo jaja ) -- Ejemplo de edit: campocontra = guiCreateEdit(1,2,3,4, "", false, Window) guiEditSetMasked ( campocontra, true ) Link to comment
#Silvery' Posted March 30, 2014 Author Share Posted March 30, 2014 listo gracias ya lo termine , luego lo subire a la wiki aunque sea una mierda . gracias axel e-e , y tomas Link to comment
Tomas Posted March 30, 2014 Share Posted March 30, 2014 listo gracias ya lo termine , luego lo subire a la wiki aunque sea una mierda . gracias axel e-e , y tomas Me alegro que hayas deseado compartir el script y que hayas logrado terminarlo! Link to comment
Recommended Posts