1. I have a very important part in the plugin using BuildPrivilegeTrigger how do I now replace it?
    I was responsible for the fact that a person enters the scope of the cupboard and it checks if a friend is registered in this cupboard, if so, then the friend also registered in the same cupboard.

    Piece of my code
    Code:
    private void OnEntityEnter(TriggerBase trigger, BaseEntity entity)
            {
                if (!(trigger is BuildPrivilegeTrigger) || !(entity is BasePlayer))
                    return;            var cupboard = (trigger as BuildPrivilegeTrigger).privlidgeEntity;
                var player = entity.ToPlayer();            if (cupboard.IsAuthed(player) || !InOneClan(cupboard.OwnerID, player.userID))
                    return;            var clan = Clan.GetClanByPlayer(player.UserIDString);
                if (cupboard.authorizedPlayers.Count == 0 || cupboard.authorizedPlayers.Exists(x => clan.Members.ContainsKey(x.userid.ToString())))
                {
                    cupboard.authorizedPlayers.Add(new ProtoBuf.PlayerNameID
                    {
                        userid = player.userID,
                        username = player.displayName,
                        ShouldPool = true
                    });                player.SendNetworkUpdateImmediate();
                    cupboard.SendNetworkUpdateImmediate();
                }
            }
    And immediately another question, OnSwitchAmmo (BasePlayer player, BaseProjectile projectile) hook is responsible for the pressed recharge button or for the moment of quick recharging without selecting a cartridge?
     
  2. Wulf

    Wulf Community Admin

  3. All the same, I did not understand how to replace it, and still you can tell for OnSwitchAmmo?
     
  4. Wulf

    Wulf Community Admin

    I don't think there is a replacement for it, which is what is stated in that thread. As far as I know with OnSwitchAmmo, it's when a player tries to switch ammo magazines/types.
     
  5. The trigger is gone completely, closest replacement is BasePlayer.GetBuildingPrivilege.
    But you need to call it at some fixed rate or so in order to detect nearby cupboards.
     
  6. thanks for answers