Turning Info collected from DermaPanels into a team?
7 replies, posted
Hello,
I was wondering if this could be done, and if you could help be set this up.
[CODE]net.Receive( "Factions", function()
local dermp = vgui.Create( "DFrame" )
dermp:SetTitle("Faction Menu")
dermp:SetSkin("stronghold")
dermp:SetDraggable(true)
dermp:SetDeleteOnClose(false)
dermp:SetKeyboardInputEnabled(true)
dermp:SetMouseInputEnabled(true)
dermp:MakePopup()
dermp:SetSize(ScrW() / 4, 400)
dermp:SetPos(ScrW() / 2 - (dermp:GetWide() / 2), 50)
dermp:Center()
local line = 30
local tab = 0
local PropertySheet = vgui.Create( "DPropertySheet", dermp )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( 330, 365 )
local SheetItemOne = vgui.Create( "DPanel", PropertySheet )
SheetItemOne:SetPos( 2, 2 )
local cover = vgui.Create( "DFrame", dermp )
cover:SetSize( 2, 10 )
cover:SetPos( 4.0, 48 )
cover:ShowCloseButton( false )
cover:SetDraggable( false )
function cover:Paint()
draw.RoundedBox( 0, 0, 0, 8, 10, Color( 108, 111, 114 ) )
end
local facnamelabel = vgui.Create("DLabel", SheetItemOne)
facnamelabel:SetPos(5,5)
facnamelabel:SetText("Faction Name")
--facnamelabel.SetTextColor
facnamelabel:SizeToContents()
local factextname = vgui.Create("DTextEntry",SheetItemOne)
factextname:SetSize(300, 25)
factextname:SetPos(5, 30)
local facpwlabel = vgui.Create("DLabel", SheetItemOne)
facpwlabel:SetPos(5,60)
facpwlabel:SetText("Faction Password")
facpwlabel:SizeToContents()
local facpw = vgui.Create("DTextEntry", SheetItemOne)
facpw:SetSize(300, 25)
facpw:SetPos(5, 84)
local tcollabel = vgui.Create("DLabel", SheetItemOne)
tcollabel:SetPos(5, 115) //140
tcollabel:SetText("Faction Color")
tcollabel:SizeToContents()
local tcolor = vgui.Create("DColorMixer", SheetItemOne)
tcolor:SetSize(300, 150)
tcolor:SetPos(5, 130) //160
local button = vgui.Create("DButton", SheetItemOne)
button:SetSize(300, 30)
button:SetPos(5, 290) //315
button:SetText("Create Your Faction!")
button.DoClick = function()
RunConsoleCommand("fac_create", factextname:GetValue(), tcolor:GetColor().r, tcolor:GetColor().g, tcolor:GetColor().b, facpw:GetValue())
dermp:SetVisible(false)
end
PropertySheet:AddSheet( "Create", SheetItemOne, "gui/silkicons/user",
false, false, "" )
end )[/CODE]
Above is my derma panel which asks the player what name, password, and color he/she would like then proceeds to create the team in-which i could call upon it in my future scoreboard and on my hud in text.
[url]http://wiki.garrysmod.com/page/team/SetUp[/url]
or
You could have a table that saves every factions details (name, color, pass and members), and as people join/leave update the member portion of that table, and on the scoreboard just display the player's faction details.
So how exactly would i call upon the data someone has filled out?
[CODE]net.Receive( "Factions", function()
local dermp = vgui.Create( "DFrame" )
dermp:SetTitle("Faction Menu")
dermp:SetSkin("stronghold")
dermp:SetDraggable(true)
dermp:SetDeleteOnClose(false)
dermp:SetKeyboardInputEnabled(true)
dermp:SetMouseInputEnabled(true)
dermp:MakePopup()
dermp:SetSize(ScrW() / 4, 400)
dermp:SetPos(ScrW() / 2 - (dermp:GetWide() / 2), 50)
dermp:Center()
local line = 30
local tab = 0
local PropertySheet = vgui.Create( "DPropertySheet", dermp )
PropertySheet:SetPos( 5, 30 )
PropertySheet:SetSize( 330, 365 )
local SheetItemOne = vgui.Create( "DPanel", PropertySheet )
SheetItemOne:SetPos( 2, 2 )
local cover = vgui.Create( "DFrame", dermp )
cover:SetSize( 2, 10 )
cover:SetPos( 4.0, 48 )
cover:ShowCloseButton( false )
cover:SetDraggable( false )
function cover:Paint()
draw.RoundedBox( 0, 0, 0, 8, 10, Color( 108, 111, 114 ) )
end
local facnamelabel = vgui.Create("DLabel", SheetItemOne)
facnamelabel:SetPos(5,5)
facnamelabel:SetText("Faction Name")
--facnamelabel.SetTextColor
facnamelabel:SizeToContents()
local factextname = vgui.Create("DTextEntry",SheetItemOne)
factextname:SetSize(300, 25)
factextname:SetPos(5, 30)
local facpwlabel = vgui.Create("DLabel", SheetItemOne)
facpwlabel:SetPos(5,60)
facpwlabel:SetText("Faction Password")
facpwlabel:SizeToContents()
local facpw = vgui.Create("DTextEntry", SheetItemOne)
facpw:SetSize(300, 25)
facpw:SetPos(5, 84)
local tcollabel = vgui.Create("DLabel", SheetItemOne)
tcollabel:SetPos(5, 115) //140
tcollabel:SetText("Faction Color")
tcollabel:SizeToContents()
local tcolor = vgui.Create("DColorMixer", SheetItemOne)
tcolor:SetSize(300, 150)
tcolor:SetPos(5, 130) //160
local button = vgui.Create("DButton", SheetItemOne)
button:SetSize(300, 30)
button:SetPos(5, 290) //315
button:SetText("Create Your Faction!")
button.DoClick = function()
RunConsoleCommand("bw_create", factextname:GetValue(), tcolor:GetColor().r, tcolor:GetColor().g, tcolor:GetColor().b, facpw:GetValue())
team.SetUp( 1, factextname:GetValue(),Color( tcolor:GetColor().r, tcolor:GetColor().g, tcolor:GetColor().b ) )
dermp:SetVisible(false)
end
ply:PrintMessage( HUD_PRINTCENTER, "factextname:GetValue()" )
PropertySheet:AddSheet( "Create", SheetItemOne, "gui/silkicons/user",
false, false, "" )
end )[/CODE]
I tried that but it did not work, did i call the information incorrectly? how would i make the create your faction info save somewhere to a file so i can call to it, can you explain how to call those values from another file aswell?
bump?
27% of Derma Panels really like the way it looks.
Keep[ up the good work I am very proud of you.
[QUOTE=circuitbawx;46674261]27% of Derma Panels really like the way it looks.
Keep[ up the good work I am very proud of you.[/QUOTE]
what..?
So, when a user has changed information there is usually a callback for when the data changes such as OnToggle... But, some other elements have ways of getting data with functions, others you have to kind of figure it out by following variables...
Take a look at your SERVER/garrysmod/lua/vgui/ folder; if there is some odd roundabout way of getting data, those will give hints. Usually there are getters such as GetText, etc... which can be seen by printing out the meta-table of panel...
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/metatables/__metatables_sorted_func_names.rar[/url]
or
[url]https://dl.dropboxusercontent.com/u/26074909/tutoring/metatables/cl_panel_metatable.txt[/url]
Getters are from line 64 to 95 but there may be others which are like _p:Health / _p:Armor... -- but these are only from the C base Panel.
[code][64] = GetAlpha
[65] = GetBounds
[66] = GetCaretPos
[67] = GetChild
[68] = GetChildPosition
[69] = GetChildren
[70] = GetChildrenInRect
[71] = GetClassName
[72] = GetClosestChild
[73] = GetContentSize
[74] = GetCookie
[75] = GetCookieName
[76] = GetCookieNumber
[77] = GetDock
[78] = GetFont
[79] = GetHTMLMaterial
[80] = GetName
[81] = GetNumLines
[82] = GetParent
[83] = GetPos
[84] = GetSelectedChildren
[85] = GetSelectionCanvas
[86] = GetSize
[87] = GetSkin
[88] = GetTable
[89] = GetTall
[90] = GetText
[91] = GetTextInset
[92] = GetTextSize
[93] = GetValidReceiverSlot
[94] = GetValue
[95] = GetWide[/code]
I received help from Nook, thanks for everyone else that posted!
Sorry, you need to Log In to post a reply to this thread.