RuSO Posted February 15, 2015 Share Posted February 15, 2015 Bueno quería pedir ayuda con un problemita que tengo ya que hice una ventana con dxDraw y mi idea era como una ventana de bienvenida, ya puse botones para cerrar la venta y otro para salir del servidor pero no se como hacerlo Además que ya he buscado en threads y no he encontrado una situación parecida. Código local screenW, screenH = guiGetScreenSize() acepto = guiCreateButton(403, 649, 116, 28, "I accept", false) declino = guiCreateButton(525, 649, 116, 28, "I decline", false) addEventHandler("onClientRender", root, function() dxDrawRectangle((screenW - 699) / 2, (screenH - 625) / 2, 699, 625, tocolor(0, 136, 255, 200), false) dxDrawText("¡Welcome to our server!", 363, 93, 622, 158, tocolor(255, 255, 255, 255), 3, "default-bold", "center", "center", false, false, true, true, false) dxDrawLine(163, 697, 863, 697, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(163, 697, 863, 697, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(163, 72, 863, 72, tocolor(0, 0, 0, 255), 5, true) dxDrawText("Before you start you should know a few things", 241, 148, 708, 227, tocolor(0, 0, 0, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333You must be respectful with players and admins", 192, 297, 470, 347, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333This is a Race Deathmatch server", 192, 247, 470, 297, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't answer for money or admin rights you need to earn by yourself", 192, 347, 470, 397, tocolor(255, 255, 255, 255), 1.5, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Flood, Cheating, and Glitching isn't allowed in this server", 192, 397, 470, 447, tocolor(255, 255, 255, 255), 1.7, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't be a Dumbass", 192, 447, 470, 497, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't be a Dumbass", 192, 447, 470, 497, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFFHope you enjoy the server->", 241, 653, 519, 703, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF<-Don't go back!", 641, 653, 919, 703, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, true, true, false) showCursor(true) end ) addEventHandler("onClientGUIClick", root, function() if ( source == acepto ) then guiSetVisible( dxDrawRectangle, false) -- Esto no funca o no queda en lo que quiero hacer showCursor(false) end end ) Ya estan los botones pero no se muy bien como esconder los dxDraw Link to comment
alex17 Posted February 15, 2015 Share Posted February 15, 2015 guiSetVisible solo sirve para Gui no para funciones Dx prueba tu panel de esta forma local screenW, screenH = guiGetScreenSize() acepto = guiCreateButton(403, 649, 116, 28, "I accept", false) declino = guiCreateButton(525, 649, 116, 28, "I decline", false) function dxVentana() dxDrawRectangle((screenW - 699) / 2, (screenH - 625) / 2, 699, 625, tocolor(0, 136, 255, 200), false) dxDrawText("¡Welcome to our server!", 363, 93, 622, 158, tocolor(255, 255, 255, 255), 3, "default-bold", "center", "center", false, false, true, true, false) dxDrawLine(163, 697, 863, 697, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(163, 697, 863, 697, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(163, 72, 863, 72, tocolor(0, 0, 0, 255), 5, true) dxDrawText("Before you start you should know a few things", 241, 148, 708, 227, tocolor(0, 0, 0, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333You must be respectful with players and admins", 192, 297, 470, 347, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333This is a Race Deathmatch server", 192, 247, 470, 297, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't answer for money or admin rights you need to earn by yourself", 192, 347, 470, 397, tocolor(255, 255, 255, 255), 1.5, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Flood, Cheating, and Glitching isn't allowed in this server", 192, 397, 470, 447, tocolor(255, 255, 255, 255), 1.7, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't be a Dumbass", 192, 447, 470, 497, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't be a Dumbass", 192, 447, 470, 497, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFFHope you enjoy the server->", 241, 653, 519, 703, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF<-Don't go back!", 641, 653, 919, 703, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, true, true, false) showCursor(true) end function abrir() addEventHandler("onClientRender", root,dxVentana() showCursor(true) end addEventHandler("onClientResourceStart",resourceRoot, abrir) function cerrar() removeEventHandler("onClientRender", root,dxVentana() showCursor(false) end addEventHandler("onClientGUIClick", acepto,cerrar) Link to comment
Enargy, Posted February 15, 2015 Share Posted February 15, 2015 ó simplemente tambien puedes usar este modo(es mas sencillo): local screenW, screenH = guiGetScreenSize() local showGUI = true acepto = guiCreateButton(403, 649, 116, 28, "I accept", false) declino = guiCreateButton(525, 649, 116, 28, "I decline", false) addEventHandler("onClientRender", root, function() if (showGUI) == true then dxDrawRectangle((screenW - 699) / 2, (screenH - 625) / 2, 699, 625, tocolor(0, 136, 255, 200), false) dxDrawText("¡Welcome to our server!", 363, 93, 622, 158, tocolor(255, 255, 255, 255), 3, "default-bold", "center", "center", false, false, true, true, false) dxDrawLine(163, 697, 863, 697, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(163, 697, 863, 697, tocolor(0, 0, 0, 255), 3, true) dxDrawLine(163, 72, 863, 72, tocolor(0, 0, 0, 255), 5, true) dxDrawText("Before you start you should know a few things", 241, 148, 708, 227, tocolor(0, 0, 0, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333You must be respectful with players and admins", 192, 297, 470, 347, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333This is a Race Deathmatch server", 192, 247, 470, 297, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't answer for money or admin rights you need to earn by yourself", 192, 347, 470, 397, tocolor(255, 255, 255, 255), 1.5, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Flood, Cheating, and Glitching isn't allowed in this server", 192, 397, 470, 447, tocolor(255, 255, 255, 255), 1.7, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't be a Dumbass", 192, 447, 470, 497, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF* #333333Don't be a Dumbass", 192, 447, 470, 497, tocolor(255, 255, 255, 255), 2, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFFHope you enjoy the server->", 241, 653, 519, 703, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, true, true, false) dxDrawText("#FFFFFF<-Don't go back!", 641, 653, 919, 703, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "top", false, false, true, true, false) showCursor(true) else return end end ) addEventHandler("onClientGUIClick", root, function() if ( source == acepto ) then showGUI = false showCursor(false) end end ) Link to comment
RuSO Posted February 15, 2015 Author Share Posted February 15, 2015 Muchas gracias los dos, logre hacer que la ventana se cerrara, pero también tengo otra duda, ¿Puedo hacer que cuando den click a Declinar sean kickeados ? Link to comment
Enargy, Posted February 15, 2015 Share Posted February 15, 2015 Sí, usando triggerServerEvent. Link to comment
RuSO Posted February 19, 2015 Author Share Posted February 19, 2015 Un ejemplo de eso ? EDIT: Ya está pero al dar click al botón sale ERROR: Client (Nombre) triggered serverside event kick, but event is not added serverside Link to comment
Enargy, Posted February 19, 2015 Share Posted February 19, 2015 Por ejemplo. ---CLIENTE function clickButton() if ( source == acepto ) then triggerServerEvent("onShowText", localPlayer, "Hola! estoy presionando el click.") end end addEventHandler("onClientGUIClick", root, clickButton) ---SERVER addEvent("onShowText", true) addEventHandler("onShowText", getRootElement(), function(texto) outputChatBox(texto, getRootElement(), 255, 0, 0, true) -- el argumento 'texto' es el mensaje que es recibido del cliente end) Link to comment
Recommended Posts