[DarkRP Agenda] bad argument #1 to pairs <table expected, got number>

Hello everyone,

I have some problems with my darkrp server.
When somebody join my server and chage to a class with a agenda they don’t see the agenda, what they do see is:
Something is creating script errors!

And this is the script error:



[ERROR] lua/includes/extensions/table.lua:99: bad argument #1 to 'pairs' (table expected, got number)
  1. pairs - [C]:-1
   2. HasValue - lua/includes/extensions/table.lua:99
    3. Agenda - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:135
     4. DrawHUD - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:241
      5. unknown - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:381


agendas.lua:


/*---------------------------------------------------------------------------
/*---------------------------------------------------------------------------
DarkRP Agenda's
---------------------------------------------------------------------------
Agenda's can be set by the agenda manager and read by both the agenda manager and the other teams connected to it.


HOW TO MAKE AN AGENDA:
AddAgenda(Title of the agenda, Manager (who edits it), {Listeners (the ones who just see and follow the agenda)})
---------------------------------------------------------------------------*/
-- Example: AddAgenda("Gangster's agenda", TEAM_MOB, {TEAM_GANG})
-- Example: AddAgenda("Police agenda", TEAM_MAYOR, {TEAM_CHIEF, TEAM_POLICE})
AddAgenda("Gangster's agenda", TEAM_MOB, {TEAM_GANG})
AddAgenda("Police agenda", TEAM_MAYOR, TEAM_CHIEF, TEAM_PRISONCHIEF, {TEAM_POLICE, TEAM_PRISONGUARD})

jobs.lua:


/*---------------------------------------------------------------------------
/*---------------------------------------------------------------------------
DarkRP custom jobs
---------------------------------------------------------------------------

This file contains your custom jobs.
This file should also contain jobs from DarkRP that you edited.

Note: If you want to edit a default DarkRP job, first disable it in darkrp_config/disabled_defaults.lua
	Once you've done that, copy and paste the job to this file and edit it.

The default jobs can be found here:
<TODO: INSERT URL HERE>

For examples and explanation please visit this wiki page:
http://wiki.darkrp.com/index.php/DarkRP:CustomJobFields


Add jobs under the following line:
---------------------------------------------------------------------------*/

TEAM_CITIZEN = AddExtraTeam("Citizen", {
	color = Color(20, 150, 20, 255),
	model = {
		"models/player/Group01/Female_01.mdl",
		"models/player/Group01/Female_02.mdl",
		"models/player/Group01/Female_03.mdl",
		"models/player/Group01/Female_04.mdl",
		"models/player/Group01/Female_06.mdl",
		"models/player/group01/male_01.mdl",
		"models/player/Group01/Male_02.mdl",
		"models/player/Group01/male_03.mdl",
		"models/player/Group01/Male_04.mdl",
		"models/player/Group01/Male_05.mdl",
		"models/player/Group01/Male_06.mdl",
		"models/player/Group01/Male_07.mdl",
		"models/player/Group01/Male_08.mdl",
		"models/player/Group01/Male_09.mdl"
	},
	description = [[The Citizen is the most basic level of society you can hold
		besides being a hobo.
		You have no specific role in city life.]],
	weapons = {},
	command = "citizen",
	max = 0,
	salary = 45,
	admin = 0,
	vote = false,
	hasLicense = false,
	candemote = false,
	mayorCanSetSalary = true
})

TEAM_POLICE = AddExtraTeam("Civil Protection", {
	color = Color(25, 25, 170, 255),
	model = {
			"models/player/police.mdl",
			"models/player/police_fem.mdl",
			"models/dpfilms/metropolice/playermodels/pm_arctic_police.mdl",
			"models/dpfilms/metropolice/playermodels/pm_biopolice.mdl",
			"models/dpfilms/metropolice/playermodels/pm_c08cop.mdl",
			"models/dpfilms/metropolice/playermodels/pm_hunter_police.mdl",
			"models/dpfilms/metropolice/playermodels/pm_retrocop.mdl",
			"models/dpfilms/metropolice/playermodels/pm_rogue_police.mdl",
			"models/dpfilms/metropolice/playermodels/pm_urban_police.mdl",
			"models/dpfilms/metropolice/playermodels/pm_tron_police_cn.mdl",
			"models/dpfilms/metropolice/playermodels/pm_tron_police_or.mdl"},
	description = [[The protector of every citizen that lives in the city .
		You have the power to arrest criminals and protect innocents.
		Hit a player with your arrest baton to put them in jail
		Bash a player with a stunstick and they may learn to obey
		the law.
		The Battering Ram can break down the door of a criminal, with a warrant
		for his/her arrest.
		The Battering Ram can also unfreeze frozen props(if enabled).
		Type /wanted <name> to alert the public to the presence of a criminal.
		OR go to tab and warrant someone by clicking the warrant button]],
	weapons = {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker"},
	command = "cp",
	max = 8,
	salary = 65,
	admin = 0,
	vote = true,
	hasLicense = true,
	mayorCanSetSalary = true,
	help = {
		"Please don't abuse your job",
		"When you arrest someone they are auto transported to jail.",
		"They are auto let out of jail after some time",
		"Type /warrant [Nick|SteamID|Status ID] to set a search warrant for a player.",
		"Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect",
		"Type /unwanted [Nick|SteamID|Status ID] to clear the suspect",
		"Type /jailpos to set the jail position"
	}
})

TEAM_GANG = AddExtraTeam("Gangster", {
	color = Color(75, 75, 75, 255),
	model = {
		"models/player/Group03/Female_01.mdl",
		"models/player/Group03/Female_02.mdl",
		"models/player/Group03/Female_03.mdl",
		"models/player/Group03/Female_04.mdl",
		"models/player/Group03/Female_06.mdl",
		"models/player/group03/male_01.mdl",
		"models/player/Group03/Male_02.mdl",
		"models/player/Group03/male_03.mdl",
		"models/player/Group03/Male_04.mdl",
		"models/player/Group03/Male_05.mdl",
		"models/player/Group03/Male_06.mdl",
		"models/player/Group03/Male_07.mdl",
		"models/player/Group03/Male_08.mdl",
		"models/player/Group03/Male_09.mdl",
		"models/dpfilms/metropolice/playermodels/pm_police_fragger.mdl",
		"models/dpfilms/metropolice/playermodels/pm_tribal_police.mdl"},
	description = [[The lowest person of crime.
		A gangster generally works for the Mobboss who runs the crime family.
		The Mob boss sets your agenda and you follow it or you might be punished.]],
	weapons = {"lockpick"},
	command = "gangster",
	max = 4,
	salary = 45,
	admin = 0,
	vote = false,
	hasLicense = false,
	mayorCanSetSalary = false
})

TEAM_MOB = AddExtraTeam("Mob boss", {
	color = Color(25, 25, 25, 255),
	model = "models/player/gman_high.mdl",
	description = [[The Mob boss is the boss of the criminals in the city.
		With his power he coordinates the gangsters and forms an efficient crime
		organization.
		He has the ability to break into houses by using a lockpick.
		The Mob boss posesses the ability to unarrest you.]],
	weapons = {"lockpick", "unarrest_stick"},
	command = "mobboss",
	max = 1,
	salary = 60,
	admin = 0,
	vote = false,
	hasLicense = false,
	mayorCanSetSalary = false,
	help = {
		"As the Mob boss, you decide what you want the other Gangsters to do.",
		"You get an Unarrest Stick which you can use to break people out of jail.",
		"/agenda <Message> Sets the Gangsters' agenda. Use // to go to the next line."
	}
})

TEAM_GUN = AddExtraTeam("Gun Dealer", {
	color = Color(255, 140, 0, 255),
	model = {
	"models/player/monk.mdl",
	"models/player/arctic.mdl",
	"models/player/gasmask.mdl",
	"models/player/guerilla.mdl",
	"models/player/leet.mdl",
	"models/player/phoenix.mdl",
	"models/player/riot.mdl",
	"models/player/swat.mdl",
	"models/player/urban.mdl"},
	description = [[A Gun Dealer is the only person who can sell guns to other
		people.
		However, make sure you aren't caught selling illegal firearms to
		the public.
		/Buyshipment <name> to Buy a  weapon shipment
		/Buygunlab to Buy a gunlab that spawns P228 pistols]],
	weapons = {},
	command = "gundealer",
	max = 3,
	salary = 45,
	admin = 0,
	vote = false,
	hasLicense = false,
	mayorCanSetSalary = false
})

TEAM_MEDIC = AddExtraTeam("Medic", {
	color = Color(47, 79, 79, 255),
	model = "models/player/kleiner.mdl",
	description = [[With your medical knowledge,
		you work to restore players to full health.
		Without a medic, people cannot be healed.
		Left click with the Medical Kit to heal other players.
		Right click with the Medical Kit to heal yourself.]],
	weapons = {"med_kit"},
	command = "medic",
	max = 3,
	salary = 45,
	admin = 0,
	vote = false,
	hasLicense = false,
	medic = true,
	mayorCanSetSalary = true
})

TEAM_CHIEF = AddExtraTeam("Civil Protection - Chief", {
	color = Color(20, 20, 255, 255),
	model = {
	"models/player/combine_soldier_prisonguard.mdl",
	"models/dpfilms/metropolice/playermodels/pm_black_police.mdl",
	"models/dpfilms/metropolice/playermodels/pm_elite_police.mdl",
	"models/dpfilms/metropolice/playermodels/pm_phoenix_police.mdl",
	"models/dpfilms/metropolice/playermodels/pm_skull_police.mdl"},
	description = [[The Chief is the leader of the Civil Protection unit.
		Coordinate the police force to enforce law in the city.
		Hit a player with arrest baton to put them in jail.
		Bash a player with a stunstick and they may learn to
		obey the law.
		The Battering Ram can break down the door of a criminal, with a
		warrant for his/her arrest.
		Type /wanted <name> to alert the public to the presence of a criminal.
		Type /jailpos to set the Jail Position]],
	weapons = {"arrest_stick", "unarrest_stick", "weapon_deagle2", "stunstick", "door_ram", "weaponchecker"},
	command = "chief",
	max = 1,
	salary = 75,
	admin = 0,
	vote = true,
	hasLicense = true,
	chief = true,
	mayorCanSetSalary = true,
	NeedToChangeFrom = TEAM_POLICE,
	help = {
		"Please don't abuse your job",
		"When you arrest someone they are auto transported to jail.",
		"They are auto let out of jail after some time",
		"Type /warrant [Nick|SteamID|Status ID] to set a search warrant for a player.",
		"Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect",
		"Type /unwanted [Nick|SteamID|Status ID] to clear the suspect",
		"Type /jailpos to set the jail position"
	}
})

TEAM_MAYOR = AddExtraTeam("Mayor", {
	color = Color(150, 20, 20, 255),
	model = {
	"models/player/breen.mdl",
	"models/dpfilms/metropolice/playermodels/pm_steampunk_police.mdl"},
	description = [[The Mayor of the city creates laws to govern the city.
	If you are the mayor you may create and accept warrants.
	Type /wanted <name>  to warrant a player
	Type /jailpos to set the Jail Position
	Type /lockdown initiate a lockdown of the city.
	Everyone must be inside during a lockdown.
	The cops patrol the area
	/unlockdown to end a lockdown]],
	weapons = {"door_ram"},
	command = "mayor",
	max = 1,
	salary = 85,
	admin = 0,
	vote = true,
	hasLicense = false,
	mayor = true,
	mayorCanSetSalary = false,
	help = {
		"Type /warrant [Nick|SteamID|Status ID] to set a search warrant for a player.",
		"Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect.",
		"Type /unwanted [Nick|SteamID|Status ID] to clear the suspect.",
		"Type /lockdown to initiate a lockdown",
		"Type /unlockdown to end a lockdown",
		"Type /placelaws to place a screen containing the laws.",
		"Type /addlaw and /removelaw to edit the laws."
	}
})

TEAM_HOBO = AddExtraTeam("Hobo", {
	color = Color(80, 45, 0, 255),
	model = "models/player/corpse1.mdl",
	description = [[The lowest member of society. Everybody laughs at you.
		You have no home.
		Beg for your food and money
		Sing for everyone who passes to get money
		Make your own wooden home somewhere in a corner or
		outside someone else's door]],
	weapons = {"weapon_bugbait"},
	command = "hobo",
	max = 0,
	salary = 0,
	admin = 0,
	vote = false,
	hasLicense = false,
	candemote = false,
	hobo = true,
	mayorCanSetSalary = false
})

//ADD CUSTOM TEAMS UNDER THIS LINE:

TEAM_HD = AddExtraTeam("Home Decorator", {
	color = Color(75, 75, 75, 255),
	model = {
		"models/player/eli.mdl"},
	description = [[As an Home Decorator your job is to Decorate
home's for other people.
With the Physgun you can move and rotate objects.
And with the Toolgun you can do things like
welding objects to the ground/wall/ceiling or to
another object.

And of course decorate your own house.]],
	weapons = {"weapon_physgun", "gmod_tool"},
	command = "homedecorator",
	max = 4,
	salary = 40,
	admin = 0,
	vote = false,
	hasLicense = false,
	mayorCanSetSalary = true
})

TEAM_PRISONGUARD = AddExtraTeam("Civil Protection - Prison Guard", {
	color = Color(25, 25, 170, 255),
	model = {
			"models/player/combine.mdl",
			"models/player/combineelite.mdl",
			"models/player/combineprison.mdl",
			"models/dpfilms/metropolice/playermodels/pm_tf2_metrocop_blu.mdl",
			"models/dpfilms/metropolice/playermodels/pm_tf2_metrocop_red.mdl"},
	description = [[The guard of the prisoners.
	It's your job to guard the prisoners and make sure they don't escape!
	The PG Chief will tell you and the other Prison Guards who to let go and who to keep.
	You can also guard the building of the mayor. (Which is normal the same building.)
	You will also be needed at the Pod control panel or you can be send out on a small mission.
	Also check the Prison agenda to see what needs to be done.]],
	weapons = {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker"},
	command = "pguard",
	max = 6,
	salary = 75,
	admin = 0,
	vote = false,
	hasLicense = true,
	NeedToChangeFrom = TEAM_POLICE,
	mayorCanSetSalary = true,
	help = {
		"Please don't abuse your job",
		"You need to guard the prisoners. Make sure they don't escape.",
		"Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect",
		"Type /unwanted [Nick|SteamID|Status ID] to clear the suspect",
		"Check the Prison agenda to see what needs to be done!"
	}
})

TEAM_PRISONCHIEF = AddExtraTeam("Civil Protection - Prison Chief", {
	color = Color(20, 20, 255, 255),
	model = {
	"models/dpfilms/metropolice/playermodels/pm_rtb_police.mdl",
	"models/dpfilms/metropolice/playermodels/pm_policetrench.mdl"},
	description = [[The Prison Chief his job is to make sure the Prison Guards are doing there job.
	It's also your job to give the Prison Guards direction of what they need to do.
	Fill your job in the agenda so the gaurds can work on that.]],
	weapons = {"arrest_stick", "unarrest_stick", "weapon_deagle2", "stunstick", "door_ram", "weaponchecker"},
	command = "pchief",
	max = 1,
	salary = 85,
	admin = 0,
	vote = true,
	hasLicense = true,
	chief = true,
	mayorCanSetSalary = true,
	NeedToChangeFrom = TEAM_PRISONGUARD,
	help = {
		"Please don't abuse your job",
		"When you arrest someone they are auto transported to jail.",
		"They are let out of jail by the Prison Guards.",
		"(NOTE: You need to put this in the Prison aganda!)",
		"Type /warrant [Nick|SteamID|Status ID] to set a search warrant for a player.",
		"Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect",
		"Type /unwanted [Nick|SteamID|Status ID] to clear the suspect",
		"Type /jailpos to set the jail position"
	}
})






/*---------------------------------------------------------------------------
Define which team joining players spawn into and what team you change to if demoted
---------------------------------------------------------------------------*/
GAMEMODE.DefaultTeam = TEAM_CITIZEN


/*---------------------------------------------------------------------------
Define which teams belong to civil protection
Civil protection can set warrants, make people wanted and do some other police related things
---------------------------------------------------------------------------*/
GAMEMODE.CivilProtection = {
	[TEAM_POLICE] = true,
	[TEAM_CHIEF] = true,
	[TEAM_MAYOR] = true,
	[TEAM_PRISONCHIEF] = true,
	[TEAM_PRISONGUARD] = true,
}

/*---------------------------------------------------------------------------
Jobs that are hitmen (enables the hitman menu)
---------------------------------------------------------------------------*/
DarkRP.addHitmanTeam(TEAM_MOB)


disabled_default.lua:


/*---------------------------------------------------------------------------
/*---------------------------------------------------------------------------
DarkRP disabled defaults
---------------------------------------------------------------------------

DarkRP comes with a bunch of default things:
	- a load of modules
	- default jobs
	- shipments and guns
	- entities (like the money printer)
	and many more

If you want to disable or replace the default things, you should disable them here

Note: if you want to have e.g. edit the official medic job, you MUST disable the default one in this file!
You can copy the medic from DarkRP and paste it in darkrp_config/jobs.lua
---------------------------------------------------------------------------*/


/*---------------------------------------------------------------------------
The list of modules that are disabled. Set to true to disable, false to enable.
Modules that are not in this list are enabled by default.
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["modules"] = {
	["afk"]              = true,
	["chatsounds"]       = false,
	["events"]           = false,
	["fpp"]              = false,
	["hitmenu"]          = false,
	["hud"]              = false,
	["hungermod"]        = true,
	["playerscale"]      = false,
	["sleep"]            = false,
	["voterestrictions"] = true,
	["fadmin"]           = false,
}



/*---------------------------------------------------------------------------
The disabled default jobs. true to disable, false to enable.
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["jobs"] = {
	["chief"]     = true,
	["citizen"]   = true,
	["cp"]        = true,
	["gangster"]  = true,
	["gundealer"] = true,
	["hobo"]      = true,
	["mayor"]     = true,
	["medic"]     = true,
	["mobboss"]   = true,
}

/*---------------------------------------------------------------------------
Shipments and pistols
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["shipments"] = {
	["AK47"]         = false,
	["Desert eagle"] = false,
	["Fiveseven"]    = false,
	["Glock"]        = false,
	["M4"]           = false,
	["Mac 10"]       = false,
	["MP5"]          = false,
	["P228"]         = false,
	["Pump shotgun"] = false,
	["Sniper rifle"] = false,
}

/*---------------------------------------------------------------------------
Entities
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["entities"] = {
	["Drug lab"]      = false,
	["Gun lab"]       = false,
	["Money printer"] = false,
}

/*---------------------------------------------------------------------------
Vehicles
(at the moment there are no default vehicles)
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["vehicles"] = {

}

/*---------------------------------------------------------------------------
Door groups
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["doorgroups"] = {
	["Cops and Mayor only"] = false,
	["Gundealer only"]      = false,
}


/*---------------------------------------------------------------------------
Ammo packets
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["ammo"] = {
	["Pistol ammo"]  = false,
	["Rifle ammo"]   = false,
	["Shotgun ammo"] = false,
}

/*---------------------------------------------------------------------------
Agendas
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["agendas"] = {
	["Gangster's agenda"] = true,
	["Police agenda"] = true,
}

/*---------------------------------------------------------------------------
Chat groups (chat with /g)
Chat groups do not have names, so their index is used instead.
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["groupchat"] = {
	[1] = true, -- Police group chat (mayor, cp, chief and/or your custom CP teams)
	[2] = true, -- Group chat between gangsters and the mobboss
}

/*---------------------------------------------------------------------------
Jobs that are hitmen
set to true to disable
---------------------------------------------------------------------------*/
DarkRP.disabledDefaults["hitmen"] = {
	["mobboss"] = false,
}


table.lua:99


--[[---------------------------------------------------------
   Name: xx
   Desc: xx
-----------------------------------------------------------]]
function table.HasValue( t, val )
	**for k,v in pairs(t) do**
		if (v == val ) then return true end
	end
	return false
end

cl_hud.lua:135


local function Agenda()
	local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_Agenda")
	if shouldDraw == false then return end
	local DrawAgenda, AgendaManager = DarkRPAgendas[localplayer:Team()], localplayer:Team()
	if not DrawAgenda then
		for k,v in pairs(DarkRPAgendas) do
			**if table.HasValue(v.Listeners or {}, localplayer:Team()) then**
				DrawAgenda, AgendaManager = DarkRPAgendas[k], k
				break
			end
		end
	end
	if DrawAgenda then
		draw.RoundedBox(10, 10, 10, 460, 110, Color(0, 0, 0, 155))
		draw.RoundedBox(10, 12, 12, 456, 106, Color(51, 58, 51,100))
		draw.RoundedBox(10, 12, 12, 456, 20, Color(0, 0, 70, 100))

		draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 30, 12, Color(255,0,0,255),0)

		local AgendaText = {}
		for k,v in pairs(team.GetPlayers(AgendaManager)) do
			if not v.DarkRPVars then continue end
			table.insert(AgendaText, v:getDarkRPVar("agenda"))
		end

		local text = table.concat(AgendaText, "
")
		text = text:gsub("//", "
"):gsub("\
", "
")
		text = DarkRP.textWrap(text, "DarkRPHUD1", 440)
		draw.DrawText(text, "DarkRPHUD1", 30, 35, Color(255,255,255,255),0)
	end
end

cl_hud.lua:241


/*---------------------------------------------------------------------------
Drawing the HUD elements such as Health etc.
---------------------------------------------------------------------------*/
local function DrawHUD()
	localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
	if not IsValid(localplayer) then return end

	local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD")
	if shouldDraw == false then return end

	Scrw, Scrh = ScrW(), ScrH()
	RelativeX, RelativeY = 0, Scrh

	shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_LocalPlayerHUD")
	if shouldDraw ~= false then
		--Background
		draw.RoundedBox(6, 0, Scrh - HUDHeight, HUDWidth, HUDHeight, ConVars.background)
		DrawHealth()
		DrawInfo()
		GunLicense()
	end
	**Agenda()**
	DrawVoiceChat()
	LockDown()

	Arrested()
	AdminTell()
end

cl_hud.lua:381


/*---------------------------------------------------------------------------
Actual HUDPaint hook
---------------------------------------------------------------------------*/
function GM:HUDPaint()
	**DrawHUD()**
	DrawEntityDisplay()

	self.BaseClass:HUDPaint()
end

Does somebody know how I can fix this?

A table in the table “DarkRPAgendas” has the “listeners” field which is expected by the function “table.HasValue” to hold a table, but it holds a number instead.

So… How do I fix this?

I’m on my phone atm, so can’t help much, but you can check if the field “listeners” is a table before calling “table.HasValue”

Ok I will check that out :slight_smile:

[editline]11th September 2013[/editline]

Ok I checked it out and there is no table listeners in the table.lua file.
So what now?

That’s not what I meant at all…

Oh sorry Im not fully awake yet. Let me correct this.

[editline]11th September 2013[/editline]

Sorry to say but I cant find the loading order of DarkRP.
I can wait until you are on your computer so you can help more if that suit you more :slight_smile:

Alright, I’m at my computer now.

Basically (assuming that the field “listeners” should be a table), you want to track down just why “Listeners” isn’t a table, and also found out just what it is.

So we’re gonna do some debugging.

In the [lua]for k,v in pairs(DarkRPAgendas)[/lua] loop, you want to add this:
[lua]if type( v.Listeners ) != “table” then print( k, type( v.Listeners ), v ) end[/lua] Which will give us the type, address and value of the field “Listeners” if it’s not a table (so this could mean that it only gives us that information on all of the indeces in ‘DarkRPAgendas’ or just a single broken one). This’ll help us track down the problem, anyway, add that and then come back to me here with the results from your console.

Ok I added the line after [lua]for k,v in pairs(DarkRPAgendas)[/lua] and now my console says this:


[ERROR] lua/includes/extensions/table.lua:99: bad argument #1 to 'pairs' (table expected, got number)
  1. pairs - [C]:-1
   2. HasValue - lua/includes/extensions/table.lua:99
    3. Agenda - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:136
     4. DrawHUD - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:242
      5. unknown - gamemodes/darkrp/gamemode/modules/hud/cl_hud.lua:382

8	number	table: 0x48b07100



So what next?

[lua]AddAgenda(“Police agenda”, TEAM_MAYOR, TEAM_CHIEF, TEAM_PRISONCHIEF, {TEAM_POLICE, TEAM_PRISONGUARD})[/lua]

Each agenda only can have one manager, you gave three.

Ah so thats the problem. Well I’m gonna give them one and lets see of that works

Thanks man That worked! :smiley: