1. I want to prevent players from picking up doors.

    For some reason OnCollectiblePickup is not being called, I'm not sure how else to solve this.

    void OnCollectiblePickup(Item item, BasePlayer player)
    {
    PrintToChat(player, $"OnCollectiblePickup works!");
    }

    ... it doesn't work (for doors anyway)
     
  2. Wulf

    Wulf Community Admin

    You could use the CanAcceptItem hook to prevent it being added to a container (inventory), or perhaps remove it once it has been added.
     
  3. Will that prevent the door from being removed?
     
  4. Wulf

    Wulf Community Admin

    Removed from what?
     
  5. A door frame... maybe I asked the wrong question.

    I'm trying to prevent players from removing doors from buildings (the pick-up sub-menu on the door)...
     
    Last edited by a moderator: Sep 18, 2016
  6. Wulf

    Wulf Community Admin

    Ah, not sure which hook would be triggered in that case. Maybe OnEntityKill or OnStructureDemolish?
     
  7. Not sure if this would work out for you, but a work-around is to put a lock on the door and make sure to return true to CanOpenDoor. The player will be prompted to unlock the door, thus can't remove it but will still be able to freely open the door without knowing the code. It's how I've achieved this in a future game-mode to be released.

    Works for hatches as well.
     
  8. I'll give that a go. Thanks.
     
  9. Worked great..

    Code:
            object CanUseDoor(BasePlayer player, BaseLock door)
            {
                if (!door.IsLocked()) return true;            if (isTooFar(player.transform.position))
                    return null;             return true;
            }
    
     
    Last edited by a moderator: Sep 25, 2016
  10. Glad it worked out for you! :)
     
  11. If anyone's looking for an alternative, I use zone manager for this.