Not as clear a title as I want it to be, but basically this is what I want to do.
I have a map full of doors all using func_door, right? Then I have two teams, one of humans, one of CPs. What I want to do is check every time a player hits ‘E’ (or whatever key they have for use), and see if there’s a door in front of them. Once they hit E in front of a door, I want it to check for a certain string that door entity has, and if it has the right one for each team, it opens. If it doesn’t, then it doesn’t open.
What I want the function to do:
Find door in certain range in front of player > check flag > check team > if team and flag match, open door, if not, do nothing.
I know there’s an ENT:Use() method, as well as seeing if the IN_USE is down using KeyDown, but I’m not entirely sure where to put the code so the player will always have access to it, or if there’s even a hook I can intercept.