Opening a door with the force of lua!

Okey, here is the problem. I got a little map with 2 doors. The first door is called “henrik” and the other one is called “bob”.

Is it possible to make a function / command that opens one of these doors? Let’s say i want to open “henrik”.
If so… how, are there any wiki pages to help me maybe?

Use the search function, I made a thread about that 2 days ago.

[editline]09:53PM[/editline]

wiki.garrysmod.org

Okey, i will look for it!

Edit: That’s all good, but it doesn’t give an answer to my questions completely. How would i specify the command to only open the door “henrik”?

bump! I know its possible, but the functions… anyone know?

look at the flood gamemode the water going up and down is the same

ent.GetName()?

ent:Fire(“setanimation”,“open”,“0”)
ent:Fire(“setanimation”,“close”,“0”)

[lua]
function OpenDoor()

for k, v in pairs(ents.FindByName("henrik")) do
	v:Fire("Open","",0)
end

end
[/lua]

Works fine!

just a little note. Your entities name has to be henrik for this to work :stuck_out_tongue:

The entity name is henrik, it says so in the first post.