"attempt to get...": Panels Issue

Hey all.

I’ve been searching around the Internet for a fix, but I can’t find one. My issue is that with DarkRP, whenever I tried to want someone (via the F4 menu/derma), it came up with this:



attempt to get length of field 'Panels' (a nil value)


Here’s the code that it says there’s an issue with (showteamtabs.lua:46):



CreateClientConVar("rp_playermodel", "", true, true)

local function MayorOptns()
	local MayCat = vgui.Create("DCollapsibleCategory")
	function MayCat:Paint()
		self:SetBGColor(team.GetColor(LocalPlayer():Team()))
	end
	MayCat:SetLabel("Mayor options")
		local maypanel = vgui.Create("DPanelList")
		maypanel:SetSpacing(5)
		maypanel:SetSize(740,170)
		maypanel:EnableHorizontal(false)
		maypanel:EnableVerticalScrollbar(true)
			local SearchWarrant = vgui.Create("DButton") 
			SearchWarrant:SetText(LANGUAGE.give_money)
			SearchWarrant.DoClick = function()
				local menu = DermaMenu()
				for _,ply in pairs(player.GetAll()) do
					if not ply.DarkRPVars.warrant and ply ~= LocalPlayer() then
						menu:AddOption(ply:Nick(), function() 
							Derma_StringRequest("Warrant", "Why would you warrant "..ply:Nick().."?", nil, 
								function(a) 
								LocalPlayer():ConCommand("say /warrant ".. tostring(ply:UserID()).." ".. a)
								end, function() end ) end)
					end
				end
				if #menu.Panels == 0 then
					menu:AddOption(LANGUAGE.noone_available, function() end)
				end
				menu:Open()
			end
			maypanel:AddItem(SearchWarrant)
			
			local Warrant = vgui.Create("DButton") 
			Warrant:SetText(LANGUAGE.make_wanted)
			Warrant.DoClick = function()
				local menu = DermaMenu()
				for _,ply in pairs(player.GetAll()) do
					if not ply.DarkRPVars.wanted and ply ~= LocalPlayer() then
						menu:AddOption(ply:Nick(), function() Derma_StringRequest("wanted", "Why would you make "..ply:Nick().." wanted?", nil, 
								function(a) 
								LocalPlayer():ConCommand("say /wanted ".. tostring(ply:UserID()).." ".. a)
								end, function() end ) end)
					end
				end
				if #menu.Panels == 0 then
					menu:AddOption("Noone available", function() end)
				end
				menu:Open()
			end
			maypanel:AddItem(Warrant)
			
			local UnWarrant = vgui.Create("DButton") 
			UnWarrant:SetText(LANGUAGE.make_unwanted)
			UnWarrant.DoClick = function()
				local menu = DermaMenu()
				for _,ply in pairs(player.GetAll()) do
					if ply.DarkRPVars.wanted and ply ~= LocalPlayer() then
						menu:AddOption(ply:Nick(), function() LocalPlayer():ConCommand("say /unwanted " .. tostring(ply:UserID())) end)
					end
				end
				if #menu.Panels == 0 then
					menu:AddOption(LANGUAGE.noone_available, function() end)
				end
				menu:Open()
			end
			maypanel:AddItem(UnWarrant)
			
			local Lockdown = vgui.Create("DButton") 
			Lockdown:SetText(LANGUAGE.initiate_lockdown)
			Lockdown.DoClick = function()
				LocalPlayer():ConCommand("say /lockdown")
			end
			maypanel:AddItem(Lockdown)
			
			
			local UnLockdown = vgui.Create("DButton") 
			UnLockdown:SetText(LANGUAGE.stop_lockdown)
			UnLockdown.DoClick = function()
				LocalPlayer():ConCommand("say /unlockdown")
			end
			maypanel:AddItem(UnLockdown)
			
			local Lottery = vgui.Create("DButton") 
			Lottery:SetText(LANGUAGE.start_lottery)
			Lottery.DoClick = function()
				LocalPlayer():ConCommand("say /lottery")
			end
			maypanel:AddItem(Lottery)
			
			local GiveLicense = vgui.Create("DButton") 
			GiveLicense:SetText(LANGUAGE.give_license_lookingat)
			GiveLicense.DoClick = function()
				LocalPlayer():ConCommand("say /givelicense")
			end
			maypanel:AddItem(GiveLicense)
	MayCat:SetContents(maypanel)
	MayCat:SetSkin("DarkRP")
	return MayCat
end


Here’s a few images if it helps:
http://img535.imageshack.us/img535/7633/darkrppanlesissue01.png

http://img811.imageshack.us/img811/2992/darkrppanlesissue02.png

http://img11.imageshack.us/img11/3856/darkrppanlesissue03.png

http://img683.imageshack.us/img683/148/darkrppanlesissue04.png

http://img26.imageshack.us/img26/5258/darkrppanlesissue05.png

Sorry I can’t provide much more info.

Has anyone found out a problem to this issue? Thanks.

You can use string.sub and cut out anything past the name.

If you’re running the latest DarkRP SVN version, shouldn’t this be fixed?

Try replacing each instance of:
[lua]
#menu.Panels
[/lua]
with
[lua]
#menu:GetItems()
[/lua]

I still have the issue. I tried updating the gamemode too. Still the exact same errors.

I even downloaded the GM from the SVN (scratch, in a new folder). Still didn’t work. So at least I know that it probably isn’t my fuckups.

Here’s the new issue (with the fresh version of DarkRP):

http://img827.imageshack.us/img827/9875/darkrppanlesissue06.png

And this (my version, with jimbo’s attempted fix):

http://img27.imageshack.us/img27/1236/darkrppanlesissue07.png

Yes, I tried doing your method jimbo. Unfortunately it didn’t work. Thanks for trying anyway. :slight_smile:

jrj, I don’t understand what you mean. Can you explain?

Sorry, gonna have to bump. :S

Can anyone help me with this?

Why dont you notify FPTje?

Good point… I’m a derp.

I’ll send him a PM on FP. Any other way that I can contact him if anyone knows (just incase he doesn’t respond to the PM)?

EDIT:

Sent him a PM. Looks like he’s pretty active, so I’m not too worried. I’ll post an extra pic as well (to do with the language I guess):

http://img233.imageshack.us/img233/6167/darkrppanlesissue08.png

Happens every time I try to warrant someone…

Jameo its danny off your friends list, panels is a common problem after the gmod update it broke that aswell as pcmod2. Also are using sql to save?

You’re using Format or string.format without passing the player as the second argument

The panels issue was cause by a gmod update if I recall correctly.

Hey Danny.

Good to know that at least it’s a common problem. I had a hunch because of ASSMod fucking up too, but I still wasn’t sure. Glad someone could confirm that for me. :slight_smile:

Also, I have little/no knowledge of SQL, so I don’t understand what you’re talking about. D:

I’ll see what I can do. Dunno if I can change anything, but it’s always worth a shot, I guess. :stuck_out_tongue:

EDIT: Nope, I have no fucking idea. :frowning:



ques:Create(string.format(LANGUAGE.warrant_request.."
Reason: "..reason, ply:Nick(), p:Nick()), p:EntIndex() .. "warrant", m, 40, FinishWarrant, ply, p, reason)
Notify(ply, 0, 4, string.format(LANGUAGE.warrant_request2, m:Nick()))


Help? :frowning:

Ok thanks. :slight_smile:

Also thanks for replying so fast. :stuck_out_tongue: