C#:
// Все права принадлежат дискорд сообществу https://discord.gg/VgNHPpNrz6
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using UnityEngine;
using System;
using Oxide.Core.Libraries;
using System.Diagnostics;
using System.Collections;
using ProtoBuf;
using Oxide.Core.Plugins;
namespace Oxide.Plugins
{
[Info("AnticheatPlus", "YourName", "1.0.0")]
[Description("Local anticheat system for Rust.")]
public class AnticheatPlus : RustPlugin
{
#region Fields
private Dictionary<string, ViolationData> violationCache = new Dictionary<string, ViolationData>();
private Dictionary<ulong, int> processedLifetimeUptime = new Dictionary<ulong, int>();
[PluginReference]
private Plugin SkillTree; // Reference to the SkillTree plugin
#endregion
#region Local Anticheat Checks
private void OnPlayerTick(BasePlayer player)
{
if (player == null || !player.IsConnected) return;
// Speed Hack Check
if (IsSpeedHacking(player))
{
Puts($"{player.displayName} is suspected of speed hacking.");
// Take action, e.g., warn or kick
}
// Fly Hack Check
if (IsFlyHacking(player))
{
Puts($"{player.displayName} is suspected of fly hacking.");
// Take action, e.g., warn or kick
}
}
private bool IsSpeedHacking(BasePlayer player)
{
if (IsWhitelisted(player, "SpeedHack")) return false; // Check if the player is whitelisted for speed hacks
// Implement speed hack detection logic
return false;
}
private bool IsFlyHacking(BasePlayer player)
{
if (IsWhitelisted(player, "FlyHack")) return false; // Check if the player is whitelisted for fly hacks
// Implement fly hack detection logic
return false;
}
private bool IsWhitelisted(BasePlayer player, string hackType)
{
if (SkillTree == null) return false; // Ensure SkillTree plugin is loaded
var result = SkillTree.Call("GetBuffDetails", player.userID);
if (result is Dictionary<string, object> bd)
{
switch (hackType)
{
case "SpeedHack":
bool isWhitelisted = bd.ContainsKey("SpeedBoost");
Puts($"Player {player.displayName} speed hack whitelist: {isWhitelisted}");
return isWhitelisted;
case "FlyHack":
return bd.ContainsKey("FlyAbility");
}
}
return false;
}
#endregion
#region Plugin Exceptions
private void OnPlayerAttack(BasePlayer attacker, HitInfo info)
{
if (attacker == null || info == null) return;
// Check if the action is allowed by SkillTree or other plugins
if (IsAllowedBySkillTree(attacker))
{
return; // Allow the action
}
// Otherwise, perform anticheat checks
//...}
private bool IsAllowedBySkillTree(BasePlayer player)
{
// Implement logic to check if the action is allowed by SkillTree
// Return true if allowed
return false;
}
#endregion
#region Helper Classes
private class ViolationData
{
public int FlyhacksViolations { get; set; }
public int JumpshotViolations { get; set; }
public int F7Reports1HR { get; set; }
}
#endregion
}
}