ents.FindByName help.

Quick question can I used Find by name to find a door? Located on the map?

[lua]
function GM:InitPostEntity( )

local PDDOORS = {
"policedpt_frontdoor",
"policedpt_chiefsoffice",
"policedpt_innerentrance1",
"policedpt_mezzdoor1",
"policedpt_backdoor",
"policedpt_storage1",
"policedpt_innerbackdoor",
"policedpt_jailareadoor",
"policedpt_jailcelldoor_1",
"policedpt_jailcelldoor_4",
"policedpt_jailcelldoor_3",
"policedpt_jailcelldoor_2",
"policedpt_storage2",
"policedpt_storage3" }

local PUBLICDOORS = {
"emptyroom1e",
"mainaparts_lobbydoor",
"apartment1_stairsfloor1",
"apartment1_stairsfloor1",
"elevatoraprt1i",
"elevatoraprtf2",
"elevatoraprtf3",
"elevatoraprtf4",
"elevatoraprtf5",
"apartment1_stairsfloor2",
"apartment1_stairsfloor3",
"apartment1_stairsfloor4",
"apartment1_roofexit",
"apartments_plaza_door_entrince1",
"emptystoreghetto_mezzdoor1",
"apartment_ghetto_entrance",
"door_elevator_topsliding",
"door_elevator_bottomsliding",
"undergrounddoor1",
"undergrounddoor2",
"subwaydoor1",
"subwaydoor2" }
for _, ent in pairs( ents.FindByName( PDDOORS ) ) do
	ent.Owners = "COPS"
	ent:SetOwner( COPS )
	ent:SetNWBool( "Owned", true )
	ent:Fire("lock", "", 0)
	print("PP HQ Door's ownership has ben set.")
end
for _, ent in pairs( ents.FindByName( PUBLICDOORS ) ) do
	ent.Owners = "LEADER"
	ent:SetOwner( LEADER )
	ent:SetNWBool( "Owned", true )
	ent:Fire("unlock", "", 0)
	print("PUBLIC Door's ownership has ben set.")
end

end[/lua]

You will have to loop though all entities and check if they have a name in the table.

[lua]for _, ent in ipairs(ents.GetAll()) do
if table.HasValue(PDDOORS, ent:GetName()) then
ent.Owners = “COPS”
ent:SetOwner( COPS )
ent:SetNWBool( “Owned”, true )
ent:Fire(“lock”, “”, 0)
print(“PP HQ Door’s ownership has ben set.”)
elseif table.HasValue(PUBLICDOORS, ent:GetName()) then
ent.Owners = “LEADER”
ent:SetOwner( LEADER )
ent:SetNWBool( “Owned”, true )
ent:Fire(“unlock”, “”, 0)
print(“PUBLIC Door’s ownership has ben set.”)
end
end[/lua]