Alright, I'm trying to make a derma menu, but seem to be failing...can anyone tell me where I fucked up?
cl_init:
[lua]
--DERMA START
-- UNDER CONSTRUCTION
function ProwMenu()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 620, 430 )
DermaPanel:SetTitle( "Prowlers Gaming" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( DermaPanel )
PropertySheet:SetPos( 10, 10 )
PropertySheet:SetSize( 615, 425 )
local SheetItemOne = vgui.Create( "DImage" )
SheetItemOne:SetSize(602, 127)
SheetItemOne:SetPos(20, 40)
SheetItemOne:SetImage('gui/prow/logo')
SheetItemOne:SizeToContents()
local SheetItemTwo = vgui.Create( "DCheckBoxLabel" )
SheetItemTwo:SetText( "Use Props?" )
SheetItemTwo:SetConVar( "some_convar" )
SheetItemTwo:SetValue( 1 )
SheetItemTwo:SizeToContents()
local SheetItemThree = vgui.Create( "DCheckBoxLabel" )
SheetItemThree:SetText( "Use Props?" )
SheetItemThree:SetConVar( "some_convar" )
SheetItemThree:SetValue( 1 )
SheetItemThree:SizeToContents()
local SheetItemFour = vgui.Create( "DCheckBoxLabel" )
SheetItemFour:SetText( "Use Props?" )
SheetItemFour:SetConVar( "some_convar" )
SheetItemFour:SetValue( 1 )
SheetItemFour:SizeToContents()
local SheetItemFive = vgui.Create( "DCheckBoxLabel" )
SheetItemFive:SetText( "Use Props?" )
SheetItemFive:SetConVar( "some_convar" )
SheetItemFive:SetValue( 1 )
SheetItemFive:SizeToContents()
local SheetItemSix = vgui.Create( "DCheckBoxLabel" )
SheetItemSix:SetText( "Use Props?" )
SheetItemSix:SetConVar( "some_convar" )
SheetItemSix:SetValue( 1 )
SheetItemSic:SizeToContents()
PropertySheet:AddSheet( "Information", SheetItemOne, "gui/silkicons/information", false, false, "Community Information" )
PropertySheet:AddSheet( "Rules", SheetItemTwo, "gui/silkicons/shield", false, false, "Server Rules" )
PropertySheet:AddSheet( "Donations", SheetItemThree, "gui/silkicons/medal", false, false, "Donation Information" )
PropertySheet:AddSheet( "Radio", SheetItemFour, "gui/silkicons/sound", false, false, "Radio Modual" )
PropertySheet:AddSheet( "Store", SheetItemFive, "gui/silkicons/money", false, false, "Chracter Store" )
PropertySheet:AddSheet( "Settings", SheetItemSix, "gui/silkicons/wrench", false, false, "Character Settings" )
end
usermessage.Hook( "ProwMenu", ProwMenu )
--DERMA END
[/lua]
init:
[lua]
function GM:ShowSpare2( ply )
SendUserMessage("ProwMenu", ply)
end
[/lua]
Edit:
Heres a picture of the problem:
[IMG]http://i704.photobucket.com/albums/ww45/prowler-98/gm_construct0002.jpg[/IMG]
Your DPanel isn't parented to the frame, or is too big for the frame.
None of your sheet items are parented, they're just gonna position themselves relative to the clients screen
Yeah just looking over it, nothing at all is parented.
oh FFFFFFffffffffffffffuuuuuuuuuu that makes sense, thanks guys, I feel dumb now xD
[editline]03:14PM[/editline]
Well, I added parents..but it seems to still not be working, I tried a few thing sbut they didn't work.
CODE:
[lua]
--DERMA START
-- UNDER CONSTRUCTION
function ProwMenu()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 620, 500 )
DermaPanel:SetTitle( "Prowlers Gaming" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( true )
DermaPanel:MakePopup()
local PropertySheet = vgui.Create( "DPropertySheet" )
PropertySheet:SetParent( DermaPanel )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( 605, 385 )
local SheetItemOne = vgui.Create( "DImage" )
SheetItemOne:SetParent( DermaPanel )
SheetItemOne:SetSize(602, 127)
SheetItemOne:SetPos(20, 40)
SheetItemOne:SetImage('gui/prow/logo')
SheetItemOne:SizeToContents()
local SheetItemTwo = vgui.Create( "DCheckBoxLabel" )
SheetItemTwo:SetParent( DermaPanel )
SheetItemTwo:SetText( "Use Props?" )
SheetItemTwo:SetConVar( "some_convar" )
SheetItemTwo:SetValue( 1 )
SheetItemTwo:SizeToContents()
local SheetItemThree = vgui.Create( "DCheckBoxLabel" )
SheetItemThree:SetParent( DermaPanel )
SheetItemThree:SetText( "Use Props?" )
SheetItemThree:SetConVar( "some_convar" )
SheetItemThree:SetValue( 1 )
SheetItemThree:SizeToContents()
local SheetItemFour = vgui.Create( "DCheckBoxLabel" )
SheetItemFour:SetParent( DermaPanel )
SheetItemFour:SetText( "Use Props?" )
SheetItemFour:SetConVar( "some_convar" )
SheetItemFour:SetValue( 1 )
SheetItemFour:SizeToContents()
local SheetItemFive = vgui.Create( "DCheckBoxLabel" )
SheetItemFive:SetParent( DermaPanel )
SheetItemFive:SetText( "Use Props?" )
SheetItemFive:SetConVar( "some_convar" )
SheetItemFive:SetValue( 1 )
SheetItemFive:SizeToContents()
local SheetItemSix = vgui.Create( "DCheckBoxLabel" )
SheetItemSix:SetParent( DermaPanel )
SheetItemSix:SetText( "Use Props?" )
SheetItemSix:SetConVar( "some_convar" )
SheetItemSix:SetValue( 1 )
SheetItemSic:SizeToContents()
end
PropertySheet:AddSheet( "Information", SheetItemOne, "gui/silkicons/information", false, false, "Community Information" )
PropertySheet:AddSheet( "Rules", SheetItemTwo, "gui/silkicons/shield", false, false, "Server Rules" )
PropertySheet:AddSheet( "Donations", SheetItemThree, "gui/silkicons/medal", false, false, "Donation Information" )
PropertySheet:AddSheet( "Radio", SheetItemFour, "gui/silkicons/sound", false, false, "Radio Modual" )
PropertySheet:AddSheet( "Store", SheetItemFive, "gui/silkicons/money", false, false, "Chracter Store" )
PropertySheet:AddSheet( "Settings", SheetItemSix, "gui/silkicons/wrench", false, false, "Character Settings" )
usermessage.Hook( "ProwMenu", ProwMenu )
--DERMA END
[/lua]
Same problem?
Essentially, everything is in the frame now...but my panels don't show up or anythings, ive also downsized the panels.
Picture,
Try using a concommand not usermessage, I had a problem where nothing showed up and I did a concommand and it worked.
usermessages are the most efficient way for a Derma Panel.
But by the looks of it, you've set some things too big for the derma panel
Take a look at this code of mine, it's untested but should work perfectly:
[B]cl_init.lua:[/B]
[lua]function SelectionMenu()
--Local Variables for later use
local ply = LocalPlayer()
--VGUI Content
local Frame = vgui.Create('DFrame')
local Tabs = vgui.Create('DPropertySheet')
local CharacterSelectionSheet = vgui.Create('DPanel')
local RulesSheet = vgui.Create('DPanel')
local AdminCommandsSheet = vgui.Create('DPanel')
local SelectClassTitle = vgui.Create('DLabel')
local SelectWeaponTitle = vgui.Create('DLabel')
local YourWeapon = vgui.Create('DLabel')
local SelectYourModel = vgui.Create('DLabel')
local SetYourName = vgui.Create('DLabel')
local SpawnTimer = vgui.Create('DLabel')
local Rules = vgui.Create('DLabel')
local AssaultButton = vgui.Create('DButton')
local EngineerButton = vgui.Create('DButton')
local MedicButton = vgui.Create('DButton')
local ReconButton = vgui.Create('DButton')
local PrimaryWeapon = vgui.Create('DMultiChoice')
local SecondaryWeapon = vgui.Create('DMultiChoice')
local GodMode = vgui.Create('DCheckBoxLabel')
local Noclip = vgui.Create('DCheckBoxLabel')
--Rules List
local Rules = {}
Rules[1] = ( "Welcome to "..GetConVar('hostname').." have fun!".."\n\n" )
Rules[2] = ( "\n\n" )
Rules[3] = ( "\n\n" )
Rules[4] = ( "\n\n" )
Rules[5] = ( "\n\n" )
Rules[6] = ( "Visit LuckyCentral.com for more information!.*\n" )
Rules[7] = ( "\n" )
Rules[8] = ( "\n" )
Rules[9] = ( "\n" )
Rules[10] = ( "Rules:\n\n" )
Rules[11] = ( "1) No Racism of ANY kind\n" )
Rules[12] = ( "2) No Cussing\n" )
Rules[13] = ( "3) No Spam( Microphone, Chat e.t.c. )\n" )
Rules[14] = ( "\n" )
Rules[15] = ( "Obey Admins\n\n" )
Rules[16] = ( "Follow these rules or get a kick, and a warning\n" )
Rules[17] = ( "A total of 2 warnings is allowed, if you break rules again, a ban will be issued" )
local PanelWide = Frame:GetWide() - 20
local PanelTall = Frame:GetTall() - 60
-- Main Body
Frame:Center()
Frame:SetSize(ScrW()/1.5, ScrH()/1.5)
Frame:SetTitle("Welcome to " ..GetConVar('hostname').. ". Enjoy your Stay")
Frame:SetVisible(true)
Frame:SetDraggable(false)
Frame:MakePopup()
Frame:ShowCloseButton(false)
--Setting up the tabs
Tabs:SetParent(Frame)
Tabs:SetPos(10, 30)
Tabs:SetSize(PanelWide, PanelTall)
--Panels
CharacterSelectionSheet:SetSize(PanelWide, PanelTall)
RulesSheet:SetSize(PanelWide, PanelTall)
AdminCommandsSheet:SetSize(PanelWide, PanelTall)
Tabs:AddSheet( "Class", CharacterSelectionSheet, "gui/silkicons/user", false, false, "Character" )
Tabs:AddSheet( "Rules", RulesSheet, "gui/silkicons/exclamation", false, false, "Rules!" )
Tabs:AddSheet( "Admin", AdminCommandsSheet, "gui/silkicons/group", false, false, "Admin-Only" )
--Class sheet Contents
SelectClassTitle:SetParent(CharacterSelectionSheet)
SelectClassTitle:SetPos(20, 20)
SelectClassTitle:SetText('Select a Class')
SelectClassTitle:SizeToContents()
SelectClassTitle:SetWrap(true)
AssaultButton:SetParent(CharacterSelectionSheet)
AssaultButton:SetSize(50, 30)
AssaultButton:SetPos(20, 40)
AssaultButton:SetText('Assault')
EngineerButton:SetParent(CharacterSelectionSheet)
EngineerButton:SetSize(50, 30)
EngineerButton:SetPos(90, 40)
EngineerButton:SetText('Engineer')
MedicButton:SetParent(CharacterSelectionSheet)
MedicButton:SetSize(30, 50)
MedicButton:SetPos(20, 90)
MedicButton:SetText('Medic')
ReconButton:SetParent(CharacterSelectionSheet)
ReconButton:SetSize(50, 30)
ReconButton:SetPos(90, 90)
ReconButton:SetText('Recon')
SelectWeaponTitle:SetParent(CharacteerSelectionSheet)
SelectWeaponTitle:SetPos(20, 150)
SelectWeaponTitle:SetText('Select Your Weapons')
SelectWeaponTitle:SizeToContents()
SelectWeaponTitle:SetWrap(true)
PrimaryWeapon:SetParent(CharacterSelectionSheet)
PrimaryWeapon:SetPos(20, 170)
PrimaryWeapon:SetSize(100, 20)
PrimaryWeapon:AddChoice('M4A1')
PrimaryWeapon:AddChoice('AK47')
PrimaryWeapon:AddChoice('FAMAS')
SecondaryWeapon:SetParent(CharacterSelectionSheet)
SecondaryWeapon:SetPos(20, 190)
SecondaryWeapon:SetSize(100, 20)
SecondaryWeapon:AddChoice('M9')
SecondaryWeapon:AddChoice('USP')
SecondaryWeapon:AddChoice('Colt M1911')
YourWeapon:SetParent(CharacterSelectionSheet)
YourWeapon:SetPos(20, 210)
YourWeapon:SetMultiline(true)
YourWeapon:SetText('Primary: ' ..PrimaryWeapon:GetValue().. '\n Secondary: ' ..SecondaryWeapon:GetValue())
YourWeapon:SizeToContents()
YourWeapon:SetWrap(true)
--Rules Sheet
Rules:SetParent(RulesSheet)
Rules:SetPos(50, 60)
Rules:SetMultiline(true)
Rules:SetText(table.concat(Rules))
Rules:SizeToContents()
Rules:SetWrap(true)
--Admin Sheet
GodMode:SetParent(AdminCommandSheet)
GodMode:SetPos(20, 40)
GodMode:SetText('GodMode Toggle')
GodMode:SetConVar('sbox_godmode')
GodMode:SetValue(0)
GodMode:SizeToContents()
Noclip:SetParent(AdminCommandSheet)
Noclip:SetPos(20, 60)
Noclip:SetText('Allow Noclip?')
Noclip:SetConVar('sbox_noclip')
Noclip:SetValue(0)
Noclip:SizeToContents()
end
usermessage.Hook("DMenu", SelectionMenu)[/lua]
[B]init.lua:[/B]
[lua]function GM:ShowSpare2(ply)
SendUserMessage("DMenu", ply)
end[/lua]
It's not the same as yours, but shows an efficient way of setting out PropertySheets, and not everything in there is set up, I have not finished it.
Thank you =D
Do you mind if I take this code and edit it from there?
If you want, it's unfinished, but y'know
Alright, well I edited that code, still seems not to be working for me however, it just displays a small rectangular box in the top left.
[lua]
function GeneralMenu()
-- VGUI CONTENT --
local Frame = vgui.Create('DFrame')
local Tabs = vgui.Create('DPropertySheet')
local page1 = vgui.Create('DPanel')
local page2 = vgui.Create('DPanel')
local Info = vgui.Create('DLabel')
local Rules = vgui.Create('DLabel')
-- INFORMATION TEXT --
local Info = {}
Info[1] = ( "Welcome to "..GetConVar('hostname').." have fun!".."\n\n" )
Info[2] = ( "\n\n" )
Info[3] = ( "\n\n" )
Info[4] = ( "\n\n" )
Info[5] = ( "\n\n" )
Info[6] = ( "Visit LuckyCentral.com for more information!.*\n" )
Info[7] = ( "\n" )
Info[8] = ( "\n" )
Info[9] = ( "\n" )
Info[10] = ( "Info:\n\n" )
Info[11] = ( "1) No Racism of ANY kind\n" )
Info[12] = ( "2) No Cussing\n" )
Info[13] = ( "3) No Spam( Microphone, Chat e.t.c. )\n" )
Info[14] = ( "\n" )
Info[15] = ( "Obey Admins\n\n" )
Info[16] = ( "Follow these Info or get a kick, and a warning\n" )
Info[17] = ( "A total of 2 warnings is allowed, if you break rules again, a ban will be issued" )
-- RULES LIST --
local Rules = {}
Rules[1] = ( "Welcome to "..GetConVar('hostname').." have fun!".."\n\n" )
Rules[2] = ( "\n\n" )
Rules[3] = ( "\n\n" )
Rules[4] = ( "\n\n" )
Rules[5] = ( "\n\n" )
Rules[6] = ( "Visit LuckyCentral.com for more information!.*\n" )
Rules[7] = ( "\n" )
Rules[8] = ( "\n" )
Rules[9] = ( "\n" )
Rules[10] = ( "Rules:\n\n" )
Rules[11] = ( "1) No Racism of ANY kind\n" )
Rules[12] = ( "2) No Cussing\n" )
Rules[13] = ( "3) No Spam( Microphone, Chat e.t.c. )\n" )
Rules[14] = ( "\n" )
Rules[15] = ( "Obey Admins\n\n" )
Rules[16] = ( "Follow these rules or get a kick, and a warning\n" )
Rules[17] = ( "A total of 2 warnings is allowed, if you break rules again, a ban will be issued" )
local PanelWide = Frame:GetWide() - 20
local PanelTall = Frame:GetTall() - 60
-- MAIN BODY --
Frame:Center()
Frame:SetSize(ScrW()/1.5, ScrH()/1.5)
Frame:SetTitle("Prowlers Gaming")
Frame:SetVisible(true)
Frame:SetDraggable(false)
Frame:MakePopup()
Frame:ShowCloseButton(true)
--SETTING TABS --
Tabs:SetParent(Frame)
Tabs:SetPos(10, 30)
Tabs:SetSize(PanelWide, PanelTall)
-- PANELS --
page1:SetSize(PanelWide, PanelTall)
page2:SetSize(PanelWide, PanelTall)
-- ADDING SHEETS --
Tabs:AddSheet( "Information", page1, "gui/silkicons/information", false, false, "Community information" )
Tabs:AddSheet( "Rules", page2, "gui/silkicons/shield", false, false, "Server Rules" )
-- INFORMATION --
Info:SetParent(page1)
Info:SetPos(50, 60)
Info:SetMultiline(true)
Info:SetText(table.concat(Info))
Info:SizeToContents()
Info:SetWrap(true)
-- RULES --
Rules:SetParent(page2)
Rules:SetPos(50, 60)
Rules:SetMultiline(true)
Rules:SetText(table.concat(Rules))
Rules:SizeToContents()
Rules:SetWrap(true)
end
usermessage.Hook("ProwMenu", GeneralMenu)
[/lua]
[lua]local PanelWide = Frame:GetWide() - 20
local PanelTall = Frame:GetTall() - 60 [/lua]
You're trying to get the frame's width and height before you set it... that whole code is kind of a mess.
I can helpz you add me on steam fp is too slow
<------
[lua]function GeneralMenu()
-- VGUI CONTENT --
local Frame = vgui.Create('DFrame')
local Tabs = vgui.Create('DPropertySheet')
local page1 = vgui.Create('DPanel')
local page2 = vgui.Create('DPanel')
local Info = vgui.Create('DLabel')
local Rules = vgui.Create('DLabel')
-- INFORMATION TEXT --
local Info = {}
Info[1] = ( "Welcome to "..GetConVar('hostname').." have fun!".."\n\n" )
Info[2] = ( "\n\n" )
Info[3] = ( "\n\n" )
Info[4] = ( "\n\n" )
Info[5] = ( "\n\n" )
Info[6] = ( "Visit LuckyCentral.com for more information!.*\n" )
Info[7] = ( "\n" )
Info[8] = ( "\n" )
Info[9] = ( "\n" )
Info[10] = ( "Info:\n\n" )
Info[11] = ( "1) No Racism of ANY kind\n" )
Info[12] = ( "2) No Cussing\n" )
Info[13] = ( "3) No Spam( Microphone, Chat e.t.c. )\n" )
Info[14] = ( "\n" )
Info[15] = ( "Obey Admins\n\n" )
Info[16] = ( "Follow these Info or get a kick, and a warning\n" )
Info[17] = ( "A total of 2 warnings is allowed, if you break rules again, a ban will be issued" )
-- RULES LIST --
local Rules = {}
Rules[1] = ( "Welcome to "..GetConVar('hostname').." have fun!".."\n\n" )
Rules[2] = ( "\n\n" )
Rules[3] = ( "\n\n" )
Rules[4] = ( "\n\n" )
Rules[5] = ( "\n\n" )
Rules[6] = ( "Visit LuckyCentral.com for more information!.*\n" )
Rules[7] = ( "\n" )
Rules[8] = ( "\n" )
Rules[9] = ( "\n" )
Rules[10] = ( "Rules:\n\n" )
Rules[11] = ( "1) No Racism of ANY kind\n" )
Rules[12] = ( "2) No Cussing\n" )
Rules[13] = ( "3) No Spam( Microphone, Chat e.t.c. )\n" )
Rules[14] = ( "\n" )
Rules[15] = ( "Obey Admins\n\n" )
Rules[16] = ( "Follow these rules or get a kick, and a warning\n" )
Rules[17] = ( "A total of 2 warnings is allowed, if you break rules again, a ban will be issued" )
-- MAIN BODY --
Frame:Center()
Frame:SetSize(ScrW()/1.5, ScrH()/1.5)
Frame:SetTitle("Prowlers Gaming")
Frame:SetVisible(true)
Frame:SetDraggable(false)
Frame:MakePopup()
Frame:ShowCloseButton(true)
local PanelWide = Frame:GetWide() - 20
local PanelTall = Frame:GetTall() - 60
--SETTING TABS --
Tabs:SetParent(Frame)
Tabs:SetPos(10, 30)
Tabs:SetSize(PanelWide, PanelTall)
-- PANELS --
page1:SetSize(PanelWide, PanelTall)
page2:SetSize(PanelWide, PanelTall)
-- ADDING SHEETS --
Tabs:AddSheet( "Information", page1, "gui/silkicons/information", false, false, "Community information" )
Tabs:AddSheet( "Rules", page2, "gui/silkicons/shield", false, false, "Server Rules" )
-- INFORMATION --
Info:SetParent(page1)
Info:SetPos(50, 60)
Info:SetMultiline(true)
Info:SetText(table.concat(Info))
Info:SizeToContents()
Info:SetWrap(true)
-- RULES --
Rules:SetParent(page2)
Rules:SetPos(50, 60)
Rules:SetMultiline(true)
Rules:SetText(table.concat(Rules))
Rules:SizeToContents()
Rules:SetWrap(true)
end
usermessage.Hook("ProwMenu", GeneralMenu)[/lua]
I've edited your code, as Entoros pointed out, it was untested, but still.
Sorry, you need to Log In to post a reply to this thread.