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)
Solved Preventing players from picking up doors?
Discussion in 'Rust Development' started by carny666, Sep 18, 2016.
-
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.
-
Will that prevent the door from being removed?
-
Wulf Community Admin
-
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 -
Wulf Community Admin
-
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. -
-
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 -
-
If anyone's looking for an alternative, I use zone manager for this.