Hello everyone!
I have a few problems with the F4 Menu Tab I am creating for my DarkRP Server.
I would like to have multiple buttons on my tab and when I press them I would like to run a command.
But I don't know how to resize the buttons. I tried changing DermaButton:SetSize( width, height ), but the button will still take up the entire tab panel, as you can see in this image: [URL="http://i.imgur.com/MRvRJA6.jpg"]http://i.imgur.com/MRvRJA6.jpg[/URL]
And every time I open the F4 Menu, a white/grey square appears in the top left corner of my screen and it doesn't go away, even if I close the F4 Menu.
And when I run the /say command with an argument and a value of a text entry it outputs this: /dropmoney" "600 in chat as you can see in this image: [URL="http://i.imgur.com/a3Z8Eq4.jpg"]http://i.imgur.com/a3Z8Eq4.jpg[/URL]
This is the code I used:
[CODE]/*---------------------------------------------------------------------------
F4 menu tab modification module.
---------------------------------------------------------------------------*/
local url = "http://wiki.darkrp.com/index.php/Main_Page"
local tabName = "Commands"
local function createF4MenuTab()
// DarkRP.switchTabOrder(1, 7) -- Remove the "//" in this line if you want to move the third tab to the left of the second tab!
// DarkRP.removeF4MenuTab("Ammo") -- Remove the "//" in this line if you want to remove the Ammo tab!
local panel = vgui.Create("DPanel")
local DermaButton = vgui.Create( "DButton", panel )
DermaButton:SetText( "Drop Current Weapon" )
DermaButton:SetPos( 1, 1 )
DermaButton:SetSize( 1, 1 )
DermaButton:SetVisible( false )
DermaButton.DoClick = function ()
RunConsoleCommand("drop")
end
local panel = vgui.Create("DPanel")
local DermaButton = vgui.Create( "DButton", panel )
DermaButton:SetText( "Drop Money" )
DermaButton:SetPos( 1, 1 )
DermaButton:SetSize( 1, 1 )
DermaButton:SetVisible( false )
DermaButton.DoClick = function ()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 480,240 )
DermaPanel:SetSize( 460, 100 )
DermaPanel:SetTitle( "Drop Money" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local DermaText = vgui.Create( "DTextEntry", DermaPanel )
DermaText:SetPos( 5,50 )
DermaText:SetTall( 20 )
DermaText:SetWide( 450 )
DermaText:SetEnterAllowed( true )
DermaText.OnEnter = function()
RunConsoleCommand( "say", "/dropmoney", DermaText:GetValue())
DermaPanel:Close()
end
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel )
DermaButton:SetText( "OK!" )
DermaButton:SetPos( 200, 73 )
DermaButton:SetSize( 60, 20 )
DermaButton.DoClick = function ()
RunConsoleCommand( "say", "/dropmoney", DermaText:GetValue())
DermaPanel:Close()
end
end
DarkRP.addF4MenuTab(tabName, DermaButton)
end
hook.Add("F4MenuTabs", "MyCustomF4MenuTab", createF4MenuTab)
[/CODE]
This is the file name and location: DarkRPModification\lua\darkrp_modules\extraf4tab\cl_fancytab.lua
I appreciate any help.
Thanks in advance,
mut0
Sorry, just saw I had to post DarkRP questions in a thread. Sorry 'bout that :S
Sorry, you need to Log In to post a reply to this thread.