Thread: LUA Coding

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Location
    Eastern Shore Maryland, USA
    Posts
    340
    Rep Power
    19

    LUA Coding


    Is anyone here familiar with Garry's Mod 10 and lua coding? I need help...
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Location
    Eastern Shore Maryland, USA
    Posts
    340
    Rep Power
    19
    Could I post more information as to what I'm trying to do? To the semi-experienced coder this will be an easy fix.
  4. #3
  5. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    of course you can post more info, I don't think anyone knows what you're talking about
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Location
    Eastern Shore Maryland, USA
    Posts
    340
    Rep Power
    19
    Ok, well jobs.lua has this:

    Code:
    local function Menu()
        local DermaPanel = vgui.Create( "DFrame" )
         DermaPanel:SetPos( 50,50 )
    	 DermaPanel:SetSize( 200, 250 )
    	 DermaPanel:SetTitle( "Employment Listings" )
    	 DermaPanel:SetVisible( true )
    	 DermaPanel:SetDraggable( true )
    	 DermaPanel:ShowCloseButton( true )
    	 DermaPanel:MakePopup()
    	end 
    
        local ButtonHobo = vgui.Create( "DButton" )
        
        ButtonHobo.DoClick = function()
            ButtonHobo:SetParent( DermaPanel )
    		ButtonHobo:SetText( "Hobo" ) 
    		ButtonHobo:SetPos( 25, 50 )
    		ButtonHobo:SetSize( 150, 50 )
    		ButtonHobo.DoClick = function ()
    		RunConsoleCommand( "say /job hobo" )
        end
    	
    	local ButtonDoctor = vgui.Create( "DButton" )
    
        ButtonDoctor.DoClick = function()
            ButtonDoctor:SetParent( DermaPanel )
    		ButtonDoctor:SetText( "Doctor" ) 
    		ButtonDoctor:SetPos( 55, 50 )
    		ButtonDoctor:SetSize( 150, 50 )
    		ButtonDoctor.DoClick = function ()
    		RunConsoleCommand( "say /job doctor" )
        end
    	
    	local ButtonCabby = vgui.Create( "DButton" )
    	
    	ButtonCabby.DoClick = function()
    		ButtonCabby:SetParent( DermaPanel )
    		ButtonCabby:SetText( "Cabby" ) 
    		ButtonCabby:SetPos( 85, 50 )
    		ButtonCabby:SetSize( 150, 50 )
    		ButtonCabby.DoClick = function ()
    		RunConsoleCommand( "say /job cabby" )
        end
    	
    	local ButtonHitman = vgui.Create( "DButton" )
    	
    	ButtonHitman.DoClick = function()
    		ButtonHitman:SetParent( DermaPanel )
    		ButtonHitman:SetText( "Hitman" ) 
    		ButtonHitman:SetPos( 115, 50 )
    		ButtonHitman:SetSize( 150, 50 )
    		ButtonHitman.DoClick = function ()
    		RunConsoleCommand( "say /job hitman" )
        end	
    end
    
    ConCommand.Add("jobmenu", Menu)
    cl_init and init.lua call this file the right way, and at the bottom of init.lua I have:

    Code:
    function GM:ShowSpare2( ply )
        ply:ConCommand( "jobmenu" )
    end
    The showspare1 command references to the F3 key. But when I hit f3, it says in the console window basically that jobmenu is undefined... when it is.

IMN logo majestic logo threadwatch logo seochat tools logo