• I'm having problems creating a panel
    6 replies, posted
I'm trying to make a panel pop out in initial spawn but it messes up completely EDIT: the error is the button cl_init [code]function initialspawnmenu() --Function for the window when joining as neither special character nor Admin menu01 = vgui.Create( "DFrame" ) --Define ready as a "DFrame" job1 = vgui.Create( "DButton", menu01 ) -- makes a button job2 = vgui.Create( "DButton", menu01 ) --2e button menu01:SetPos( 250, 250 ) --Set the position. Half the screen height and half the screen width. This will result in being bottom right of the middle of the screen. menu01:SetSize( 500, 300 ) --The size, in pixels of the Frame menu01:SetTitle( "Stag's Script - Choose a job!" ) --The title; It's at the top. menu01:SetVisible( true ) -- Should it be seen? menu01:SetDraggable( false ) -- Can people drag it around? menu01:ShowCloseButton( false ) --Show the little X top right? I chose no, because I have no alternative, meaning people would roam around with no weapons menu01:MakePopup() --Make it popup. Of course. job1:SetPos( 20, 100 ) job1:SetSize( 180, 20 ) job1:SetText( "Shop owner" ) job1:DoClick = function() RunConsoleCommand( "joinjob1" ) end job2:SetPos( 20, 130 ) job2:SetSize( 180, 20 ) job2:SetText( "Cook" ) job2:DoClick = function() RunConsoleCommand( "joinjob2" ) end end[/code]
DoClick is a variable of job1, not a function call on job1. So instead of saying "job1:DoClick =", you should use "job1.DoClick =". Remember: Colons are for functions, periods are for variables. Same thing for job2.
Thanks but how can i put a silkicon near my title or a button? and whenever i click a button in my menu the menu just stays there, how can i close it when i press a button?
Don't know what you're asking for in your first question. To close the menu when you click a button, add "menu01:Close()" to the button's DoClick's function.
I'm asking how to put [url]http://wiki.garrysmod.com/?title=Silkicons[/url] in my derma oh and thanks again
I'm not sure, I've never done that before. If I had to guess, I'd suggest trying to use them on a [url=http://wiki.garrysmod.com/?title=DImage]DImage[/url].
I Only use Silkicons in DPropertySheet see this. [url]http://wiki.garrysmod.com/?title=Guide_to_Derma[/url]
Sorry, you need to Log In to post a reply to this thread.