Ejemplo n.º 1
0
Archivo: ZNet.cs Proyecto: fclante/VAC
        private static bool Prefix(ref ZNet __instance, ZRpc rpc, ZPackage pkg)
        {
            if (__instance.IsServer())
            {
                string self = "";
                if (pkg.Size() > 32)
                {
                    pkg.SetPos(pkg.Size() - 32 - 1);
                    if (pkg.ReadByte() == (byte)32)
                    {
                        pkg.SetPos(pkg.GetPos() - 1);
                        self = pkg.ReadString();
                    }
                }

                ZLog.Log((object)("[AntiMods]: Got client hash: " + self + "\nmine: " + VACPlugin.PluginsHash));
                ZLog.LogWarning("Plugins Hash is Equals: " + !self.Equals(VACPlugin.PluginsHash) + " ForceMods: " + VACPlugin.forcesamemods.Value);
                ZLog.LogWarning("Is in Admin List: " + !ZNet.instance.m_adminList.Contains(rpc.GetSocket().GetHostName()) + "Admin Bypass: "******"[AntiMods]: Kicking Client: " + rpc.GetSocket().GetEndPointString() + " (incompatible mods)"));
                    rpc.Invoke("Error", (object)num);
                    return(false);
                }

                ZLog.Log((object)("[AntiMods]: Accepting Client: " + rpc.GetSocket().GetEndPointString()));
            }
            return(true);
        }
Ejemplo n.º 2
0
 public static void ReadConfigPkg(ZPackage pkg)
 {
     if (!ZNet.IsServer())
     {
         int entries = 0;
         while (pkg.GetPos() != pkg.Size())
         {
             string configKey = pkg.ReadString();
             string stringVal = pkg.ReadString();
             entries++;
             if (Config.Instance._configEntries.ContainsKey(configKey))
             {
                 Config.Instance._configEntries[configKey].SetSerializedValue(stringVal);
                 Logger.LogInfo($"Applied Server Authoritative config pair => {configKey}: {stringVal}");
             }
             else
             {
                 Logger.LogError($"Recieved config key we dont have locally. Possible Version Mismatch. {configKey}: {stringVal}");
             }
         }
         Logger.LogInfo($"Applied {entries} config pairs");
     }
 }