Jump to content

Ayuda con Panel


MBAUser

Recommended Posts

Buenas tardes, intenté hacer un panel para un determinado team, pero al momento de que aparescan en el panel determinados datos del jugador no lo hago correctamente.
En "Nombreempresa" Deberia figurar el nombre del team y en donde dice "Nombre" ( Del boton 4) es donde apareceria el nombre del jugador.
Intente hacerlo que aparesca en botones, o Label, pero en ninguno funciono, espero que me puedan ayudar, desde ya gracias.

 

Cliente

function PlanillaMOBSA()
        Ventana = guiCreateWindow(811, 397, 258, 400, "Planilla", false)
        guiWindowSetSizable(Ventana, false)
        guiSetProperty(Ventana, "CaptionColour", "FF1FE9E2")
		showCursor (true)

       
		
        Boton1 = guiCreateButton(33, 38, 84, 25, "Empresa:", false, Ventana)
        guiSetProperty(Boton1, "NormalTextColour", "FFFFFFFF")
        Boton2 = guiCreateButton(138, 38, 111, 25, "NOMBREEMPRESA", false, Ventana) --Aca es lo que necesito que me figure el nombre del team
        guiSetProperty(Boton2, "NormalTextColour", "FF27F512")
        Boton3 = guiCreateButton(33, 91, 84, 25, "Chofer:", false, Ventana)
        guiSetProperty(Boton3, "NormalTextColour", "FFFFFFFF")
        Boton4 = guiCreateLabel(138, 91, 111, 25, "Nombre:", false, Ventana) --Aca es lo que necesito que me figure el nombre del jugador
        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")    
		
		addEventHandler( "onClientGUIClick", Boton12, CerrarFunc, false )

end 
addEvent( "onGreeting", true )
addEventHandler( "onGreeting", localPlayer, PlanillaMOBSA )
 


function NombreFunc ( localPlayer )                               ----No se como hacer que funcione esta funcion, o la manera por la cual.
	local NombreJugador = getPlayerFromName ( localPlayer )
	guiSetText (Boton4, "Nombre:"..NombreJugador)
end 


function CerrarFunc ()
	showCursor (false)
	guiSetVisible (Ventana, not guiGetVisible ( Ventana ) )
end

Servidor

addCommandHandler ("planilla", 
	function ( playerSource )
		local teamPanel = getTeamFromName ( "MOBSA" )
		local Team = getPlayerTeam ( playerSource )
		if (Team) == teamPanel then
			triggerClientEvent ( playerSource, "onGreeting", playerSource)
			outputChatBox ( "Usted abrió su planilla.", playerSource, 0, 255, 0, true )
			else
			outputChatBox ( "Usted no pertenece a ninguna empresa.", playerSource, 255, 0, 0, true )
		end
	end
)

 

Link to comment

Todo esto en client-side.

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 = guiCreateLabel(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")   

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


addCommandHandler("planilla", 
	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)
				end
			else
				print("No estás en el team MOBSA")
			end
		else
			print("No estás en ningún team")
		end
	end
)

 

Link to comment

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...