1. Hi !

    I try to find a plugin that can move a player in a specific group at the first connection so only once.
    I want it because beginners will have to survive at least in a PVE mode until a certain level and then they will have access to PVP mode ( to help new Rust players to learn the game and prevent them to be killed by high lvl full stuff ) so I need to place them in a beginner group at the first connection to use others plugins, as you know I can't use default group to do it because all players are in this group ...

    Do you know a plugin that can do it ?
     
  2. You could do something like this:
    Code:
    namespace Oxide.Plugins
    {
        class GroupOnConnect : RustPlugin
        {
            string permissionName = "grouponconnect.hasjoinedbefore";        void Init() => permission.RegisterPermission(permissionName, this);        void OnPlayerInit(BasePlayer player)
            {
                if (!(permission.UserHasPermission(player.UserIDString, permissionName)))
                {
                    permission.GrantUserPermission(player.UserIDString, permissionName, this);
                    permission.AddUserGroup(player.UserIDString, "yourgroupnamehere");
                }
            }
        }
    }
    Replace "yourgroupnamehere" with the group name you want to assign new players to.

    EDIT: Please note that this hasn't been tested but will probably work. ;)
     
    Last edited by a moderator: Jul 28, 2016
  3. Wulf

    Wulf Community Admin

    You wouldn't even need a permission, just check if they are already in the desired group or not.
     
  4. I was thinking of doing that but maybe the higher-levelled players wouldn't be in that group anymore, you wouldn't want them getting bumped back down when they join.
     
  5. Absolutely, higher-levelled player don't need to be in that group anymore once the player is in PVP mode so grant a permission on the player himself is necessary.

    I had to change OnPlayerConnected by OnPlayerInit but anyway it work like a charm !

    Thank you !
     
  6. You're welcome. :)
     
  7. Wulf

    Wulf Community Admin

    OnPlayerConnected would work, or even OnUserApprove, but they don't accept BasePlayer as the argument, so you'd have to get the ID from what they use.
     
  8. Ha, woops.
     
  9. So, OnPlayerInit is a good way to get it work with BasePlayer, no ? Or should I change it and get OnPlayerConnected working by getting the ID from what they use ? I mean, what's the best way ?
     
  10. OnPlayerInit will do just fine. There's no need to assign the group before they've even loaded in, it won't make a difference.
     
  11. Okay, nice !
     
  12. Wulf

    Wulf Community Admin

    The only time you'd need anything earlier is if you want to handle something before they spawn/are initialized.
     
  13. Didn't know that, thanks for the informations.