Group Limits

Limits groups based on authorization.

Total Downloads: 1,648 - First Release: Jun 5, 2017 - Last Update: Jun 30, 2017

5/5, 6 likes
  1. Kappasaurus submitted a new resource:

    Group Limits - Limits groups based on authorization.

    Read more about this resource...
     
  2. Hey Kappa, thanks for the plugin!

    Is there any chance you might be willing to implement Oxide | PushAPI support? As I don't have a means of running a Discord bot at the moment, and I'd love to be able to make better use of your plugin.

    Also, I don't seem to be getting any sort of ingame notifications. I have admin permissions and also granted my own oxide group the notify permission, but still nothing. I see that people are authorizing over my set group limit as I see the Discord error in my console when they do it, but it doesnt send anything ingame.
     
    Last edited by a moderator: Jun 7, 2017
  3. I'll look into it, but no promises yet. Would you happen to have "Notify staff" set to false in the configuration file? When I tested all of us got the messages. Also, what do you mean by this Discord error?
     
  4. I don't have anything else that uses the Discord API so I am assuming that this error is being triggered by your plugin.

    (12:45:08) | [Discord] Discord Api responded with 401: {"code": 0, "message": "401: Unauthorized"}

    (12:45:08) | [Discord] Discord Api responded with 401: {"code": 0, "message": "401: Unauthorized"}

    And this is how my config is setup.
    {
    "Discord notifications": true,
    "Enforce limits": false,
    "Group limit": 4,
    "Notify players": false,
    "Notify staff": true,
    "Slack notifications": false
    }
     
  5. I haven't had issues with Discord, however I'd recommend taking a look at this. RustPlugins/src/RustPlugins/Discord at master · seanbyrne88/RustPlugins · GitHub. As for the notifications, this is the block of code which notifies admins/people with the permission.
    Code:
        if (notifyStaff)
        {
            foreach (var target in BasePlayer.activePlayerList.Where(x => HasPerm(player, "grouplimits.notify")))
                PrintToChat(target, lang.GetMessage("Staff Message", this, target.UserIDString).Replace("{playerName}", player.displayName).Replace("{steamID}", player.UserIDString));
        }
    It sends notifications to me, I'm going to test it now though in-case I missed something.
    [DOUBLEPOST=1497125838][/DOUBLEPOST]So, this is likely the issue you're having. The exclude permission is grouplimits.exclude, admins are automatically excluded. This is what it looks like when I remove the admin check and don't have the exclude permission. Gyazo - 688f4347a0db2f0bd0444b4536c9138b.gif
     
    Last edited by a moderator: Jun 11, 2017
  6. I got a Discord bot setup, and the messages send fine to my Discord server now. But neither myself, nor any admins get any notification ingame when somebody breaks the group limit, still only in Discord. And the other issue is that the plugin detects somebody breaking the auth limit, even if they are just failing on a code lock. Causes a ton of false positives when people are just trying to guess door codes.
     
  7. I use it personally and haven't had notification issues, and I don't see a possible cause in the code. Regarding the other issue, thank you.
     
  8. Kappasaurus updated Group Limits with a new update entry:

    1.0.1

     
  9. Can I recommend adding
    Code:
     On server | {ConVar.Server.hostname}
    to the Discord notification, it really helps if you own multiple servers with group limits
     
  10. Kappasaurus updated Group Limits with a new update entry:

    1.0.2

     
  11. Kappasaurus updated Group Limits with a new update entry:

    2.0.0

     
  12. thanks for this plugin, it's perfect for my duo-max server. after this new update however, my logs are filled with:
    logMessage
    logMessage
    logMessage
    etc.

    all good though, i just reverted back to 1.0.2 and i'll keep an eye on this - just posting here in case it's a problem with the plugin, and not just something i've done :)
     
  13. @Kappasaurus can you add sleeping bag counts as well?

    This should get you started.

    Code:
            List<ulong> GetDistinctSleepingBags(Vector3 position) // get each bag placed in a specific area and only return the distinct amount of bags (ignoring duplicates)
            {
                var colliders = Pool.GetList<Collider>();
                Vis.Colliders(position, 25f, colliders, LayerMask.GetMask("Deployed"), QueryTriggerInteraction.Collide);            var bags = colliders.Where(collider => collider.gameObject.ToBaseEntity().ShortPrefabName.Equals("sleepingbag_leather_deployed")).Select(collider => collider.gameObject.ToBaseEntity()).Cast<SleepingBag>();
                var list = new List<ulong>();            foreach (var bag in bags)
                    if (!list.Contains(bag.deployerUserID))
                        list.Add(bag.deployerUserID);            Pool.FreeList<Collider>(ref colliders);            return list;
            }        object CanAssignBed(SleepingBag bag, BasePlayer player, ulong targetPlayerId)
            {
                var bagIds = GetDistinctSleepingBags(player.transform.position);            if (bagIds.Count > 5 && !bagIds.Contains(targetPlayerId))
                    return false;            return null;
            }
    
     
    Last edited by a moderator: Jun 30, 2017
  14. Kappasaurus updated Group Limits with a new update entry:

    2.0.1


    [DOUBLEPOST=1498844181][/DOUBLEPOST]
    I don't understand quite what you mean, you just want to get if more then X sleeping bags are in one area?
     
  15. I don't want more than X players being able to put sleeping bags down within the same compound. Obviously, this code doesn't do that, but it's one step closer to prevent players from bypassing the group limit.

    GetDistinctSleepingBags gets all unique sleeping bag users within 25 meters of the bag being assigned. If it exceeds 5 (which should be Configuration.MaxPlayers) then the bag assign is rejected.

    With some work, you could make this to where your group limit couldn't be bypassed with the exception of teleporting in. That could also be handled by using the canTeleport(BasePlayer player) and CanTeleport(BasePlayer player) hooks
     
  16. Good idea, somebody actually asked me to implement some features to shock everyone in an X meter radius if there are more than the limit. I thought it was the good idea but a bit too rigid. I suppose I'll add it all. :D
     
  17. ah! thanks!
     
  18. I have setup a discord bot and I don't get any errors but the Bot stays offline and never sends a message to my discord. :(

    // Discord.json config:
    {
    "BotToken": "xxxxxxxxxxxxxxxxxx.clXqmLjLBpRiQlABGttqDbVxxxx",
    "ChannelID": xxxx9453318155xxx
    }

    And yes, I have enabled notification to discord in the GroupLimits.json file.
     
  19. I personally don't know how the Discord plugin works, but from my experience in making Discord bots you have to host them.