internal static void CheckPlayer(NetUser player) { try { ulong userID = RustAPI.GetUserID(player); string userName = RustAPI.GetUserName(player); if (IsKickNeeded(userID)) { R.Log(string.Format("Kicked: {0}. Connection time: {1}", userName, RustAPI.GetUserConnectionTime(player)), true); // username includes ID RustAPI.KickUser(player, NetError.Facepunch_Connector_AuthException, true); // No client-side anticheat } #if DEBUG else { R.Log(string.Format("NoKick: {0}. Connection time: {1}", userName, RustAPI.GetUserConnectionTime(player)), true); } #endif } catch (Exception ex) { R.LogEx("CheckPlayer", ex); } }
private static void AntiCheat() { Thread.CurrentThread.Priority = System.Threading.ThreadPriority.Highest; R.Log("[RowAC] main thread initiated"); while (true) { try { var connections = RustAPI.GetConnections(); foreach (var p in connections) { var player = RustAPI.GetUser(p); if (RustAPI.IsUserConnected(player) && RustAPI.GetUserConnectionTime(player) >= rconf.minConnectionTime) { CheckPlayer(player); } } Thread.Sleep(rconf.threadSleepTime * 1000); } catch (Exception ex) { R.LogEx("LoopCrash", ex); } } }