1. Hi how to put cupboards with when you place it is already autoryzided??
     
  2. Hook OnEntitySpawn -> Check if is an Cupboard -> Check if is your (ownerid) -> Than add you userid in the cupboard
     
  3. Ah.. Looks like someone had the pleasure to see one of my custom plugins in action :p
     
  4. You Share it? :p
     
  5. Probably wouldn't even need to check if it's your id, Just add the ownerid to the cupboard.
    Probably a couple of lines plugin tbh
     
  6. I so far have some code to call entity and to ensure it is a cupboard along with who placed it. But can someone help me with adding them to that cupboard?
     
  7. Ez Pz, enjoy :)
    Code:
    using System.Reflection;
    using UnityEngine;namespace Oxide.Plugins
    {
        [Info("AutoCupboard", "DefaultPlayer", "1.0")]
        public class AutoCupboard : RustPlugin
        {
            private static readonly MethodInfo AuthMethod = typeof (BuildingPrivlidge).GetMethod("AddSelfAuthorize", BindingFlags.Instance | BindingFlags.NonPublic);
            private void OnEntityBuilt(Planner plan, GameObject entity)
            {
                var cupboard = entity.GetComponent<BuildingPrivlidge>();
                if (cupboard)
                    AuthMethod.Invoke(cupboard, new object[]{new BaseEntity.RPCMessage {player = plan.GetOwnerPlayer()}});        }
        }
    }
     
  8. If you really wanted to you could get that users friends list and also add their ID's.
    Also could do the same with Auto Turrent
     
  9. Not the best implementation...and the add friends function makes the whole thing before worthless...
     
  10. It does not pretends to be the best one, just a sample.
    Yeah, probably there an some overhead on invoking UpdateAllPlayers/Update, but it works.
    You may advise the better way of doing this, at your wish.

    Edit:
    Updated gist
     
    Last edited by a moderator: Nov 20, 2016