"use client"; import { useState, useRef } from "react"; import ServerConfigForm from "./ServerConfigForm"; import { InformationCircleIcon, ClipboardDocumentIcon, ArrowPathIcon, PlusIcon, XMarkIcon } from "@heroicons/react/24/outline"; const tabs = [ { name: "General" }, { name: "Player" }, { name: "Weapons" }, { name: "Vehicle" }, { name: "Object/Particles" }, { name: "Explosion" }, { name: "Resources" }, { name: "Movement" }, { name: "Client" }, { name: "Props" }, { name: "Other" }, ]; const protectionDescriptions: Record = { antiNoclip: "Prevents players from moving through walls or objects.", antiSemiGodmode: "Detects partial invincibility cheats.", antiInvisible: "Prevents player invisibility hacks.", antiTeleportToWaypoint: "Stops teleporting directly to map waypoints.", antiFastRun: "Detects abnormal running speeds.", antiSuperJump2: "Blocks enhanced jumping cheats.", antiTinyPed: "Prevents shrinking player models.", antiGodmode: "Detects full invincibility.", armourDetection: "Detects unauthorized armor usage.", antiTeleport: "Blocks teleporting cheats.", antiSpeedhack: "Detects speed hacking.", antiSuperJump: "Stops super jump cheats.", antiNightThermalVision: "Prevents use of night or thermal vision hacks.", antiNoHeadshot: "Detects cheats that prevent headshots.", }; const protectionsByTab: Record = { General: [], Player: [ { label: "Anti Noclip", key: "antiNoclip" }, { label: "Anti Semi Godmode", key: "antiSemiGodmode" }, { label: "Anti Invisible", key: "antiInvisible" }, { label: "Anti Teleport To Waypoint", key: "antiTeleportToWaypoint" }, { label: "Anti Fast Run", key: "antiFastRun" }, { label: "Anti SuperJump2", key: "antiSuperJump2" }, { label: "Anti Tiny Ped", key: "antiTinyPed" }, { label: "Anti Godmode", key: "antiGodmode" }, { label: "Armour Detection", key: "armourDetection" }, { label: "Anti Teleport", key: "antiTeleport" }, { label: "Anti Speedhack", key: "antiSpeedhack" }, { label: "Anti SuperJump", key: "antiSuperJump" }, { label: "Anti Night/ThermalVision", key: "antiNightThermalVision" }, { label: "Anti No Headshot", key: "antiNoHeadshot" }, ], Weapons: [], Vehicle: [], "Object/Particles": [], Explosion: [], Resources: [], Movement: [], Client: [], Props: [], Other: [], }; const actionOptions = ["Ban", "Kick", "Warn"]; export default function PlayerProtections() { const allProtections = Object.values(protectionsByTab).flat(); const [settings, setSettings] = useState>(() => allProtections.reduce((acc, p) => { acc[p.key] = { enabled: false, action: "Ban" }; return acc; }, {} as Record) ); const [copied, setCopied] = useState(false); const [activeTab, setActiveTab] = useState("Player"); const textareaRef = useRef(null); function toggleProtection(key: string) { setSettings((prev) => { const current = prev[key]; if (!current) { return { ...prev, [key]: { enabled: true, action: "Ban" }, }; } return { ...prev, [key]: { ...current, enabled: !current.enabled }, }; }); } function setAction(key: string, action: string) { if (!actionOptions.includes(action)) return; setSettings((prev) => { const current = prev[key]; if (!current) { return { ...prev, [key]: { enabled: false, action }, }; } return { ...prev, [key]: { ...current, action }, }; }); } const protectionsForActiveTab = protectionsByTab[activeTab] ?? []; const configText = (() => { // Start with server config text at top (General) let text = "\n\n"; for (const tab of tabs) { const tabName = tab.name; const protections = protectionsByTab[tabName]; if (!protections || protections.length === 0) continue; text += `[${tabName}]\n`; protections.forEach(({ key }) => { const setting = settings[key]; const val = setting ? setting.enabled ? setting.action.toLowerCase() : "off" : "off"; text += `${key} = ${val}\n`; }); text += "\n"; } return text.trim(); })(); async function copyConfig() { try { await navigator.clipboard.writeText(configText); setCopied(true); setTimeout(() => setCopied(false), 2000); } catch { alert("Failed to copy to clipboard"); } } function exportConfig() { const blob = new Blob([configText], { type: "text/plain" }); const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = "cyberanticheat-config.txt"; link.click(); URL.revokeObjectURL(url); } return (
{/* Header */}

CyberAnticheat Config Generator

{/* Tabs */} {/* Protections for active tab */}

{activeTab} Protections{" "}

{activeTab === "General" ? ( <>

General Server Settings