1. Thanks Wulf, got me thinking so I searched for that warning. It was in the .cs file and it had to do with the permission privatemessage.disable. For some reason this was set to true for groups default and admin. Really not sure how that came about, I'm thinking "maybe" the mod PermissionManager.

    In any case, it simply required:

    oxide.revoke group default privatemessage.disable
    oxide.revoke group admin privatemessage.disable

    Hope this might help someone else.
     
  2. Wulf

    Wulf Community Admin

    This plugin doesn't have a ufilter_enabled config option.

    Must have been a modified version then, as this plugin doesn't have that message nor that permission.
     
  3. Can you add support for BetterChatMute, if not already implemented? Players still keep spamming other players/admins when muted and shouldn't be able to talk at all.

    EDIT: Appearently there isn't a hook called CanChat at all? so what is the plugin calling out to?
     
    Last edited by a moderator: Jan 30, 2018
  4. Wulf

    Wulf Community Admin

    CanChat would be in any other plugin that has that hook in it. It doesn’t have to be an actual hook added by Oxide, just a method that a plugin can call in other plugins if they have it.
     
  5. Modified code to handle muted players using BetterChatMute
    Edit: Appearently it is not allowed for me to share my modified full code here, so i'm just sharing snippets
    Code:
            private void Init()
            {
                lang.RegisterMessages(new Dictionary<string, string>
                {
                    {"PMTo", "<color=#00FFFF>PM to {0}</color>: {1}"},
                    {"PMFrom", "<color=#00FFFF>PM from {0}</color>: {1}"},
                    {"PlayerNotOnline", "{0} is not online."},
                    {"NotOnlineAnymore", "The last person you was talking to is not online anymore."},
                    {"NotMessaged", "You haven't messaged anyone or they haven't messaged you."},
                    {"IgnoreYou", "<color=red>{0} is ignoring you and cant recieve your PMs</color>"},
                    {"SelfPM", "You can not send messages to yourself."},
                    {"SyntaxR", "Incorrect Syntax use: /r <msg>"},
                    {"ErrorMute", "You can not chat while being muted."},
                    {"SyntaxPM", "Incorrect Syntax use: /pm <name> <msg>"}
                }, this);
            }
    
    Code:
            [ChatCommand("pm")]
            void cmdPm(BasePlayer player, string command, string[] args)
            {
                if (args.Length > 1)
                {
                    var name = args[0];
                    var p = FindPlayer(name);
                    if (p == player)
                    {
                        PrintMessage(player, "SelfPM");
                        return;
                    }
                    if (p != null)
                    {
                        var hasMute = BetterChatMute?.CallHook("API_IsMuted", player.IPlayer);                    if (hasMute != null && (bool) hasMute)
                        {  
                            PrintMessage(player, "ErrorMute");
                            return;
                        }
                        var hasIgnore = Ignore?.CallHook("HasIgnored", p.userID, player.userID);
                        if (hasIgnore != null && (bool) hasIgnore)
                        {
                            PrintMessage(player, "IgnoreYou", p.displayName);
                            return;
                        }
                        var msg = string.Empty;
                        for (var i = 1; i < args.Length; i++)
                            msg = $"{msg} {args[i]}";
                        pmHistory[player.userID] = p.userID;
                        pmHistory[p.userID] = player.userID;
                        PrintMessage(player, "PMTo", p.displayName, msg);
                        PrintMessage(p, "PMFrom", player.displayName, msg);
                        Puts("[PM]{0}->{1}:{2}", player.displayName, p.displayName, msg);
                    }
                    else
                        PrintMessage(player, "PlayerNotOnline", name);
                }
                else
                    PrintMessage(player, "SyntaxPM");
            }
    
    Code:
            [ChatCommand("r")]
            void cmdPmReply(BasePlayer player, string command, string[] args)
            {
                if (args.Length > 0)
                {
                    ulong steamid;
                    if (pmHistory.TryGetValue(player.userID, out steamid))
                    {
                        var p = FindPlayer(steamid);
                        if (p != null)
                        {
                            var hasMute = BetterChatMute?.CallHook("API_IsMuted", player.IPlayer);
                            if (hasMute != null && (bool) hasMute)
                            {  
                                PrintMessage(player, "ErrorMute");
                                return;
                            }
                            var hasIgnore = Ignore?.CallHook("HasIgnored", p.userID, player.userID);
                            if (hasIgnore != null && (bool)hasIgnore)
                            {
                                PrintMessage(player, "IgnoreYou", p.displayName);
                                return;
                            }
                            var msg = string.Empty;
                            for (var i = 0; i < args.Length; i++)
                                msg = $"{msg} {args[i]}";
                            PrintMessage(player, "PMTo", p.displayName, msg);
                            PrintMessage(p, "PMFrom", player.displayName, msg);
                            Puts("[PM]{0}->{1}:{2}", player.displayName, p.displayName, msg);
                        }
                        else
                            PrintMessage(player, "NotOnlineAnymore");
                    }
                    else
                        PrintMessage(player, "NotMessaged");
                }
                else
                    PrintMessage(player, "SyntaxR");
            }
    



    I know it is missing toggles for switching this functionality on/off, bypassing this functionality for players with permission and so forth, but maybe it helps someone who is also having the same kind of problem..
     
    Last edited by a moderator: Jan 31, 2018
  6. Getting this error after 4/5 update

    Code:
    Failed to call hook 'OnPlayerDisconnected' on plugin 'PrivateMessage v2.0.2' (NullReferenceException: Object reference not set to an instance of an object)
      at Oxide.Plugins.PrivateMessage.OnPlayerDisconnected (.BasePlayer player) [0x00000] in :0
      at Oxide.Plugins.PrivateMessage.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in :0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00000] in :0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in :0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in :0 
     
  7. Wulf

    Wulf Community Admin

    Update Oxide please.
     
  8. Code:
    Protocol: 2078.160.1
    Build Date: 04/05/2018 22:54:00
    Unity Version: 2017.1.3f1
    Changeset: 26385
    Branch: releaseOxide.Rust 2.0.3871
    Code:
    Failed to call hook 'cmdPm' on plugin 'PrivateMessage v2.0.2' (NullReferenceException: Object reference not set to an instance of an object)
      at System.Globalization.CompareInfo.IndexOf (System.String source, System.String value, CompareOptions options) [0x00000] in <filename unknown>:0
      at UnityEngine.StringEx.Contains (System.String haystack, System.String needle,CompareOptions options) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PrivateMessage.FindPlayer (System.String nameOrIdOrIp) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PrivateMessage.cmdPm (.BasePlayer player, System.String command, System.String[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.PrivateMessage.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filenameunknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
     
  9. JMJ

    JMJ

    Can you stop it from sending to the console? I have a tight whitelist community and really have no need to see everyones messages.
     
  10. Can you please make an permission for this? So i can finally mute people from pm aswell xD
     
  11. Is there a way to modify something in RCON so private messages show up in the chat tab (not just console)?
     
  12. Wulf

    Wulf Community Admin

    They wouldn't really be private anymore then, would they. :p
     
  13. This is true. They do show up in the Console tab which is super helpful. I like being able to see messages since we've seen players try to poach our players via PMs previously.
     
  14. Hi @Domestos

    Would It be possible for Admins to see the private messages of players InGame and not just in the console?

    Thanks,
    - TehZombiJesus