#Honda-R Posted April 29, 2013 Share Posted April 29, 2013 Hello. GUIEditor = { label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.label[1] = guiCreateLabel(277, 221, 111, 15, "MY TEXT", false) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true) guiSetProperty(GUIEditor.label[1], "AlwaysOnTop", "True") GUIEditor.label[2] = guiCreateLabel(277, 261, 111, 15, "MY TEXT", false) guiSetFont(GUIEditor.label[2], "default-bold-small") guiSetProperty(GUIEditor.label[2], "AlwaysOnTop", "True") end ) There is a problem. the labels shows when i dont need it. When i join to server. The labels are shown. How to hide it. I need to hide it , bec im willing to use bind key. Link to comment
PaiN^ Posted April 29, 2013 Share Posted April 29, 2013 addEventHandler( "onClientResourceStart", resourceRoot, function ( ) GUIEditor.label[1] = guiCreateLabel(277, 221, 111, 15, "MY TEXT", false) guiSetFont(GUIEditor.label[1], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor.label[1], "left", true) guiSetProperty(GUIEditor.label[1], "AlwaysOnTop", "True") guiSetVisible ( GUIEditor.label[1], false ) GUIEditor.label[2] = guiCreateLabel(277, 261, 111, 15, "MY TEXT", false) guiSetFont(GUIEditor.label[2], "default-bold-small") guiSetProperty(GUIEditor.label[2], "AlwaysOnTop", "True") guiSetVisible ( GUIEditor.label[2], false ) end ) Link to comment
#Honda-R Posted April 29, 2013 Author Share Posted April 29, 2013 You added line guiSetVisible ( GUIEditor.label[2], false ) ? Link to comment
PaiN^ Posted April 29, 2013 Share Posted April 29, 2013 Yes, And guiSetVisible ( GUIEditor.label[1], false ) You have to hide it, Because the create function will make it visible . Link to comment
#Honda-R Posted April 29, 2013 Author Share Posted April 29, 2013 Thanks! Now i want to ask another qestion . function onResourceStart () local Window = guiGetVisible (GUIEditor.button[1]) --We predefine a variable for Window if (Window) == true then -- If window is shown guiSetVisible ( GUIEditor.button[1], false ) --We hide it showCursor ( false ) --We hide it's cursor else --else we.. guiSetVisible ( GUIEditor.button[1], true ) --Show the window showCursor ( true ) --We show it's cursor end end bindKey ( "F7", "down", onResourceStart ) --And we bind it with 'f1' key You see GUIEditor.button[1 What add to script like if i want to make visible GUIEditor.button[2] GUIEditor.button[3] and ect. Link to comment
iPrestege Posted April 29, 2013 Share Posted April 29, 2013 I Can't understand what are you trying to do . Link to comment
#Honda-R Posted April 29, 2013 Author Share Posted April 29, 2013 Well you see function onResourceStart () local Window = guiGetVisible (GUIEditor.button[1]) --We predefine a variable for Window if (Window) == true then -- If window is shown guiSetVisible ( GUIEditor.button[1], false ) --We hide it showCursor ( false ) --We hide it's cursor else --else we.. guiSetVisible ( GUIEditor.button[1], true ) --Show the window showCursor ( true ) --We show it's cursor end end bindKey ( "F7", "down", onResourceStart ) --And we bind it with 'f1' key And i need to make visible other elements. Like GUIEditor.button[2] GUIEditor.button[3] ect Link to comment
iPrestege Posted April 29, 2013 Share Posted April 29, 2013 Try this : bindKey('F7','down', function ( ) for i = 1,3 do guiSetVisible ( GUIEditor.button[i] , not guiGetVisible ( GUIEditor.button[i] ) ) showCursor ( guiGetVisible ( GUIEditor.button[i] ) ) end end ) This only for 3 buttons 'elements' not tested but should work . Link to comment
#Honda-R Posted April 29, 2013 Author Share Posted April 29, 2013 Try this : bindKey('F7','down', function ( ) for i = 1,3 do guiSetVisible ( GUIEditor.button[i] , not guiGetVisible ( GUIEditor.button[i] ) ) showCursor ( guiGetVisible ( GUIEditor.button[i] ) ) end end ) This only for 3 buttons 'elements' not tested but should work . Well my script has UIEditor.staticimage[3] Images and GUIEditor.label[9] labels Link to comment
iPrestege Posted April 29, 2013 Share Posted April 29, 2013 Try this not tested : bindKey('F7','down', function ( ) for i = 1,9 do guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) showCursor ( guiGetVisible ( GUIEditor.label[i] ) ) end for i = 1,3 do guiSetVisible ( GUIEditor.button[i] , not guiGetVisible ( GUIEditor.button[i] ) ) guiSetVisible ( GUIEditor.staticimage[i] , not guiGetVisible ( GUIEditor.staticimage[i] ) ) showCursor ( guiGetVisible ( GUIEditor.button[i] ) ) end end ) Link to comment
#Honda-R Posted April 29, 2013 Author Share Posted April 29, 2013 Try this not tested : bindKey('F7','down', function ( ) for i = 1,9 do guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) showCursor ( guiGetVisible ( GUIEditor.label[i] ) ) end for i = 1,3 do guiSetVisible ( GUIEditor.button[i] , not guiGetVisible ( GUIEditor.button[i] ) ) guiSetVisible ( GUIEditor.staticimage[i] , not guiGetVisible ( GUIEditor.staticimage[i] ) ) showCursor ( guiGetVisible ( GUIEditor.button[i] ) ) end end ) o ma gad! Thanks very mutch! 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