Im New To Derma

What and its ok?

[editline]25th August 2015[/editline]

Ok, so basically, i added it to my server with all that code in a cl_policemenu.lua and basically nothing happens when i hit F4, what do i do?


vgui.Create("police")

There you should create the dframe instead of doing that unless you’ve added to the vgui library the “police” thing.
As you first was trying to do.
Also, it should give you a lua error cause of that.

Wait were do i put it


local Police = vgui.Create ( "DFrame" )

vgui.Create("police")

Frame:SetPos( 5, 5 )
Frame:SetSize( 900, 600 )

?

Where the vgui.Create(“police”) you should put that

So i done it correctly?

[editline]28th August 2015[/editline]

I get this error


 [ERROR] addons/police menu/lua/autorun/client/cl_police.lua:13: function arguments expected near '='
  1. unknown - addons/police menu/lua/autorun/client/cl_police.lua:0



Okay, not to be rude, but you should start reading and thinking about what everything does logically if you want to get anywhere in lua

You’ve got



local Police = vgui.Create("DFrame")


And yet below it’s



Frame:SetPos( 5, 5 )
Frame:SetSize( 900, 600 )


What is Frame? Where is it defined? You should be using Police, or whatever variable you’re using for the vgui.Create bit - Just like you’ve done below correctly with:



local Button = vgui.Create ( "DButton", Frame )
Button:SetText( "I Under Stand." )


So it should be


 Police.SetPos 

?

But yeah, and get ride of the second 'vgui.Create(“DFrame”) that isn’t attached to a variable



Police:SetPos(5,5)


Thank Ye.

[editline]28th August 2015[/editline]


 local Police = vgui.Create ( "DFrame" )

Police:SetPos( 5, 5 )
Police:SetSize( 900, 600 )
Police:SetTitle( "CivilisationRP: Police Radio Codes" )
Police:SetVisable( "true" )
Police:SetDraggable( "true" )
Police:ShowCloseButton( "true" )
Police:MakePopup()
Police:Paint = function( self, w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 200 ) )
end

local Button = vgui.Create ( "DButton", Frame )
Button:SetText( "I Under Stand." )
Button:SetTextColor( Color(" 255, 255, 255, 255 ") )
Button:SetPos( 800, 500 )
Button:SetSize( 100, 30 )
Button.Paint = function( self, w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 200 ))
end

Button.DoClick = function()
		RunConsoleCommand( "say", "/group Im a new officer, whats are my orders?" )
		Frame:Remove() 
end

hook.Add( "PlayerBindPress", "F4", function(client, bind, pressed)
	bind = bind:lower()
	
	print("binding")
	
	if (bind:find("gm_showhelp") and pressed) then
		return true 
	 elseif (bind:find("gm_showspare1") and pressed) then
        return true
    elseif (bind:find("gm_showspare2") and pressed) then
        -- F4 key
        vgui.Create("Police")
        return true
    end
end)
	


?

You’re parenting your button to “Frame” which again, like Niandra said, is non-existent.

Your code is all over the place, I understand you’re new to lua but one part of your code is correct and the next is not. Example:


Police:Paint = function( self, w, h )

    draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 200 ) )

end

should be


Police.Paint = function( self, w, h )

    draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 200 ) )

end


  local Police = vgui.Create ( "DFrame" )

Police:SetPos( 5, 5 )
Police:SetSize( 900, 600 )
Police:SetTitle( "CivilisationRP: Police Radio Codes" )
Police:SetVisable( "true" )
Police:SetDraggable( "true" )
Police:ShowCloseButton( "true" )
Police:MakePopup()
Police.Paint = function( self, w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 200 ) )
end

local Button = vgui.Create ( "DButton", Police )

Button:SetText( "I Under Stand." )
Button:SetTextColor( Color(" 255, 255, 255, 255 ") )
Button:SetPos( 800, 500 )
Button:SetSize( 100, 30 )
Button.Paint = function( self, w, h )
		draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 200 ))
end

Button.DoClick = function()
		RunConsoleCommand( "say", "/group Im a new officer, whats are my orders?" )
		Frame:Remove() 
end

hook.Add( "PlayerBindPress", "F4", function(client, bind, pressed)
	bind = bind:lower()
	
	print("binding")
	
	if (bind:find("gm_showhelp") and pressed) then
		return true 
	 elseif (bind:find("gm_showspare1") and pressed) then
        return true
    elseif (bind:find("gm_showspare2") and pressed) then
        -- F4 key
        vgui.Create("Police")
        return true
    end
end) 

?? I think I under stand but I fixed everything using your information to help me.