Creating Doors with LUA

I want to make a regular door ( the brown turning doors with the handle ) at a certain location in the map, like Applejacks. How would I do that?
I need the code.

My advice would be to take the code for spawing prop_door_rotating from the door stool, but beyond that IDK.

It is pretty different coding.

Not really, for the stool it just spawns a sent and the vars for that sent is determined within the stool…so you can just base a sent off of it then define the vars in the sent it self and set ENT:Use to open the door…it would be placed with something like

function functionname()
	local ent = ents.Create( "Sentname" )
	ent:SetPos(x, y, z)
	ent:SetAngles(x, y, z)
hook.Add("InitPostEntity", "uniqueshit", functionname)

in the server’s autorun…

Is there a door sent I can have? Code?

You didn’t read what Wolfie said did you…


I made a script for this not too long ago.

You just call GAMEMODE.CreateDoors() whenever you want the doors added.
function GM.CreateDoors ( )
GAMEMODE.SpawnDoors = {
{pos = Vector(-3387, 246.6875, 123.3125), ang = Angle(0, 0, 0), skin = 1, dir = 0},
{pos = Vector(-2901.1563, -129.6563, 123.3125), ang = Angle(0, -90, 0), skin = 11, dir = 1},
{pos = Vector(-2753.2813, 28.9063, 123.3125), ang = Angle(0, 0, 0), skin = 1, dir = 0},
{pos = Vector(-2534.9063, 161, 123.3125), ang = Angle(0, -90, 0), skin = 1, dir = 1},
{pos = Vector(-2661.7500, 195.7813, 259.3125), ang = Angle(0, 90, 0), skin = 1, dir = 2}

for k, v in pairs(GAMEMODE.SpawnDoors) do
	local entit = ents.Create("prop_door_rotating")
	entit:SetPos( v["pos"] or Vector(0,0,0) )
	entit:SetAngles( v["ang"] or Angle(0,0,0) )
	entit:SetKeyValue("hardware", "1")
	entit:SetKeyValue("opendir", v["dir"] or 0)
	entit:SetSkin( v["skin"] or 0 )
	entit:Fire("lock", 0)


wow cool it could be usefull, like when we spawn fence to jam a player :slight_smile:
a little be like in Ulx the prison fence.

Is there a way to, to make the player can’t go thru the prop ? (I mean can ignore the noclip)