1. Hello,

    I am trying to get building privlidges from a zone, to explain correctly, i am trying to block damage from player to building block if they don't have building privileges.

    actually i got it working but it can be exploited, what i have is if player has building privlidges they can do dmg but it don't work like a want because :

    Player A has a house in zone A with cupboard A.
    Player B can raid if he put cupboard outside the cupboard range of A

    What i want is to be able to check if Player B has building privlidges of cupboard A and with that he will be able to raid the house in zone A.

    I hope it's clear ^^
     
  2. Solved,

    it seem this is working as i want :)

    Code:
            private bool CupboardPrivlidge(BasePlayer player, Vector3 position)
            {
                var hits = Physics.OverlapSphere(position, 2f, cupboardMask);
                foreach (var collider in hits)
                {
                    var buildingPrivlidge = collider.GetComponentInParent<BuildingPrivlidge>();
                    if (buildingPrivlidge == null) continue;                List<string> ids = (from id in buildingPrivlidge.authorizedPlayers select id.userid.ToString()).ToList();                Puts(buildingPrivlidge.PrefabName);
                    foreach (string priv in ids)
                    {
                        if (priv == player.UserIDString)
                        {
                            return true;
                        }
                    }        
                }
                return false;
            }
     
    Last edited by a moderator: Sep 11, 2016