Moving DarkRP f4 sub menu to Derma frame

I found an addon on scriptfodder that fits almost everything I want but it has a shop on f4 that I really like, the problem is that on my server F4 is character stats and inventory, jobs and shops are all NPC’s.
I have already located all the code responsible for the menu itself, but I don’t know much about DarkRP, I don’t know what to change if I want it in my own derma frame instead of DarkRP’s default f4 menu.

Bits of code I don’t understand:


local function AwesomePanelsExists()
	for k,v in pairs(DarkRP.getF4MenuPanel():GetTable().Items) do
		if(v.Panel.sn) then
			return true
		end
	end
	return false
end


hook.Add("F4MenuTabs", "F4MenuTabs_Magicadvi2", function()



if!(AwesomePanelsExists()) then
DarkRP.addF4MenuTab("Shop", NewAdviShop())
else
DarkRP.removeF4MenuTab("Shop")
DarkRP.addF4MenuTab("Shop", NewAdviShop())
end

Sadly I can’t show much of the code or because it is from scriptfodder, but here is a link to the script

Try to talk with the creator of the script…

There must be an easy way to do it, right? those are the only 3 lines of code that seem to tie it to DarkRP, reason I didn’t go straight to the creator is because I already have 24 hour old pending message to him and with easter right around the corner I’d expect him to be busy.

Could you just not create it from scratch? I’m a tad confused on what you’re trying to accomplish.

I don’t think he wants to create the entire thing from scratch…

From what I can tell, the AwesomePanelsExist is just a helper function this addon uses to check if the shop tab already exists, and if it doesn’t, it removes any old tabs called ‘shop’ and replaces them with the new one. Really, (as far as I can tell) the only function you should be interested in is the NewAdviShop one

I just want to move the menu and put it in a normal derma frame instead of the DarkRP f4 menu.
Technically I could create it from scratch, but I don’t see why I would. I like the look/functionality of the system in place now and it is nothing complicated. I understand all of the code, except for the bit that ties it into the DarkRP menu system.

It is clearly built up of regular Gmod derma, I can’t imagine it being difficult whatsoever for someone who knows DarkRP.

[editline]25th March 2016[/editline]

Thanks, I will look at that function and see if I can figure it out!

**Update: ** it has been over a week since I made a ticket to the author, I currently have 2 pending messages to him, still not a word. I think he just put all of his scripts on sale and took a break :confused:

I still can’t figure it out, one of the first things I did was read this post on the official wiki. It helped me understand a bit more how it works, but I still have questions.

I managed to put the shop categories on a frame, but they don’t get their size set correctly and are in the corner, and the the items you can buy do not render and it is not usable.
I used print() to figure out where the code stalled as there were to errors, it stopped at “if (tostring(curcat) == tostring(v.category)) then”


local curcat = tostring(d.name)

for k,v in pairs(SH_ADVANCED_INV_V2["Items"]) do
if(v.buy["BuyAble"]) then
if (tostring(curcat) == tostring(v.category)) then

The code is incredibly messy and has 0 indentations in the GUI part (the part I want to edit), it is just a big block of code with a few empty lines to help make me not pull out my hair completely.

“d.name” is only in the entire addon twice, the second time being this:


SN_NewShop_MAIN:AddSheet( d.name, shop_cats[c], d.icon, false, false, d.name)

I am getting no support from the developer, so I give you brave souls at facepunch a last chance to point me in the right direction.

I gave up and purchased another system that did pretty much the same thing, but with much better support and well written clean code.