Jump to content

Porque no se muestra mi panel?


iiKings

Recommended Posts

Posted

He estado trabajando con commandhandler para hacer diferentes scripts hasta ahora, pero en este momento quiero hacer gui's y tengo un problema.

	
	addEventHandler("onClientKey",root, function (button, press)
	
	if button == "F2" and press then
	
	 addEventHandler("guiSetVisible", root,function ()
		screenW, screenH = guiGetScreenSize()

        ventanaGangs = guiCreateWindow((screenW - 233) / 2, (screenH - 383) / 2, 233, 383, "Panel Gangs", false)
        guiWindowSetSizable(ventanaGangs, false)
        guiSetAlpha(ventanaGangs, 0.87)

        botonInvitar = guiCreateButton(15, 31, 80, 26, "Invitar", false, ventanaGangs)
        GUIEditor.button[1] = guiCreateButton(143, 31, 80, 26, "", false, ventanaGangs)
        GUIEditor.button[2] = guiCreateButton(15, 82, 80, 26, "", false, ventanaGangs)
        GUIEditor.button[3] = guiCreateButton(143, 82, 80, 26, "", false, ventanaGangs)    
    end
	)
	end
	
	
	end
	)

 

Quiero que cuando el jugador presione f2 se abra el panel, pero no lo consigo.

Posted
 function panel()
    screenW, screenH = guiGetScreenSize()
	if not ventanaGangs  then
      ventanaGangs = guiCreateWindow((screenW - 233) / 2, (screenH - 383) / 2, 233, 383, "Panel Gangs", false)
      guiWindowSetSizable(ventanaGangs, false)
      guiSetAlpha(ventanaGangs, 0.87)

      botonInvitar = guiCreateButton(15, 31, 80, 26, "Invitar", false, ventanaGangs)
      GUIEditor.button[1] = guiCreateButton(143, 31, 80, 26, "", false, ventanaGangs)
      GUIEditor.button[2] = guiCreateButton(15, 82, 80, 26, "", false, ventanaGangs)
      GUIEditor.button[3] = guiCreateButton(143, 82, 80, 26, "", false, ventanaGangs)    
	else
	  guiSetVisible(ventanaGangs, false)
	end
  end
	
 bindKey("f2", "down", panel)

 

Posted (edited)
22 minutes ago, iiKings said:

Gracias, el problema es que despues de una vez de darle a f2 y quitarlo ya no vuelve a aparecer mas.

 function panel()
    screenW, screenH = guiGetScreenSize()
	if not ventanaGangs  then
      ventanaGangs = guiCreateWindow((screenW - 233) / 2, (screenH - 383) / 2, 233, 383, "Panel Gangs", false)
      guiWindowSetSizable(ventanaGangs, false)
      guiSetAlpha(ventanaGangs, 0.87)

      botonInvitar = guiCreateButton(15, 31, 80, 26, "Invitar", false, ventanaGangs)
      GUIEditor.button[1] = guiCreateButton(143, 31, 80, 26, "", false, ventanaGangs)
      GUIEditor.button[2] = guiCreateButton(15, 82, 80, 26, "", false, ventanaGangs)
      GUIEditor.button[3] = guiCreateButton(143, 82, 80, 26, "", false, ventanaGangs)    
	else
      
	  guiSetVisible(ventanaGangs, not guiGetVisible(ventanaGangs))
	end
  end
	
 bindKey("f2", "down", panel)

lo siento fail mio xD

Edited by alex17"
Posted

y yo mareandome a probar con while y tal y resulta que era algo mas simple...

 

Gracias de nuevo!

13 minutes ago, alex17" said:

guiSetVisible(ventanaGangs, not guiGetVisible(ventanaGangs))

El not en que difiere al false?

Segun entiendo, el not es como si simplemente dejase de que fuera visible, mientras que el false hacia que no apareciera más, me equivoco?

Posted (edited)

not en ese caso sirve para contrariar guiGetVisble si la ventana es visible dara true y con el not sera un false entonces ara que el panel desaparesca , si guiGetVisble da false es por que no esta visible el panel entonces con el not se convierte en un true y el panel aparecera 

en conclusión el not te ayuda a resumir esto 

if guiGetVisible(ventanaGangs) == true then
  guiSetVisible(ventanaGangs, false)
elseif guiGetVisible(ventanaGangs) == false then
  guiSetVisible(ventanaGangs, true)
end

a solo esto

guiSetVisible(ventanaGangs, not guiGetVisible(ventanaGangs))

 

Edited by alex17"
  • Thanks 1
Posted
4 hours ago, iiKings said:

Una ultima duda alex, el proposito de todo esto es porque true or false = false verdad?

lo siento no entendí tu pregunta

 

Posted
1 minute ago, GonzaloBuenosAires said:

Me resolves esto? me está volviendo loco, estoy creando "HUD" y la fuentes siempre se me queda atrás de los "dxDrawRectangle", esta es la línea que estoy creando funciona pero la fuente siempre se queda atrás, mi idéa es que se vea delante como debe ser... Dimé que tengo que agregar para que se ponga siempre adelante, aquí esta mi línea:

dxDrawText("Nivel  "..level.."", 1050*sW, 10*sH, 1375*sW, 33*sH, tocolor(255, 0, 0, 255), 0.4, font)

creí que había que agregarle después de = 0.4,font), true) y que así se solucionaría pero si le agrego true no funciona mi recurso....

es por que primero pones el texto y luego el rec

dxDrawText

dxDrawRectangle

 

y debe ir asi 

dxDrawRectangle

dxDrawText

Posted (edited)
7 minutes ago, alex17" said:

es por que primero pones el texto y luego el rec

dxDrawText

dxDrawRectangle

 

y debe ir asi 

dxDrawRectangle

dxDrawText

Pués eso ya lo sabía, mira aquí una de las funciones de mi hud completas, lo subo y lo bajo pero la fuente siempre queda atrás de mi Rec =((( aquí mira dime que rayos sucede????

 

---------------

            local level = math.floor (getElementData( getLocalPlayer(), "level" ))        
            dxDrawRectangle(1050*sW, 05*sH, 232*sW, 38*sH, tocolor(255, 255, 255, 75), true)    
            dxDrawImage(1054*sW, 08*sH, 30*sW, 30*sH, "images/icon/level.png", 0, 0, 0, tocolor(0, 0, 0, 255), true)
            dxDrawRectangle(1090*sW, 10*sH, 187*sW, 25*sH, tocolor(0, 0, 0, 80), true)    
            dxDrawRectangle(1090*sW, 10*sH, 187*sW/101*level, 25*sH, tocolor(0, 0, 0, 250), true)                
            dxDrawText("Nivel  "..level.."", 1050*sW, 10*sH, 1375*sW, 33*sH, tocolor(255, 0, 0, 255), 0.4, font)

----------------

Edited by GonzaloBuenosAires
Posted
Just now, GonzaloBuenosAires said:

Pués eso ya lo sabía, mira aquí una de las funciones de mi hud completas, lo subo y lo bajo pero la fuente siempre queda atrás de mi Rec =((( aquí mira dime que rayos sucede????

 

---------------

            local level = math.floor (getElementData( getLocalPlayer(), "level" ))        
            dxDrawRectangle(1050*sW, 05*sH, 232*sW, 38*sH, tocolor(255, 255, 255, 75), true)    
            dxDrawImage(1054*sW, 08*sH, 30*sW, 30*sH, "images/icon/level.png", 0, 0, 0, tocolor(0, 0, 0, 255), true)
            dxDrawRectangle(1090*sW, 10*sH, 187*sW, 25*sH, tocolor(0, 0, 0, 80), true)    
            dxDrawRectangle(1090*sW, 10*sH, 187*sW/101*level, 25*sH, tocolor(0, 0, 0, 250), true)                
            dxDrawText("Nivel  "..level.."", 1050*sW, 10*sH, 1375*sW, 33*sH, tocolor(255, 0, 0, 255), 0.4, font)

----------------

el ultimo argumento del dxDraRectangle es PostGui que sirve para ponerlo encima de los Gui como esta en true se pone encima del texto cambialo por false igual el dxDrawImage

Posted
1 minute ago, alex17" said:

el ultimo argumento del dxDraRectangle es PostGui que sirve para ponerlo encima de los Gui como esta en true se pone encima del texto cambialo por false igual el dxDrawImage

Como no lo vi antes, tenes razón, me enfoqué en ver los true de los Tex e ignoré los Rec... Gracias por guiarme muchacho!!!!

Posted (edited)
On 14/9/2017 at 21:13, alex17" said:

de nada

Genio, tenes idéa de como crear una función de ocultar el MAPA DE F11 predeterminado del MTA?... Así como existe ese script para ocultar la HUD visibles del MTA predeterminado...

 

Edited by GonzaloBuenosAires
Posted
46 minutes ago, GonzaloBuenosAires said:

Genio, tenes idéa de como crear una función de ocultar el MAPA DE F11 predeterminado del MTA?... Así como existe ese script para ocultar la HUD visibles del MTA predeterminado...

 

toggleControl("radar",false)
 

Posted (edited)
11 hours ago, alex17" said:

toggleControl("radar",false)
 

Sí, eso mismo yo tengo en mi script que sirve para ejecutar otro mapa diferente al que trae predeterminado....

El problema es que se abre ambos mapas, podes ver como al presionar F11 primero se abre el mapa de MTA y luego sobre el mismo se abre el que yo le instale....

Esa función toggleControl("radar",false), la tengo pero es la del script del nuevo mapa que instale....

Pero no veo que esta script tenga la función de reemplazar el MAPA de MTA, por eso te decía si me harías el gran favor de crearme tú esa función te lo agradecería mucho...

Edited by GonzaloBuenosAires
Posted
On 16/9/2017 at 19:35, iiKings said:

unbindKey y luego bindKey a la funcion

Sería mucho pedirte si me hicierasu na script de regalo para mi server que cuando tengas pocas balas en tu arma te aparezca una imagen en el centro de tu pantalla y que luego al recargar esta desparezca?...

O sino una script de aviso que diga Presiona "R" para recargar...

Muchas gracias...

Posted

Revisa en la sección de aportes, hay un post que creo se llamaba "Mini aportes", ahí hay un código sobrr lo que quieres, Gonzalo. 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...