• DTree - Need some help
    8 replies, posted
Well, I'm creating a Credit system/shop where players can use their credits, but I'm running into some issues with the DTree. I'm trying to create folders for these nodes where I could also add settings in the config where each "Item" are under a specific Folder. But I'm not sure how I'm suppose to code that setting into this block Config Code: credit_shop:add({ Name = "Donator - 1 Month", Price = 700, Folder = "Ranks", -- this is what I want put inside the add block DisabledFor = {  }, Purchase = function( ply ) ply:giveTimedRank( "donator", one_month ) ply:ChatPrint("You have purchased the Donator rank for one month!") end, Description = [[ You can see your benefits on the forum under 'Knowledge Base' ]] }) Node Code: for k,v in pairs( credit_shop.data ) do if ( v.DisabledFor and table.HasValue( v.DisabledFor, string.lower(LocalPlayer():GetNWString("usergroup")) ) ) then continue end if ( v.OnlyFor and !table.HasValue( v.OnlyFor, string.lower(LocalPlayer():GetNWString("usergroup")) ) ) then continue end local node = tree:AddNode( v.Name ) node.shop_key = k end
You mean purchasing? By networking
I didn't understand what you're trying to do. The Purchase button or what?
So, in the image you see multiple "Ranks" nodes being added, but I was trying to figure out a way where I can create a node, on a node, creating a category through the code I provided.
node.shop_data = v ???
I've never really messed with DTree that much, but I'm not sure how to fully use that haha
https://wiki.garrysmod.com/page/DTree/OnNodeSelected Has an argument, you use .shop_data on that argument, for example PrintTable( node.shop_data )
Thank you, I'm going to use this for something else, but I figured that I could just use buttons to create tabs for them to be in different pages anyways. I appreciate the help though haha! https://files.facepunch.com/forum/upload/380635/16a6d9df-859b-4a49-8321-ac4302a188b8/image.png
Sorry, you need to Log In to post a reply to this thread.