Implemented OnPlayerVoice hook (Hurtworld)

Discussion in 'Feature Suggestions' started by JimLess, Feb 18, 2017.

  1. JimLess

    JimLess Scavenger

    Hi all! First of all, i want to thank for unban me!
    I know you've been waiting for the opportunity to mute players in voice chat. Here are the keys to solving the problem.
    Hook for oxide:
    hook for method VoiceChatServer.SendToServer
    Code (Text):
    public void SendToServer(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        if (Interface.CallHook("OnSendToServer_VoiceChatServer", new object[]
        {
            stream,
            info
        }) != null)
        {
            return;
        }
    Record from config.opj.
    Code (Text):
            {
              "Type": "Simple",
              "Hook": {
                "InjectionIndex": 0,
                "ReturnBehavior": 1,
                "ArgumentBehavior": 2,
                "ArgumentString": "",
                "HookTypeName": "Simple",
                "Name": "VoiceChatServer",
                "HookName": "OnSendToServer_VoiceChatServer",
                "AssemblyName": "Assembly-CSharp.dll",
                "TypeName": "VoiceChatServer",
                "Flagged": false,
                "Signature": {
                  "Exposure": 2,
                  "Name": "SendToServer",
                  "ReturnType": "System.Void",
                  "Parameters": [
                    "uLink.BitStream",
                    "uLink.NetworkMessageInfo"
                  ]
                },
                "MSILHash": "RW+/6qn4TvWSUb3aYaWSz+blsKlsCunAtMkEdhnSL5o=",
                "BaseHookName": null,
                "HookCategory": null
              }
    Example code for Plugin:
    User with steamid on check will be muted...
    Code (Text):
            object OnSendToServer_VoiceChatServer(uLink.BitStream stream, uLink.NetworkMessageInfo info)
            {
                var session = Singleton<GameManager>.Instance.GetSession(info.sender);
                if (session.SteamId.ToString() == "") // STEAM ID IN STRING
                    return true;
                return null;
            }
     
  2. Mughisi

    Mughisi Grenade Master Community Mod Oxide Developer

    Implemented OnPlayerVoice(PlayerSession session) and will be included in the next build.