MBAUser

Panel de Team

Recommended Posts

Holaa!! Como están? Les cuento de que va mi duda que le di vueltas y vueltas, pero no se bien como hacerlo, tengo muy pocos conocimientos de scripts, consulte la wiki pero todavia no me es muy familiar... Lo que intento hacer es que a partir del primer panel (Ventana) al hacer click en "Empezar a trabajar" con el "Boton11" De la "Ventana" es que se cierre todo y se habra la "Ventana2" para luego elegir ejemplo Aboton3 y empieze un Job, que si me podrian dar una orientación de como hacer la función se lo agradeceria, desde ya muchas gracias!!

Ventana = guiCreateWindow(811, 397, 258, 400, "Planilla", false);guiSetVisible(Ventana, false)
guiWindowSetSizable(Ventana, false)
guiSetProperty(Ventana, "CaptionColour", "FF1FE9E2")

Boton1 = guiCreateButton(33, 38, 84, 25, "Empresa:", false, Ventana); guiSetProperty(Boton1, "NormalTextColour", "FFFFFFFF")
Boton2 = guiCreateButton(138, 38, 111, 25, "NOMBREEMPRESA", false, Ventana);guiSetProperty(Boton2, "NormalTextColour", "FF27F512")
Boton3 = guiCreateButton(33, 91, 84, 25, "Chofer:", false, Ventana);guiSetProperty(Boton3, "NormalTextColour", "FFFFFFFF")
Boton4 = guiCreateButton(138, 91, 111, 25, "Nombre:", false, Ventana);guiSetProperty(Boton4, "NormalTextColour", "FF27F512")
Boton5 = guiCreateButton(33, 142, 84, 25, "Legajo:", false, Ventana);guiSetProperty(Boton5, "NormalTextColour", "FFFFFFFF")
Boton6 = guiCreateButton(33, 196, 84, 25, "Interno:", false, Ventana);guiSetProperty(Boton6, "NormalTextColour", "FFFFFFFF")
Boton7 = guiCreateButton(33, 249, 84, 25, "Generado:", false, Ventana);guiSetProperty(Boton7, "NormalTextColour", "FFFFFFFF")
Boton8 = guiCreateButton(137, 142, 111, 25, "Legajo", false, Ventana);guiSetProperty(Boton8, "NormalTextColour", "FF27F512")
Boton9 = guiCreateButton(137, 196, 111, 25, "INTERNO", false, Ventana);guiSetProperty(Boton9, "NormalTextColour", "FF27F512")
Boton10 = guiCreateButton(137, 249, 111, 25, "PLATAGENERADA", false, Ventana);guiSetProperty(Boton10, "NormalTextColour", "FF27F512")
Boton11 = guiCreateButton(30, 297, 218, 32, "Empezar a trabajar", false, Ventana);guiSetProperty(Boton11, "NormalTextColour", "FF22E7FF")
Boton12 = guiCreateButton(33, 344, 84, 25, "Cerrar", false, Ventana);guiSetProperty(Boton12, "NormalTextColour", "FFFD2323")   


addCommandHandler("p", 
	function()
		local team = getPlayerTeam(localPlayer)
		if team then
			local teamName = getTeamName(team)
			if teamName == "MOBSA" then
				local getGui = guiGetVisible(Ventana)
				if not getGui then
					guiSetVisible(Ventana, true)
					guiSetText(Boton2, teamName)
					guiSetText(Boton4, getPlayerName(localPlayer))
					showCursor(true)
				else
					guiSetVisible(Ventana, false)
					showCursor(false)
					print "Tu trabajas de chofer actualmente"
				end
			else
			print "Tu trabajas de chofer actualmente"
		end
	end
end
)

addEventHandler("onClientGUIClick", guiRoot,
	function()
		local getGui = guiGetVisible(Ventana)
		if source == Boton12 then	
			if getGui then
				guiSetVisible(Ventana, false)
				showCursor(false)
			end
		end
	end
)


addEventHandler("onClientGUIClick", guiRoot,           --Esta es la VENTANA2...
    function()
        Ventana2 = guiCreateWindow(743, 302, 278, 609, "Planilla MOBSA", false)

        Aboton = guiCreateButton(54, 37, 174, 33, "Seleccione un recorrido", false, Aboton);guiSetProperty(Boton13, "NormalTextColour", "FF07CDF8")
        Aboton1 = guiCreateButton(20, 103, 100, 29, "Linea 58", false, Aboton1)
        Aboton2 = guiCreateButton(116, 7, 15, 12, "", false, Aboton2)
        Aboton3 = guiCreateButton(20, 142, 100, 29, "2a", false, Aboton3)
        Aboton4 = guiCreateButton(20, 181, 100, 29, "3a", false, Aboton4)
        Aboton5 = guiCreateButton(20, 220, 100, 29, "4", false, Aboton5)
        Aboton6 = guiCreateButton(20, 259, 100, 29, "5", false, Aboton6)
        Aboton7 = guiCreateButton(20, 298, 100, 29, "6", false, Aboton7)
        Aboton8 = guiCreateButton(20, 337, 100, 29, "7", false, Aboton8)
        Aboton9 = guiCreateButton(20, 376, 100, 29, "8", false, Aboton9)
        Aboton10 = guiCreateButton(20, 415, 100, 29, "9", false, Aboton10)
        Aboton11 = guiCreateButton(20, 454, 100, 29, "10", false, Aboton11)
        Aboton12 = guiCreateButton(20, 493, 100, 29, "11", false, Aboton12)
        Aboton13 = guiCreateButton(150, 541, 100, 29, "Cerrar", false, Aboton13);guiSetProperty(Boton13, "NormalTextColour", "FFFB0202")
        Aboton14 = guiCreateButton(25, 541, 100, 29, "Volver", false, Aboton14);guiSetProperty(Boton14, "NormalTextColour", "FF1FDF3F")
        Aboton15 = guiCreateButton(130, 103, 130, 29, "Terminal - Dorlingo", false, Aboton15)
        Aboton16 = guiCreateButton(130, 142, 130, 29, "2", false, Aboton16)
        Aboton17 = guiCreateButton(130, 181, 130, 29, "3b", false, Aboton17)
        Aboton18 = guiCreateButton(130, 220, 130, 29, "3b", false, Aboton18)
        Aboton19 = guiCreateButton(130, 259, 130, 29, "3b", false, Aboton19)
        Aboton20 = guiCreateButton(130, 298, 130, 29, "3b", false, Aboton20)
        Aboton21 = guiCreateButton(130, 337, 130, 29, "3b", false, Aboton21)
        Aboton22 = guiCreateButton(130, 376, 130, 29, "3b", false, Aboton22)
        Aboton23 = guiCreateButton(130, 415, 130, 29, "3b", false, Aboton23)
        Aboton24 = guiCreateButton(130, 454, 130, 29, "3b", false, Aboton24)
        Aboton25 = guiCreateButton(130, 493, 130, 29, "3b", false, Aboton25)    
    end 
end
	

 

Share this post


Link to post

Intentá así:

Ventana = guiCreateWindow(811, 397, 258, 400, "Planilla", false);guiSetVisible(Ventana, false)
guiWindowSetSizable(Ventana, false)
guiSetProperty(Ventana, "CaptionColour", "FF1FE9E2")

Boton1 = guiCreateButton(33, 38, 84, 25, "Empresa:", false, Ventana); guiSetProperty(Boton1, "NormalTextColour", "FFFFFFFF")
Boton2 = guiCreateButton(138, 38, 111, 25, "NOMBREEMPRESA", false, Ventana);guiSetProperty(Boton2, "NormalTextColour", "FF27F512")
Boton3 = guiCreateButton(33, 91, 84, 25, "Chofer:", false, Ventana);guiSetProperty(Boton3, "NormalTextColour", "FFFFFFFF")
Boton4 = guiCreateButton(138, 91, 111, 25, "Nombre:", false, Ventana);guiSetProperty(Boton4, "NormalTextColour", "FF27F512")
Boton5 = guiCreateButton(33, 142, 84, 25, "Legajo:", false, Ventana);guiSetProperty(Boton5, "NormalTextColour", "FFFFFFFF")
Boton6 = guiCreateButton(33, 196, 84, 25, "Interno:", false, Ventana);guiSetProperty(Boton6, "NormalTextColour", "FFFFFFFF")
Boton7 = guiCreateButton(33, 249, 84, 25, "Generado:", false, Ventana);guiSetProperty(Boton7, "NormalTextColour", "FFFFFFFF")
Boton8 = guiCreateButton(137, 142, 111, 25, "Legajo", false, Ventana);guiSetProperty(Boton8, "NormalTextColour", "FF27F512")
Boton9 = guiCreateButton(137, 196, 111, 25, "INTERNO", false, Ventana);guiSetProperty(Boton9, "NormalTextColour", "FF27F512")
Boton10 = guiCreateButton(137, 249, 111, 25, "PLATAGENERADA", false, Ventana);guiSetProperty(Boton10, "NormalTextColour", "FF27F512")
Boton11 = guiCreateButton(30, 297, 218, 32, "Empezar a trabajar", false, Ventana);guiSetProperty(Boton11, "NormalTextColour", "FF22E7FF")
Boton12 = guiCreateButton(33, 344, 84, 25, "Cerrar", false, Ventana);guiSetProperty(Boton12, "NormalTextColour", "FFFD2323")   


Ventana2 = guiCreateWindow(743, 302, 278, 609, "Planilla MOBSA", false);;guiSetVisible(Ventana2, false);guiWindowSetSizable(Ventana2, false)
Aboton = guiCreateButton(54, 37, 174, 33, "Seleccione un recorrido", false, Aboton);guiSetProperty(Aboton, "NormalTextColour", "FF07CDF8")
Aboton1 = guiCreateButton(20, 103, 100, 29, "Linea 58", false, Ventana2)
Aboton2 = guiCreateButton(116, 7, 15, 12, "", false, Ventana2)
Aboton3 = guiCreateButton(20, 142, 100, 29, "2a", false, Ventana2)
Aboton4 = guiCreateButton(20, 181, 100, 29, "3a", false, Ventana2)
Aboton5 = guiCreateButton(20, 220, 100, 29, "4", false, Ventana2)
Aboton6 = guiCreateButton(20, 259, 100, 29, "5", false, Ventana2)
Aboton7 = guiCreateButton(20, 298, 100, 29, "6", false, Ventana2)
Aboton8 = guiCreateButton(20, 337, 100, 29, "7", false, Ventana2)
Aboton9 = guiCreateButton(20, 376, 100, 29, "8", false, Ventana2)
Aboton10 = guiCreateButton(20, 415, 100, 29, "9", false, Ventana2)
Aboton11 = guiCreateButton(20, 454, 100, 29, "10", false, Ventana2)
Aboton12 = guiCreateButton(20, 493, 100, 29, "11", false, Ventana2)
Aboton13 = guiCreateButton(150, 541, 100, 29, "Cerrar", false, Ventana2);guiSetProperty(Aboton13, "NormalTextColour", "FFFB0202")
Aboton14 = guiCreateButton(25, 541, 100, 29, "Volver", false, Ventana2);guiSetProperty(Aboton14, "NormalTextColour", "FF1FDF3F")
Aboton15 = guiCreateButton(130, 103, 130, 29, "Terminal - Dorlingo", false, Aboton15)
Aboton16 = guiCreateButton(130, 142, 130, 29, "2", false, Ventana2)
Aboton17 = guiCreateButton(130, 181, 130, 29, "3b", false, Ventana2)
Aboton18 = guiCreateButton(130, 220, 130, 29, "3b", false, Ventana2)
Aboton19 = guiCreateButton(130, 259, 130, 29, "3b", false, Ventana2)
Aboton20 = guiCreateButton(130, 298, 130, 29, "3b", false, Ventana2)
Aboton21 = guiCreateButton(130, 337, 130, 29, "3b", false, Ventana2)
Aboton22 = guiCreateButton(130, 376, 130, 29, "3b", false, Ventana2)
Aboton23 = guiCreateButton(130, 415, 130, 29, "3b", false, Ventana2)
Aboton24 = guiCreateButton(130, 454, 130, 29, "3b", false, Ventana2)
Aboton25 = guiCreateButton(130, 493, 130, 29, "3b", false, Ventana2) 

addCommandHandler("p", 
	function()
		local team = getPlayerTeam(localPlayer)
		if team then
			local teamName = getTeamName(team)
			if teamName == "MOBSA" then
				local getGui = guiGetVisible(Ventana)
				if not getGui then
					guiSetVisible(Ventana, true)
					guiSetText(Boton2, teamName)
					guiSetText(Boton4, getPlayerName(localPlayer))
					showCursor(true)
				else
					guiSetVisible(Ventana, false)
					showCursor(false)
					print ("Tu trabajas de chofer actualmente")
				end
			else
				print ("Tu trabajas de chofer actualmente")
			end
		end
	end
)

addEventHandler("onClientGUIClick", guiRoot,
	function()
		local getGui = guiGetVisible(Ventana)
		if source == Boton12 then	-- botón cerrar
			if getGui then -- Si el elemento es visible entonces
				guiSetVisible(Ventana, false) -- Se cierra el elemento "Ventana"
				showCursor(false) -- Desaparece el cursor
			end
		elseif source == Boton11 then -- botón "Empezar a trabajar"
			if getGui then -- Si el elemento es visible entonces
				guiSetVisible(Ventana, false) -- Se cierra el elemento "Ventana"
				guiSetVisible(Ventana2, true) -- Se abre el elemento "Ventana2"
			end
		end
	end
)   

 

Edited by #Dv^
  • Thanks 1

Share this post


Link to post

Al aplicar el comando /p no abre nada, intente borrando la ventana 2, y ahi si abre, ¿Alguna otra solución que sepan? Gracias igual!
Pensaba que capas poniendo el segundo panel en una función se iba a poder, pero no encuento la manera..

Edited by MBAUser

Share this post


Link to post

Intentá ahora, había un punto y coma de más (;)

Ventana = guiCreateWindow(811, 397, 258, 400, "Planilla", false);guiSetVisible(Ventana, false)
guiWindowSetSizable(Ventana, false)
guiSetProperty(Ventana, "CaptionColour", "FF1FE9E2")

Boton1 = guiCreateButton(33, 38, 84, 25, "Empresa:", false, Ventana); guiSetProperty(Boton1, "NormalTextColour", "FFFFFFFF")
Boton2 = guiCreateButton(138, 38, 111, 25, "NOMBREEMPRESA", false, Ventana);guiSetProperty(Boton2, "NormalTextColour", "FF27F512")
Boton3 = guiCreateButton(33, 91, 84, 25, "Chofer:", false, Ventana);guiSetProperty(Boton3, "NormalTextColour", "FFFFFFFF")
Boton4 = guiCreateButton(138, 91, 111, 25, "Nombre:", false, Ventana);guiSetProperty(Boton4, "NormalTextColour", "FF27F512")
Boton5 = guiCreateButton(33, 142, 84, 25, "Legajo:", false, Ventana);guiSetProperty(Boton5, "NormalTextColour", "FFFFFFFF")
Boton6 = guiCreateButton(33, 196, 84, 25, "Interno:", false, Ventana);guiSetProperty(Boton6, "NormalTextColour", "FFFFFFFF")
Boton7 = guiCreateButton(33, 249, 84, 25, "Generado:", false, Ventana);guiSetProperty(Boton7, "NormalTextColour", "FFFFFFFF")
Boton8 = guiCreateButton(137, 142, 111, 25, "Legajo", false, Ventana);guiSetProperty(Boton8, "NormalTextColour", "FF27F512")
Boton9 = guiCreateButton(137, 196, 111, 25, "INTERNO", false, Ventana);guiSetProperty(Boton9, "NormalTextColour", "FF27F512")
Boton10 = guiCreateButton(137, 249, 111, 25, "PLATAGENERADA", false, Ventana);guiSetProperty(Boton10, "NormalTextColour", "FF27F512")
Boton11 = guiCreateButton(30, 297, 218, 32, "Empezar a trabajar", false, Ventana);guiSetProperty(Boton11, "NormalTextColour", "FF22E7FF")
Boton12 = guiCreateButton(33, 344, 84, 25, "Cerrar", false, Ventana);guiSetProperty(Boton12, "NormalTextColour", "FFFD2323")   


Ventana2 = guiCreateWindow(743, 302, 278, 609, "Planilla MOBSA", false);guiSetVisible(Ventana2, false);guiWindowSetSizable(Ventana2, false)
Aboton = guiCreateButton(54, 37, 174, 33, "Seleccione un recorrido", false, Ventana2);guiSetProperty(Aboton, "NormalTextColour", "FF07CDF8")
Aboton1 = guiCreateButton(20, 103, 100, 29, "Linea 58", false, Ventana2)
Aboton2 = guiCreateButton(116, 7, 15, 12, "", false, Ventana2)
Aboton3 = guiCreateButton(20, 142, 100, 29, "2a", false, Ventana2)
Aboton4 = guiCreateButton(20, 181, 100, 29, "3a", false, Ventana2)
Aboton5 = guiCreateButton(20, 220, 100, 29, "4", false, Ventana2)
Aboton6 = guiCreateButton(20, 259, 100, 29, "5", false, Ventana2)
Aboton7 = guiCreateButton(20, 298, 100, 29, "6", false, Ventana2)
Aboton8 = guiCreateButton(20, 337, 100, 29, "7", false, Ventana2)
Aboton9 = guiCreateButton(20, 376, 100, 29, "8", false, Ventana2)
Aboton10 = guiCreateButton(20, 415, 100, 29, "9", false, Ventana2)
Aboton11 = guiCreateButton(20, 454, 100, 29, "10", false, Ventana2)
Aboton12 = guiCreateButton(20, 493, 100, 29, "11", false, Ventana2)
Aboton13 = guiCreateButton(150, 541, 100, 29, "Cerrar", false, Ventana2);guiSetProperty(Aboton13, "NormalTextColour", "FFFB0202")
Aboton14 = guiCreateButton(25, 541, 100, 29, "Volver", false, Ventana2);guiSetProperty(Aboton14, "NormalTextColour", "FF1FDF3F")
Aboton15 = guiCreateButton(130, 103, 130, 29, "Terminal - Dorlingo", false, Ventana2)
Aboton16 = guiCreateButton(130, 142, 130, 29, "2", false, Ventana2)
Aboton17 = guiCreateButton(130, 181, 130, 29, "3b", false, Ventana2)
Aboton18 = guiCreateButton(130, 220, 130, 29, "3b", false, Ventana2)
Aboton19 = guiCreateButton(130, 259, 130, 29, "3b", false, Ventana2)
Aboton20 = guiCreateButton(130, 298, 130, 29, "3b", false, Ventana2)
Aboton21 = guiCreateButton(130, 337, 130, 29, "3b", false, Ventana2)
Aboton22 = guiCreateButton(130, 376, 130, 29, "3b", false, Ventana2)
Aboton23 = guiCreateButton(130, 415, 130, 29, "3b", false, Ventana2)
Aboton24 = guiCreateButton(130, 454, 130, 29, "3b", false, Ventana2)
Aboton25 = guiCreateButton(130, 493, 130, 29, "3b", false, Ventana2) 

addCommandHandler("p", 
	function()
		local team = getPlayerTeam(localPlayer)
		if team then
			local teamName = getTeamName(team)
			if teamName == "MOBSA" then
				local getGui = guiGetVisible(Ventana)
				if not getGui then
					guiSetVisible(Ventana, true)
					guiSetText(Boton2, teamName)
					guiSetText(Boton4, getPlayerName(localPlayer))
					showCursor(true)
				else
					guiSetVisible(Ventana, false)
					showCursor(false)
					print ("Tu trabajas de chofer actualmente")
				end
			else
				print ("Tu trabajas de chofer actualmente")
			end
		end
	end
)

addEventHandler("onClientGUIClick", guiRoot,
	function()
		local getGui = guiGetVisible(Ventana)
		if source == Boton12 then	-- botón cerrar
			if getGui then -- Si el elemento es visible entonces
				guiSetVisible(Ventana, false) -- Se cierra el elemento "Ventana"
				showCursor(false) -- Desaparece el cursor
			end
		elseif source == Boton11 then -- botón "Empezar a trabajar"
			if getGui then -- Si el elemento es visible entonces
				guiSetVisible(Ventana, false) -- Se cierra el elemento "Ventana"
				guiSetVisible(Ventana2, true) -- Se abre el elemento "Ventana2"
			end
		end
	end
)   

 

  • Thanks 1

Share this post


Link to post

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.