ViRuZGamiing Posted July 9, 2013 Share Posted July 9, 2013 Hello Community, I tried to make a GUI which is visible on the command /heal and dissapears on the command /heal too. CLIENT: function createHealWindow() local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 heal = guiCreateWindow(X, Y, Width, Height, "Heal yourself", true) guiSetVisible ( heal, 0 ) end function changeVisibility ( ) guiSetVisible (heal, not guiGetVisible ( heal ) ) end addCommandHandler("heal", changeVisibility) Link to comment
Baseplate Posted July 9, 2013 Share Posted July 9, 2013 local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 heal = guiCreateWindow(X, Y, Width, Height, "Heal yourself", true) guiSetVisible ( heal, false ) function changeVisibility ( ) guiSetVisible (heal, not guiGetVisible ( heal ) ) showCursor (guiGetVisible(heal)) end addCommandHandler("heal", changeVisibility) Link to comment
ViRuZGamiing Posted July 9, 2013 Author Share Posted July 9, 2013 (edited) Okay can you tell what I did wrong so I can learn something about my mistake +Why the f*ck you say Signature Thief too me! Everyone can take it There is no Copyright on it so it's no theft. ++ I've reported that Document too Google as Insulting and took a screenshot Edited July 9, 2013 by Guest Link to comment
aim-killer Posted July 9, 2013 Share Posted July 9, 2013 in this guiSetVisible ( element guiElement, bool state ) it has guiElement and the state, you wrote 0 for state.. it must be true/false .. and you have created the gui in a function and that function is not being called, in this case it is not necessary to put in a function cuz its not visible Link to comment
ViRuZGamiing Posted July 9, 2013 Author Share Posted July 9, 2013 in this guiSetVisible ( element guiElement, bool state ) it has guiElement and the state, you wrote 0 for state.. it must be true/false .. and you have created the gui in a function and that function is not being called, in this case it is not necessary to put in a function cuz its not visible Thank you very much for explaining that Link to comment
ViRuZGamiing Posted July 15, 2013 Author Share Posted July 15, 2013 Okay another Question: I've added the last part (yes as text not code) but how can I attach the button to the right upper corner of the GUI? Like on a Windows Program the left upper red "X" to close the Program (GUI) The button (button) needs to be in the middle. 50% up-down 50% left-right local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 heal = guiCreateWindow(X, Y, Width, Height, "Heal yourself", true) button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Heal!", true ) guiSetVisible ( heal, false ) function changeVisibility ( ) guiSetVisible (heal, not guiGetVisible ( heal ) ) showCursor (guiGetVisible(heal)) end addCommandHandler("heal", changeVisibility) triggerServerEvent ( "onClientGUIClick", button, heal) --[[ Close Button Test x = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true ) function closeGui ( ) guiSetVisible (heal, not guiGetVisible ( heal ) ) showCursor (guiGetVisible(heal)) end addEventHandler ("onClientGUIClick",x,closeGui,false) --]] Link to comment
iMr.3a[Z]eF Posted July 15, 2013 Share Posted July 15, 2013 there is an argument for the window parent, attach it with window or use GUIEditor easily x = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Output!", true, myWindpw ) Link to comment
ViRuZGamiing Posted July 15, 2013 Author Share Posted July 15, 2013 Is this correct? local X = 0.375 local Y = 0.375 local Width = 0.25 local Height = 0.25 heal = guiCreateWindow(X, Y, Width, Height, "Heal yourself", true) button = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "Heal!", true, heal ) x = guiCreateButton( 0.7, 0.1, 0.2, 0.1, "x", true, heal ) guiSetVisible ( heal, false ) function changeVisibility ( ) guiSetVisible (heal, not guiGetVisible ( heal ) ) showCursor (guiGetVisible(heal)) end addCommandHandler("heal", changeVisibility) triggerServerEvent ( "onClientGUIClick", button, heal) function closeGui ( ) guiSetVisible (heal, not guiGetVisible ( heal ) ) showCursor (guiGetVisible(heal)) end addEventHandler ("onClientGUIClick",x,closeGui,false) Link to comment
Castillo Posted July 15, 2013 Share Posted July 15, 2013 Everything seems fine but this line: triggerServerEvent ( "onClientGUIClick", button, heal) which makes absolutely no sense. Link to comment
ViRuZGamiing Posted July 15, 2013 Author Share Posted July 15, 2013 Everything seems fine but this line: triggerServerEvent ( "onClientGUIClick", button, heal) which makes absolutely no sense. it does i have a server side Link to comment
Castillo Posted July 15, 2013 Share Posted July 15, 2013 No, it doesn't, you are triggering that event just when script starts, using the button element as "theElement" and sending the window element, explain me how does it make sense. Link to comment
Moderators IIYAMA Posted July 15, 2013 Moderators Share Posted July 15, 2013 for your question from skype. local sWidth,sHeight = guiGetScreenSize() local halveSWidth = sWidth / 2 local halveSHeight = sHeight / 2 -- your gui size and position. local guiSizeX,guiSizeY = sWidth *.25,sHeight *.25 local guiPosStartX = halveSWidth - (guiSizeX/2) local guiPosStartY = halveSHeight - (guiSizeY/2) Link to comment
ViRuZGamiing Posted July 15, 2013 Author Share Posted July 15, 2013 Okay sorry i'm a noob Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now