1. Strange situation. I have hook in my plugin:

    Code:
            [HookMethod("HasFriend")]
            private bool HasFriend(ulong playerId, ulong friendId)
            {
                if (!knownPlayers.Contains(playerId) || !knownPlayers.Contains(friendId))
                {
                    return false;
                }            if (!playerInfo.ContainsKey(playerId))
                {
                    var kvp = LoadData(playerId);
                    playerInfo.Add(kvp);
                }            PlayerInfo p = null;
                if (playerInfo.TryGetValue(playerId, out p))
                {
                    var friend = p.friends.FirstOrDefault(f => f.Id == friendId);
                    if (friend != null)
                    {
                        return true;
                    }
                }
                return false;
            }
    Calling it from other plugin:

    Code:
    return (bool)Players?.Call("HasFriend", new object[] { playerId, friendId });
    Before last Rust and Oxide update it was working fine? but now I'm getting:
    Code:
    [FriendlyFire] FriendlyFire: OnPlayerAttack failed: Object reference not set to an instance of an object
    Hmm, trying other method:
    Code:
    return (bool)Players?.CallHook("HasFriend", playerId, friendId );
    same error.

    Wtf?
     
  2. I'd recommend better null checking. It's hard to say without having the full plugin code, but with that snippet it looks like any of knownPlayers, playerInfo, or p.friends could be null.
     
  3. no, all vars is initializing correctly and plugin worked like a charm almost 2 years...
     
  4. Assuming this is true, it may be related to recent hook "overloading" changes in Oxide.
     
  5. Wulf

    Wulf Community Admin

    Please test the latest Oxide snapshot here: AppVeyor

    Should fix plugins using the wrong hook arguments in the plugin they are relying on (ie. Economics) by sending new object[ "blah", blah ] instead of the actual hook's args in the plugin they are calling or sending an int when the target plugin expects a double.

    I've tested it personally and it resolved the issue you were having, so please test for yourself as able.
     
  6. Just tested it now. Not working :(
    Code:
    > version
    Protocol: 2022.152.1
    Build Date: 10/06/2017 05:24:20
    Unity Version: 2017.1.1f1
    Changeset: 23156
    Branch: main
    Oxide Version: 2.0.3519
    Tried
    Code:
    return (bool)Players?.Call("HasFriend", new object[] { playerId, friendId });
    and
    Code:
    return (bool)Players?.CallHook("HasFriend", playerId, friendId );
     
  7. Wulf

    Wulf Community Admin

    What types are playerId and friendId in the plugin doing the call?
     
  8. Code:
            private bool HasFriend(string playerId, string friendId) {
                if (Players == null) return false;
                return (bool)Players?.CallHook("HasFriend", playerId, friendId );
            }
     
  9. Wulf

    Wulf Community Admin

    So you're sending a string to a hook that expects a ulong?
     
  10. I know that strange, but that worked before :) I'll convert it and check again...
     
  11. Wulf

    Wulf Community Admin

    Yeah, now that multiple hook signatures are supported, best to send what the hook expects.
     
  12. Its working now. Thanks for help!