Buyable Doors Help

Hello, I am making an RP gamemode, and I have hit a rock.

I am not sure how to make a buyable door script.
Now I am not asking for someone to code, just point me in the right direction. Like a Wiki page or something that I can learn from.

Much thanks, WholeGamer.

Why not look at how DarkRP does it?

Bump

From another post of yours you are running a DarkRP server if I’m correct? If so, why would yo be asking for help towards a door system when DarkRP already has one?

He might mean a door group system, where you buy one door and it buys all the doors for the house?

Yes, I do run a DarkRP server, but as my post says, I am making a game mode, just because I make a game mode doesn’t mean I need a server running it.

Well for starters, a door is an entity, just like any other non-world item in a source map. Any entity in garrysmod has an associated meta table that you can assign values. So deciding if a player can own a door is as simple as getting an eye trace towards an entity, checking if that entity is a door, checking if a player has enough currency to purchase the door, and assigning a value to the door to let other players know that the player that bought the door actually owns it.

So here are some links to pages to get you headed in the right direction:

Door entities to check for:

Eye traces:

Key Values for the door Entity:

If you try to use 3D2D to display names of owners of the doors over the doors themselves (in a manner to rotate/slide with the door as you toggle its state), you’ll run into some snags. There are many different classes of door, and lots of them do not return their angle property correctly. To get around this you can calculate the door’s angle using ent:LocalToWorld and the ent’s OBB information, relying on the min point and max point to generate the angle and take only the yaw to apply to the text for the angle. Each door’s angle returned in this OBB manner will be off by a certain amount that depends on that kind of door (the class), so you’ll have to add an angle value from a table (such as doorangs[doorclass]).