How to build ownable doors

Hello Community,

i’m running a GMod (DarkRP) Server and want to add a ownable door to my map (rp_downtown_v4c).
Is there any possibility to do this ingame?

Thanks in advance :slight_smile:

I’m willing to pay money for a good answer!

What do you mean by add an ownable door? Also, you may want to post this in the DarkRP help thread as I have been banned for posting in the wrong section before.
Or go hire a coder to do this - there is a thread for that too!

I want to add a door to the map / game / gamemode were ever to add and want to make this door buyable with f2. So that just the owner is able to unlock the door.
There are predefined doors and i want to add 1 or 2 more.
Thats not directly linked to darkrp.

Ah, okay so in order to add a completely new door you’d have to edit the map itself. I’m sure you could get some sort of door tool and perm props and add in doors to your map and what not. Pretty sure some of the doors from doors stool are buyable with f2, but I only barely remember that from my old old server.

By predefined do you mean Cops and Mayor only and Gun Dealer doors? Because those are EASY to add.

No i meant those doors wich belong to the server and could be bought with f2 by every player

Use the hire thread

I believe there’s a admin-only button in the F2 menu to make a door ownable.

Thanks for your tips
Tod clarify things: I want to edit an existing map, Tod insert New doors at serval places wich could be bougt by players.

Sorry for spelling things wrong im in my phone Wirth German auto correct

I don’t think editing a map is a good idea, you will spend HOURS, if not days, compiling a big RP map. Best way is to use Lua

local door = ents.Create("prop_door_rotating")
door:SetPos(Vector(0, 0, 0 ))
door:SetAngles(Angle(0, 0, 0 ))

Thaaanks alot <3
You are using local door, does this means it only affects my own client, or is it working for all clients?

Obviously it will be created for everyone. Local is just the pointer to the door.

Does anyone know were to paste this code ?
I allready have the Pos and the Angle

[lua]function spawnDoor()
local door = ents.Create(“prop_door_rotating”)
door:SetPos(Vector(0, 0, 0 ))
door:SetAngles(Angle(0, 0, 0 ))
hook.Add(“InitPostEntity”,“spawnDoor”, spawnDoor)

Create a file in lua/autorun/server with this in it

[lua]prop at 2574 2468 -140 missing modelname
Trying to precache breakable prop, but has no model name
prop_door_rotating at (2574.009, 2468.380, -139.969) has no model name!
prop_door with no model at 2574.01 2468.38 -139.97[/lua]

I get this error, how to define a model name?

Something like door:SetModel(“props_c17\door01_left.mdl”) would work.

[lua]function spawnDoor()
local door = ents.Create(“prop_door_rotating”)
door:SetPos(Vector(2574.008545, 2468.379883, -139.970750 ))
door:SetAngles(Angle(0.559986, -89.960121, 0 ))
hook.Add(“InitPostEntity”,“spawnDoor”, spawnDoor)[/lua]

You need to add models to the path and you have to mask / with a second / :smiley:

You don’t need to “mask” /, you need to escape \ though. Replace \ with /.