1. Just an idea. Not sure how and if it will work.
    Entities should have their ID (OnEntitySpawned Cupboard allways had new ID). This should include doors. Maybe even the locks.
    So if you manage to get the ID of doors in new list, than Distinct the list by ID. It should clear the doubles.
    Easiest way I can see will be create storedData list and than read it back (with Distinct by ID).

    Again not sure if it will work and defiently not the easiest way.

    (yeah I am still in phase of learning...)
     
  2. Yeah, I had the same idea, about making a separate list, hoping for an easier solution tho xD will do the list as a last resort.
    I think there is a way to do something like: if (name.ToString.Contains("cupboard")) or Contains is only for lists ?

    Quickly googled it, so yeah, I can make a bool comparison to do Contains on string, if this works, its gonna be a temp solution, would still love to get suggestions for something more elegant ;D
     
    Last edited by a moderator: Jun 14, 2017
  3. On my way home, a better idea appeared.
    So you check a sphere around player. Everything in that sphere goes through foreach and results in hit where you separate Door, BoxStorage, Locker, BuildingPrivlidge from others.
    You could add there write it to Array[] by ID, there you could allready Distinct it.

    This seems to be better idea than to create a file write to it, read from it. HDD is allways slower than cpu.
     
  4. It is already a sphere check :} and this is all I need, a method to smoothly filter out unnecessary entities. P.S. just got it to filter out the TC, now it only adds to doors, added additional If checks to make sure that it is doors and only doors, also added list.add and list.contains check to prevent duplicate codelocks. Thanks for suggestions ;) If I get stuck again, gonna post here ^^
     
  5. yourList.Where(x => x.net.id == entity.net.uid)
     
  6. Thx Ryan, but already got a listcheck that works :}, also now my plugin adds players to TC's codelocks, lockers, boxes and ofc doors :}. All thats left is to polish the code :}

    P.S.

    It would be a nice touch to have this:
    CodeLock.DoEffect(string "effect")

    How do I dig up the effect names ?
     
    Last edited by a moderator: Jun 14, 2017
  7. Not quite sure what you mean by "effect names"
     
  8. This was what I meant:
    Code:
    CodeLock.DoEffect(this.effectDenied);
    "this.effectDenied/Allowed"

    However its accessible due to protection level ;/, means I need a reflection ?
     
  9. Yup, although I'm not sure why you'd need to use that.
     
  10. just a thought ^^ nwm, got another issue, I'd like the person who gets authed or removed from codelocks to be notified
    Example code:
    Code:
            void RemoveFriends(BasePlayer player, BaseEntity entity)
            {
                List<ulong> authList = new List<ulong>();
                var friends = GetFriends(player.userID);
                if (friends is ulong[])
                {
                    authList.Add(player.userID);
                    foreach (var member in (ulong[])friends)                                  
                        authList.Add(member);               
                    SortRemovalList (player, entity, authList);
                    SendReply(member, "You have been removed from codeLocks by " +player.UserIDString()); //
                }
                else
                {
                    SendReply(player, msg("noFriendsList"));
                    return;
                }           
            }
    First issue, how to SendReply to a "member" from the list?
    Second issue, how to send player."Nickname" ?

    cheers!
     
  11. Wulf

    Wulf Community Admin

    This thread is going way beyond the original topic. If you are still having issues or questions, please create a new thread under the relevant area.
     
  12. Sure, no problem ;)