Help with Dlabel.


I need your help, i have a error when i open my help menu .

The error is : [@lua\vgui\dcategorycollapse.lua:83] bad argument #1 to ‘SetText’ (string expected, got nil)

The Function is :

local function AddText ( Text, Owner )
	local CategoryContentOne = vgui.Create("DLabel")
	CategoryContentOne:SetText( Text )

A example : AddText(‘Question about the gamemode ?’, PanelList1);



Figured it has nothing todo with your function actually, seems like you tried to call SetLabel on the collapsable without passing a string.

Sorry but it worked before the update of gmod :s

Edit : A example to fix this please ?

Please post the whole file.


nevermind stupid reply.

local function AddText ( Text, Owner )
	local CategoryContentOne = vgui.Create("DLabel")

local function AddBar ( Owner, Why )
	local bar = vgui.Create('perp_skill_bar', Owner);

AlphabetWeights = {	a = 1, A = 1,
					b = 2, B = 2,
					c = 3, C = 3,
					d = 4, D = 4,
					e = 5, E = 5,
					f = 6, F = 6,
					g = 7, G = 7,
					h = 8, H = 8,
					i = 9, I = 9,
					j = 10, J = 10,
					k = 11, K = 11,
					l = 12, L = 12,
					m = 13, M = 13,
					n = 14, N = 14,
					o = 15, O = 15,
					p = 16, P = 16,
					q = 17, Q = 17,
					r = 18, R = 18,
					s = 19, S = 19,
					t = 20, T = 20,
					u = 21, U = 21,
					v = 22, V = 22,
					w = 23, W = 23,
					x = 24, X = 24,
					y = 25, Y = 25,
					z = 26, Z = 26 };

function GM.CreateHelpMenu ( )	
	local W, H = 550, 350; ///
	local DermaPanel = vgui.Create("DFrame")
	DermaPanel:SetPos(ScrW() * .5 - W * .5, ScrH() * .5 - H * .5)
	DermaPanel:SetSize(W, H)
	DermaPanel:SetTitle("Pulsar Effect RP - Help Menu")

	local PropertySheet = vgui.Create("DPropertySheet", DermaPanel)
	PropertySheet:StretchToParent(5, 30, 5, 5)

	local PanelList1 = vgui.Create("DPanelList");
	AddText('Q: Where are all the jobs?!', PanelList1);
	AddText("A: This gamemode is player driven, meaning players use their skills to create", PanelList1);
	AddText("jobs of their own by making items other players would need or want, or by becoming", PanelList1);
	AddText("an outlaw and growing or smuggling drugs, performing 'hits', robberies, etc.", PanelList1);
	AddText('', PanelList1);
	AddText('Q: How am I supposed to make money?', PanelList1);
	AddText("A: There are multiple ways to earn money ranging from selling drugs to making items.", PanelList1);
	AddText('', PanelList1);
	AddText('Q: How do I choose my job?', PanelList1);
	AddText('A: You seek out NPCs scattered around the town to get hired, or start a business.', PanelList1);
	AddText('', PanelList1);
	AddText('Q: Where can I find the drug dealer?', PanelList1);
	AddText("A: He likes to hang around the slums. He doesn't always have everything in stock, though.", PanelList1);
	AddText('', PanelList1);
	AddText('Q: Do I have to use a pre-defined job?', PanelList1);
	AddText('A: Of course not! Players are encouraged to use their skills to make money.', PanelList1);
	AddText('', PanelList1);
	AddText('Q: How can I put my gun back in my inventory?', PanelList1);
	AddText('A: Hit the Q button while holding the weapon you wish to store in your inventory.', PanelList1);
	AddText('', PanelList1);
	AddText('Q: How do I form a mixture?', PanelList1);
	AddText("A: Drop the items and knock them together wtih your gravity cannon.", PanelList1);
	AddText('', PanelList1);
	AddText('Q: How do I become the Mayor?', PanelList1);
	AddText("A: When there is no mayor seek out the County Clerk, and ask to run for office.", PanelList1);
	AddText('', PanelList1);
	AddText('Q: How do I give someone money / trade?', PanelList1);
	AddText("A: Look at them and press F4. This will bring up the trade menu.", PanelList1);
	AddText('', PanelList1);
	AddText('Q: How do I sell items?', PanelList1);
	AddText("A: Put the item you want to sell into a cash register.", PanelList1);
	local PanelList2 = vgui.Create("DPanelList");
	AddText('1. Do not prop spam / prop push / prop block / prop shield / prop surf / prop kill.', PanelList2);
	AddText('', PanelList2);
	AddText('2. Do not, under any circumstances, go under the map.', PanelList2);
	AddText('', PanelList2);
	AddText('3. Do not beg other players for loans / money.', PanelList2);
	AddText('', PanelList2);
	AddText('4. Do not break laws just to get attention from cops. ', PanelList2);
	AddText('', PanelList2);
	AddText('5. Do not kill other players with your cars off the road. If they are walking in the middle of the', PanelList2);
	AddText('street, then you are allowed to run them down. The local authorities are allowed, however, to', PanelList2);
	AddText('punish you in any way, shape, or form that they deem necessary.', PanelList2);
	AddText('', PanelList2);
	AddText('6. Do not talk in all caps ever. If you wish to yell, use /y.', PanelList2);
	AddText('', PanelList2);
	AddText('7. Do not abuse the advertisement system. ( i.e. saying "/advert LOLOL FAIL" )', PanelList2);
	AddText('', PanelList2);
	AddText('8. Do not metagame. Metagaming is where you use the knowledge you have gained from an outside', PanelList2);
	AddText('source other than the RP itself. For example; Seeing pot leaves through walls and getting a', PanelList2);
	AddText('warrant for whoever owns the house.', PanelList2);
	AddText('', PanelList2);
	AddText('9. Do not respond to RP reports that are said in OOC, as that would be metagaming.', PanelList2);
	AddText('', PanelList2);
	AddText('10. Do NOT kill another player for no reason but your own entertainment. ( RDM )', PanelList2);
	AddText('', PanelList2);
	AddText('11. Do not break the New Life Rule ( NLR ). The NLR comes into affect when your RP character dies', PanelList2);
	AddText('but you continue to use knowledge gained of the RP from before your death. NLR is 10 mins ', PanelList2);
	AddText('so you must wait this length of time before returning to your death place, no matter what.', PanelList2);
	AddText('', PanelList2);
	AddText("12. Respect the admin's descision. If you disagree with their decisions, post an abuse report or", PanelList2);
	AddText('a unban request on the Pulsar Effect forums.', PanelList2);
	AddText('', PanelList2);
	AddText('13. Do not excessively run around not roleplaying at all. ( Running around on the main roads,', PanelList2);
	AddText('jumping on cars, hitting random cars with bats, etc. )', PanelList2);
	AddText('', PanelList2);
	AddText('14. Do not punch other players excessively without a purpose. ( Punchwhoring )', PanelList2);
	AddText('', PanelList2);
	AddText('15. Do not randomly demote someone as a Mayor, or demote someone so your friend can take the new', PanelList2);
	AddText('job opening. Doing so will get you blacklisted.', PanelList2);
	AddText('', PanelList2);
	AddText('16. Do not request a warrant for a reason that you made up or using metagaming resources as an', PanelList2);
	AddText('Officer.', PanelList2);
	AddText('', PanelList2);
	AddText('17. Do not turn your lights / siren on as a government employee just to bypass traffic laws.', PanelList2);
	AddText('', PanelList2);
	AddText('18. Only turn your lights / siren on when you receive an emergency call, or another report', PanelList2);
	AddText('of the like.', PanelList2);
	AddText('', PanelList2);
	AddText('19. Do not repeatedly unlock cars just to spam the car alarm noise.', PanelList2);
	AddText('', PanelList2);
	AddText('20. Do not sit in the Nexus and spam the NPC for the police, fireman, or paramedic job. When the', PanelList2);
	AddText('job opens up, you may go to the NPC. Otherwise, it is Career Camping.', PanelList2);
	AddText('', PanelList2);
	AddText("21. Do not steal other player's vehicles under any circumstances. You are allowed to borrow their", PanelList2);
	AddText('cars with their permission, but simple theft is against the rules. ( GTA )', PanelList2);
	AddText('', PanelList2);
	AddText('22. Do not text spam or microphone spam.', PanelList2);
	AddText('', PanelList2);
	AddText('23. You cannot mess with other players stores. This includes stealing items for sale.', PanelList2);
	AddText('', PanelList2);
	AddText('24. Do not purposely run into other cars just to disable them.', PanelList2);
	AddText('', PanelList2);
	AddText('25. As a government employee, you must do your job correctly and well, or you will get demoted', PanelList2);
	AddText('or blacklisted.', PanelList2);
	AddText('', PanelList2);
	AddText('26. Do not go AFK as mayor just for the paycheck or you will be blacklisted.', PanelList2);
	AddText('', PanelList2);
	AddText('27. Do not attempt in any way to crash the server.', PanelList2);
	AddText('', PanelList2);
	AddText('28. Do not lock a door repeatedly while someone is lock picking it.', PanelList2);
	AddText('', PanelList2);
	AddText('29. Do not grow shrooms in buildings - that is an exploit and you will be banned.', PanelList2);
	AddText('', PanelList2);
	AddText('30. Do not knock on doors repeatedly, as that is seen as spam.', PanelList2);
	AddText('', PanelList2);
	AddText("31. Do not buy doors that you don't intend to use.", PanelList2);
	AddText('', PanelList2);
	AddText('32. Do not lock players into a place they cannot escape from. If it is a hostage situation it is', PanelList2);
	AddText('fine, but do not simply lock a player in a room and leave.', PanelList2);
	AddText('', PanelList2);
	AddText('33. Do not use any third-party scripts to modify the gamemode in any way.', PanelList2);
	AddText('', PanelList2);
	AddText('34. You may target the mayor to assassinate him without being charged for RDM. But the actual task', PanelList2);
	AddText('of the assassination MUST be roleplayed. ( Simply walking up and shooting him will NOT pass as', PanelList2);
	AddText('roleplaying and you WILL get banned. )', PanelList2);
	AddText('', PanelList2);
	AddText('35. Do not rejoin to avoid jail time. There is an automated system in place, so any attempt will', PanelList2);
	AddText('be caught.', PanelList2);
	AddText('', PanelList2);
	AddText('36. Firemen must use the fire engine for transportation. This is to help force firemen to do', PanelList2);
	AddText('their jobs.', PanelList2);
	AddText('', PanelList2);
	AddText("37. Do not start fires in unreachable places. This consumes the fire department's time and hurts FPS.", PanelList2);
	AddText('', PanelList2);
	AddText('38. Do not flame outside of the RP.', PanelList2);
	AddText('', PanelList2);
	AddText('39. No anti-AFK scripts of any kind are tolerated.', PanelList2);
	AddText('', PanelList2);
	AddText("40. Do not enter a player's backyard through any other means other than the gate. In any other plot", PanelList2);
	AddText('of land owned by another player, do not use vehicles or props IN ANY WAY to get in.', PanelList2);
	AddText('', PanelList2);
	AddText('41. Placing a hit on someone, or following through and killing someone because of a hit, is', PanelList2);
	AddText('prohibited.', PanelList2);
	AddText('', PanelList2);
	AddText('42. - REMOVED -', PanelList2);
	AddText('', PanelList2);
	AddText('43. Gang wars are limited only to the life by which you live. If you die then any form of actions', PanelList2);
	AddText('that have occurred no longer exist even if you are told about it by another person.', PanelList2);
	local PanelList3 = vgui.Create("DPanelList");
	AddText('Regular Chat - Sends to all players within ' .. ChatRadius_Local .. ' units of you.', PanelList3);
	AddText('// - Out of Character ( White ) - Sends to all players on the server.', PanelList3);
	AddText('/// - Local Out of Character ( Gray ) - Sends to all players within ' .. ChatRadius_Local .. ' units of you.', PanelList3);
	AddText('/whisper - Whisper ( Light Blue ) - Sends to all players within ' .. ChatRadius_Whisper .. ' units of you.', PanelList3);
	AddText('/y - Yell ( Orange ) - Sends to all players within ' .. ChatRadius_Yell .. ' units of you.', PanelList3);
	AddText('/pm <Partial Name> - Private Message ( Green ) - Sends to only the specified player.', PanelList3);
	AddText('/r - Reply ( PM Alias - Green ) - Sends a PM To the last player to PM you.', PanelList3);
	AddText('/me - Emotion ( Red ) - Sends to all players within ' .. ChatRadius_Local .. ' units of you.', PanelList3);
	AddText('/radio - Police Radio ( Blue ) - Sends a message to all police and the mayor. Citizens cannot use this.', PanelList3);
	AddText('/advert - Advertisement ( Gray ) - Sends a business advertisement to all players.', PanelList3);
	AddText('/911 - Emergency Call ( Bright Red ) - Sends a message to law enforcement. Requires a cell phone.', PanelList3);
	AddText('/999 - Emergency Call ( Bright Red ) - Alias of above. For our British users.', PanelList3);
	AddText('/000 - Emergency Call ( Bright Red ) - Alias of above. For our Australian users.', PanelList3);
	AddText('/112 - Emergency Call ( Bright Red ) - Alias of above. For our EU users.', PanelList3);
	AddText('/org - Organization Call ( Orange ) - Sends a message to all of your organization members.', PanelList3);
	AddText('/broadcast - Mayoral Broadcast ( Red ) - Sends a IC message to all players. Mayor only.', PanelList3);
	local PanelList4 = vgui.Create("DPanelList");
	table.SortByMember(GAMEMODE.MixtureDatabase, "ID", function ( a, b ) return AlphabetWeights[string.sub(a, 1, 1)] > AlphabetWeights[string.sub(b, 1, 1)] end)
	for k, v in pairs(GAMEMODE.MixtureDatabase) do
		local CollapsibleCat = vgui.Create("DCollapsibleCategory", PanelList4)
		local CategoryList = vgui.Create("DPanelList")
		local List = '';
		local ListTable = {}
		for k, s in pairs(v.Requires) do
			local Name = GAMEMODE.ItemDatabase[s].Name;
			ListTable[Name] = ListTable[Name] or 0;
			ListTable[Name] = ListTable[Name] + 1;
		for k, s in pairs(ListTable) do		
			local Name = k;
			if s != 1 then Name = k .. ' x ' .. s; end
			if List == '' then
				List = Name;
				List = List .. ", " .. Name;
		AddText('Ingredients: ' .. List, CategoryList);
		for k, l in pairs(string.Explode('
', v.Produces_Text)) do
			if k == 1 then
				AddText('Produces: ' .. l, CategoryList);
				AddText(l, CategoryList);
		local List = '';
		for k, s in pairs(v.RequiredSkills) do
			local Name = s.skill .. " level " .. s.level;
			if k == 1 then
				List = Name;
				List = List .. ", " .. Name;
		AddText('Required Skills: ' .. List, CategoryList);

		if v.HowTo then
			for k, l in pairs(string.Explode('
', v.HowTo)) do
				if k == 1 then
					AddText('How To: ' .. l, CategoryList);
					AddText(l, CategoryList);
	local PanelList5 = vgui.Create("DPanelList");
	AddBar(PanelList5, 'Strength');
	AddBar(PanelList5, 'Dexterity');
	AddBar(PanelList5, 'Intelligence');
	AddBar(PanelList5, 'Stamina');
	AddBar(PanelList5, 'Craftiness');
	local PanelList6 = vgui.Create("DPanelList");
	if BASS then
		local StarSlider = vgui.Create('DNumSlider', self);
		StarSlider:SetText("Radio Streams ( Controls how many radios can be heard at once - Requires BASS ):");
	local StarSlider = vgui.Create('DCheckBoxLabel', self);
	StarSlider:SetText("Enable Television Streams ( Requires Chrome )");
	local TotalProgress = vgui.Create("gmr2_achievement_total_progress", PanelList6)
	local AchievementClasses = {};
	for k, v in pairs(AchievementDatabase) do
		AchievementClasses[v.Class] = AchievementClasses[v.Class] or {};
		table.insert(AchievementClasses[v.Class], v);
	local NumAchieved = 0;
	for _, what in pairs(DoIt) do
		for k, v in pairs(AchievementClasses[what]) do
			local NewAchievementInfo = vgui.Create('gmr2_achievement_information', PanelList6);
			local OurStatus = LocalPlayer():GetProgress(v.ID);
			local Percent = OurStatus / v.Goal;
			local PercentText = '';
			if OurStatus != v.Goal then
				if v.DisplayStyle == ACHV_NUMB then
					PercentText = OurStatus .. '/' .. v.Goal;
				elseif v.DisplayStyle == ACHV_TIME then
					PercentText = FormatTime(OurStatus, "h:m:s"); 
				elseif v.DisplayStyle == ACHV_BOOL then
					PercentText = 'Incomplete';
				PercentText = 'Complete';
			if OurStatus == v.Goal then
				NumAchieved = NumAchieved + 1;
			NewAchievementInfo:Setup(v.Class .. ' - ' .. v.Name, v.Description, v.Image, Percent, PercentText);
	local PercentDone = NumAchieved / #AchievementDatabase;
	TotalProgress:Setup(PercentDone, NumAchieved .. '/' .. #AchievementDatabase);
	local PanelList7 = vgui.Create("DPanelList");
	AddText('Unchangeable Laws - The Mayor cannot abolish these.', PanelList7);
	AddText('', PanelList7);
	AddText('1. Murder is Illegal.', PanelList7);
	AddText('', PanelList7);
	AddText('2. Assault is Illegal.', PanelList7);
	AddText('', PanelList7);
	AddText('3. Theft/Tresspassing is Illegal.', PanelList7);
	AddText('', PanelList7);
	AddText('4. SMGs and Rifles are Illegal.', PanelList7);
	AddText('', PanelList7);
	AddText('5. Drugs are Illegal.', PanelList7);
	AddText('', PanelList7);
	AddText('6. In-Character reckless driving is Illegal. Reckless driving without an In-Character is kickable/bannable.', PanelList7);
	AddText('', PanelList7);
	AddText('7. You must drive on the right handside of the road.', PanelList7);
	AddText('', PanelList7);
	AddText('8. You must obey the traffic lights.', PanelList7);
	AddText('', PanelList7);

	AddText('9. Street-Racing is Illegal.', PanelList7);
	AddText('', PanelList7);

	AddText('', PanelList7);
	AddText('', PanelList7);

	AddText('Changeable Laws - Mayor can change these in /Broadcast.', PanelList7);
	AddText('', PanelList7);

	AddText('1. The speed-limit in and out of the city. [Default 30MPH in 50MPH out]', PanelList7);
	AddText('', PanelList7);

	AddText('2. The legality of pistols and shotguns.', PanelList7);
	AddText('', PanelList7);

	AddText('3. The access to the Government HQ that civillians can get.', PanelList7);
	AddText('', PanelList7);

	AddText('4. The Mayor may also decide what fines should be charged. [Default $100]', PanelList7);
	AddText('', PanelList7);
	PropertySheet:AddSheet("F.A.Q.", PanelList1, "gui/silkicons/star")
	PropertySheet:AddSheet("Rules", PanelList2, "gui/silkicons/shield")
	PropertySheet:AddSheet("Laws", PanelList7, "gui/silkicons/exclamation")
	PropertySheet:AddSheet("Chat Info", PanelList3, "gui/silkicons/world")
	PropertySheet:AddSheet("Mixtures", PanelList4, "gui/silkicons/plugin")
	PropertySheet:AddSheet("Skills", PanelList5, "gui/silkicons/user")
	PropertySheet:AddSheet("Options", PanelList6, "gui/silkicons/star")
	// gfdsg
	GAMEMODE.HelpMenu = DermaPanel;


v.Name is nil, go check for that.

Ok Thanks i test this .

Just a little tip, you can get the “alphabet weight” by doing this


Thanks Flap :smiley: You are a king in lua lol ^^

[editline]10th June 2011[/editline]

Ok i have fixed thanks all of the topics .

and now i have a error with a lua ^^

The lua is :

 function ENT:Use ( Activator, Player)
	if !Player or !Player:IsValid() or !Player:IsPlayer() then return false; end
	if Player:Team() != TEAM_CITIZEN then
		Player:Notify('Government official cannot use this machine.');
		return false;
	if self.Spinning then return false; end
	if Player:GetCash() < 15 then Player:Notify('Not enough cash.'); return false; end
	Player:AddProgress(28, 1);
	self.Spinning = true;
	self.Player = Player;
	for i = 1, 3 do
		self.Wheels*.StopTime = CurTime() + SpinTimes*;
		self.Wheels*.Outcome = ChancesTable[math.random(1, #ChancesTable)];
		self.Wheels*.StopSpinning = true;
	local RP = RecipientFilter();
	umsg.Start('rp_slots_rotate', RP);
		for i = 1, 3 do

function ENT:AnnounceResults ( )
	local AmmountWon = 0;
	if self.Wheels[1].Outcome == self.Wheels[2].Outcome and self.Wheels[1].Outcome == self.Wheels[3].Outcome then
		AmmountWon = CashWonTable[self.Wheels[1].Outcome];
	if AmmountWon != 0 then
	for i = 1, 3 do
		self.Wheels*.StopTime = nil;
		self.Wheels*.Outcome = nil;
		self.Wheels*.StopSpinning = nil;
	self.Spinning = nil;
	self.Player = nil;
function ENT:Think() 

	if self.Spinning then
		if self.Wheels[3].StopTime and CurTime() >= self.Wheels[3].StopTime then
	self:NextThink(CurTime() + .01);
	return true

The error is on this :

	local RP = RecipientFilter();

It helps if you use [noparse][lua][/lua] instead of

[/noparse] the lua tags add some syntax highlighting and line numbers, it help to identify problems. When you have an error please post the error code too, it helps a lot., I believe Player is a reserved word, try changing all the Player to ply in the ENT:Use function.