• DListPanel - Help PLS
    10 replies, posted
[LUA] function DA_Shop() --Shop System Menu = vgui.Create("DFrame") Menu:SetPos(ScrW() / 4,ScrH() / 4) Menu:SetSize(ScrW() / 2, ScrH() / 2+50) Menu:SetTitle("Shop Menu") Menu:SetDraggable(true) Menu:ShowCloseButton(true) Menu:SetVisible(true) Menu:MakePopup() Player_Inventory = vgui.Create( "DPanelList" , Menu) Player_Inventory:EnableVerticalScrollbar( true ) Player_Inventory:EnableHorizontal( true ) Player_Inventory:SetSpacing( 5 ) Player_Inventory:SetPadding( 5 ) Player_Inventory:SetPos(10,40) Player_Inventory:SetSize(ScrW() / 4 - 20,ScrH() / 2-20) Shop = vgui.Create( "DPanelList" , Menu) Shop:EnableVerticalScrollbar( true ) Shop:EnableHorizontal( false ) Shop:SetSpacing( 5 ) Shop:SetPadding( 5 ) Shop:SetPos(ScrW() / 4 + 10,40) Shop:SetSize(ScrW() / 4 - 20,ScrH() / 2-20) function Shop_Setup( handler, id, inv, data ) inventory = {} inventory = data.Inventory resources = {} resources = data.Resources end if (inventory != nil) then for k,v in pairs(inventory) do Item = k Amount = v if (Item == "amount") then elseif (Item == "capacity") then elseif (Item == "gold") then elseif (Amount > 0) then local Panel_Inv = vgui.Create("DPanel") Panel_Inv:SetSize(ScrW() / 4 - 20,50) local Name = vgui.Create("DLabel", Panel_Inv) Name:SetPos(10,10) Name:SetText("Item : "..resources[Item].name ) Name:SetFont("DefaultFixedOutline") Name:SizeToContents() local Value = vgui.Create("DLabel", Panel_Inv) Value:SetPos(10,30) Value:SetText("Value : "..Amount) Value:SetFont("DefaultFixedOutline") Value:SizeToContents() local Sell = vgui.Create("DButton", Panel_Inv) Sell:SetPos(150,10) Sell:SetSize(50,30) Sell:SetText("Sell") end Player_Inventory:AddItem(Panel_Inv) end end datastream.Hook("shop", Shop_Setup) end concommand.Add("DA_Shop",DA_Shop) [/LUA] No errors just the panels aren't in the list [editline]1st November 2010[/editline] Image: [URL=http://img80.imageshack.us/i/hl22010110121130507.jpg/][IMG]http://img80.imageshack.us/img80/5272/hl22010110121130507.jpg[/IMG][/URL] Uploaded with [URL=http://imageshack.us]ImageShack.us[/URL]
[lua] local Name = vgui.Create("DLabel", Panel_Inv) Name:SetPos(10,10) Name:SetText("Item : "..resources[Item].name ) Name:SetFont("DefaultFixedOutline") Name:SizeToContents() local Value = vgui.Create("DLabel", Panel_Inv) Value:SetPos(10,30) Value:SetText("Value : "..Amount) Value:SetFont("DefaultFixedOutline") Value:SizeToContents() local Sell = vgui.Create("DButton", Panel_Inv) Sell:SetPos(150,10) Sell:SetSize(50,30) Sell:SetText("Sell")[/lua] Change Panel_Inv to Menu
I have fixed it sorry xD
Can you show me the new picture please, i love seeing them. :wink:
Youtube Video: [url]http://www.youtube.com/watch?v=8P6PqqNKYxI[/url]
Wow gj.
Thx :) [editline]2nd November 2010[/editline] Do you know something about Rebuild a DPanelList? [editline]2nd November 2010[/editline] Why I can't see the npc? shop1 = ents.Create("prop_ragdoll") shop1:SetPos(Vector(10817.829102, -7739.859863, 120.031250)) shop1:SetAngle(Angle(0,0,0)) shop1:SetModel("models/player/group01/male_01.mdl") shop1:SetAnimation(ACT_IDLE)
I think you need to add [lua] ent:Spawn() [/lua]
oh I'm so stupid xD
Remember to spawn those ents on the server, not the client.
It looks good! GJ man.
Sorry, you need to Log In to post a reply to this thread.