1. Hello,

    So im trying to write a simple plugin that will change the players name color on chat to orange IF they belong to the "vip" groups. (groups being managed by oxide).

    Before looking at the code remeber that the group "vip" already exists.

    Code:
        class vipColor : RustPlugin
        {
            //intercepts the chat message
            object OnPlayerChat(ConsoleSystem.Arg arg)
            {
                BasePlayer player = (BasePlayer)arg.Connection.player;
                string Message = arg.GetString(0);
                
                if (string.IsNullOrEmpty(Message)) return false;            // place here the function to get the groups of player
                // Groups = getGroups(player)            if (Groups.Contains("vip"))
                    rust.BroadcastChat($"<color=#ffa500>{player.displayName}</color>", Message, player.UserIDString);            Puts($"{player.displayName}: {Message}");            return true;
            }
        }
    So im just missing the function that actually gets the groups that the player belongs to.

    Im sorry idont know any C# and i dont have any experience working with oxide plugins, so maybe this is very simple and basic but i cant find any doc about working with groups and i cant find a plugin that solves this.

    Regards.
     
  2. Hey,
    You can go through existing groups

    Code:
    foreach (var group in permission.GetGroups())
    {
    }
    and/or you can go through the members of a group

    Code:
    foreach (var user in permission.GetUsersInGroup("vip"))
    {
    }
    
    I'm not sure if you can go through a list of groups by player, but you combine both of these for the same result.

    Code:
    foreach (var group in permission.GetGroups())
    {
        foreach (var user in permission.GetUsersInGroup("vip"))
        {
        }
    }
    I think you could do
    if (permission.GetUsersInGroup("vip").Contains(player));
    but I haven't checked.
     
  3. Use better chat plugin
     
  4. Hello,
    Oxide provides his own Player's class for easily do what you want to.
    Code:
    if (player.IPlayer.BelongsToGroup("vip"))
        rust.BroadcastChat($"<color=#ffa500>{player.displayName}</color>", Message, player.UserIDString);
     
  5. This works prerfectly... Thank you so much, im forever in your debt :D