-- CHENMENUS · SHELL EDITION local dui, isOpen, rainbowSent, Render = nil, false, nil, nil local welcomeShown = false local BANNER_URL = "" local AVATAR_URL = "" local AUTHOR_NAME = "Chen" local VERSION_TAG = "V2.0" -- 1. 基础工具函数 local function Safe(fn, ...) if type(fn) ~= "function" then return nil end local ok, a, b, c = pcall(fn, ...) if not ok then return nil end return a, b, c end local function ValidEntity(e) return e ~= nil and type(e) == "number" and e ~= 0 and DoesEntityExist(e) end local function ValidVehicle(v) return ValidEntity(v) end local function Clamp(v, mn, mx) if v < mn then return mn end if v > mx then return mx end return v end local function SafeWait(ms) Citizen.Wait(ms or 0) end local function LoadModelSafe(model) if type(model) ~= "number" then return false end RequestModel(model) local t = 0 while not HasModelLoaded(model) and t < 200 do Wait(10); t = t + 1 end return HasModelLoaded(model) end -- 2. 全局状态表 local features = { -- 自我 godmode = false, invisible = false, stamina = false, fastrun = false, superjump = false, noragdoll = false, nocriticals = false, infoxygen = false, nightvision = false, thermal = false, armorlock = false, nofalldmg = false, fireproof = false, expproof = false, dmgreduce = false, -- 武器 infammo = false, infclip = false, rapidfire = false, norecoil = false, onehitkill = false, explosive = false, teleportbullet = false, firebullet = false, -- 载具 vehgod = false, vehinvisible = false, vehrepair = false, vehboost = false, underwater = false, vehbounce = false, rocketveh = false, vehnoclip = false, -- 视觉 / ESP esp = false, espid = false, espname = false, espdist = false, espskeleton = false, espbox = false, playerblips = false, alwaysbright = false, norain = false, noclouds = false, snowweather = false, -- 菜单外观 rainbowmenu = false, chenbg = true, floatmenu = true, -- 瞄准 aimbot = false, aimhead = true, aimchest = false, showfov = false, aimwallbang = false, aimnospread = false, aimfast = false, -- 其他 ghostmodel = false, spectating = false, freecam = false, tx_noclip = false, -- 数值 fovsize = 140, aimdist = 300, } local bypass = { screenshot = false, log = false, anticheat = false, blip = false, fiveguard = false, electronac = false, obfuscate = false, } -- 3. 导航 / 菜单状态 local nav = { page = "main", cat = 1, tab = 1, pos = 1, players = {}, selectedPlayer = nil, playerReturnPos = 1, currentItems = {}, } local selectorState = { weaponsAll = 1 } local GhostPed, NPCPed = { ped = nil }, { ped = nil } local SaveLoc = nil local ManualScan = { inputActive = false, targetResource = nil, triggers = {}, scanLog = {}, lastInput = "" } -- 4. 通知 / 日志 / 输入 function ShowNotification(text) Safe(function() if MachoMenuNotification then MachoMenuNotification("Chen Menus", text) else print("[CHENMENUS] " .. text) end end) if dui and dui ~= 0 and isOpen then Safe(function() MachoSendDuiMessage(dui, json.encode({ type = "notify", text = text })) end) end end function TraceLine(msg) Safe(function() print("[CHENMENUS] " .. tostring(msg)) end) end local _inputEntryAdded = false function PromptTextInput(title, default, callback) if ManualScan.inputActive then return end ManualScan.inputActive = true pcall(function() if not _inputEntryAdded then AddTextEntry("CHEN_INPUT_LABEL", "Input") _inputEntryAdded = true end AddTextEntry("CHEN_INPUT_LABEL", title or "Input") end) DisplayOnscreenKeyboard(1, "CHEN_INPUT_LABEL", "", default or "", "", "", "", 200) CreateThread(function() local ticks = 0 while ticks < 1800 do Wait(0); ticks = ticks + 1 local status = UpdateOnscreenKeyboard() if status == 1 then local result = GetOnscreenKeyboardResult() or "" ManualScan.inputActive = false if callback then Safe(callback, result) end break elseif status == 2 or status == 3 then ManualScan.inputActive = false if callback then Safe(callback, nil) end break end end ManualScan.inputActive = false end) end -- 5. 玩家缓存 local PlayerCache = { list = {}, time = 0 } function GetPlayers() local list, seen = {}, {} local ok, actives = pcall(GetActivePlayers) if ok and actives then for _, p in ipairs(actives) do if not seen[p] then seen[p] = true; list[#list + 1] = p end end end for i = 0, 255 do if not seen[i] and NetworkIsPlayerActive(i) then seen[i] = true; list[#list + 1] = i end end return list end function GetCachedPlayers() local now = GetGameTimer() if now - PlayerCache.time > 1000 then PlayerCache.list = GetPlayers() PlayerCache.time = now end return PlayerCache.list end function RefreshPlayerList() local list, me = {}, PlayerId() local myPed = PlayerPedId() if not ValidEntity(myPed) then nav.players = list; return end local myCoords = GetEntityCoords(myPed) local seen = {} local ok, actives = pcall(GetActivePlayers) if ok and actives then for _, p in ipairs(actives) do seen[p] = true end end for i = 0, 255 do if NetworkIsPlayerActive(i) then seen[i] = true end end for p in pairs(seen) do if p ~= me then local ped = GetPlayerPed(p) if ValidEntity(ped) then local c = GetEntityCoords(ped) local dist = #(myCoords - c) local hp = Clamp(GetEntityHealth(ped) - 100, 0, 100) list[#list + 1] = { id = p, sid = GetPlayerServerId(p), name = GetPlayerName(p) or "Unknown", dist = dist, hp = hp, coords = c, } end end end table.sort(list, function(a, b) return a.dist < b.dist end) nav.players = list if nav.pos > #list then nav.pos = math.max(1, #list) end if nav.pos < 1 then nav.pos = 1 end end function GetClosestPlayer() local closest, best = nil, 999999 local myPed = PlayerPedId() if not ValidEntity(myPed) then return nil end local my = GetEntityCoords(myPed) for _, p in ipairs(GetCachedPlayers()) do if p ~= PlayerId() then local ped = GetPlayerPed(p) if ValidEntity(ped) then local d = #(my - GetEntityCoords(ped)) if d < best then best = d; closest = p end end end end return closest end function RotationToDirection(r) local rz, rx = math.rad(r.z), math.rad(r.x) return vector3( -math.sin(rz) * math.abs(math.cos(rx)), math.cos(rz) * math.abs(math.cos(rx)), math.sin(rx) ) end -- 6. 资源缓存 local _resCache, _lookupCache = { list = {}, time = 0 }, { map = {}, time = 0 } function GetResourceNames() local now = GetGameTimer() if now - _resCache.time < 5000 and #_resCache.list > 0 then return _resCache.list end local list = {} local n = Safe(GetNumResources) or 0 for i = 0, n - 1 do local r = Safe(GetResourceByFindIndex, i) if r and r ~= "" then list[#list + 1] = r end end _resCache.list = list _resCache.time = now return list end function BuildResourceLookup() local now = GetGameTimer() if now - _lookupCache.time < 5000 and next(_lookupCache.map) then return _lookupCache.map end local lookup = {} for _, r in ipairs(GetResourceNames()) do lookup[string.lower(r)] = r end _lookupCache.map = lookup _lookupCache.time = now return lookup end -- 7. 菜单开关 function OpenMenu() if isOpen then return end isOpen = true nav.page = "main" nav.pos = 1 -- TODO: 创建 DUI / 显示界面 -- dui = Safe(MachoCreateDui, BANNER_URL, 1280, 720) -- Safe(MachoShowDui, dui) if not welcomeShown then welcomeShown = true ShowNotification(("欢迎使用 %s %s"):format(AUTHOR_NAME, VERSION_TAG)) end end function CloseMenu() if not isOpen then return end isOpen = false -- TODO: 隐藏 / 销毁 DUI -- if dui and dui ~= 0 then Safe(MachoHideDui, dui) end end function ToggleMenu() if isOpen then CloseMenu() else OpenMenu() end end -- 8. 菜单渲染主循环 CreateThread(function() while true do local sleep = 500 if isOpen and dui and dui ~= 0 then sleep = 0 Safe(function() if Render then Render() end -- TODO: 读取输入 / 更新 nav / 推送 DUI 数据 end) end Wait(sleep) end end) -- 9. 功能接口占位 -- 每个功能只留一个空函数,方便后续逐个填充。 -- 自我 function ToggleGodmode() features.godmode = not features.godmode end function ToggleInvisible() features.invisible = not features.invisible end function ToggleFastRun() features.fastrun = not features.fastrun end function ToggleSuperJump() features.superjump = not features.superjump end function ToggleNoRagdoll() features.noragdoll = not features.noragdoll end -- 武器 function ToggleInfAmmo() features.infammo = not features.infammo end function ToggleInfClip() features.infclip = not features.infclip end function ToggleRapidFire() features.rapidfire = not features.rapidfire end function ToggleNoRecoil() features.norecoil = not features.norecoil end function ToggleOneHitKill() features.onehitkill = not features.onehitkill end -- 载具 function ToggleVehGod() features.vehgod = not features.vehgod end function ToggleVehRepair() features.vehrepair = not features.vehrepair end function ToggleVehBoost() features.vehboost = not features.vehboost end function ToggleVehNoClip() features.vehnoclip = not features.vehnoclip end -- 视觉 / ESP function ToggleESP() features.esp = not features.esp end function ToggleESPBox() features.espbox = not features.espbox end function ToggleESPSkeleton() features.espskeleton = not features.espskeleton end function TogglePlayerBlips() features.playerblips = not features.playerblips end -- 瞄准 function ToggleAimbot() features.aimbot = not features.aimbot end function ToggleAimHead() features.aimhead = true; features.aimchest = false end function ToggleAimChest() features.aimchest = true; features.aimhead = false end -- 其他 function ToggleNoClip() features.tx_noclip = not features.tx_noclip end function ToggleFreecam() features.freecam = not features.freecam end function ToggleSpectate() features.spectating = not features.spectating end -- 绕过类(仅状态位,不做实现) function ToggleBypassScreenshot() bypass.screenshot = not bypass.screenshot end function ToggleBypassLog() bypass.log = not bypass.log end function ToggleBypassAnticheat() bypass.anticheat = not bypass.anticheat end function ToggleBypassBlip() bypass.blip = not bypass.blip end function ToggleBypassFiveGuard() bypass.fiveguard = not bypass.fiveguard end function ToggleBypassElectronAC() bypass.electronac = not bypass.electronac end function ToggleObfuscateEvents() bypass.obfuscate = not bypass.obfuscate end -- 框架 / 资源扫描 function DetectFramework() return "any" end function DetectAntiCheat() return {} end function IdentifyServerAC() return { name = "None" } end function ScanAntiCheat() ShowNotification("TODO: ScanAntiCheat") end function ScanTriggersFromAllFiles() ShowNotification("TODO: Trigger Scan") end function ScanServerItems() return {} end function ScanServerWeapons() return {} end function ScanServerVehicles() return {} end function ScanTargetResource(res) ShowNotification("TODO: Scan " .. tostring(res)) end -- 停止 / 恢复类 function StopAntiCheat() ShowNotification("TODO: StopAntiCheat") end function RestoreAntiCheat() ShowNotification("TODO: RestoreAntiCheat") end function ACStopStatus() ShowNotification("TODO: ACStopStatus") end function TrollAntiCheat() ShowNotification("TODO: TrollAntiCheat") end function StopTrollAntiCheat() ShowNotification("TODO: StopTrollAC") end function ACTrollStatus() ShowNotification("TODO: ACTrollStatus") end function TrollFiveGuard() ShowNotification("TODO: TrollFiveGuard") end function StopTrollFiveGuard() ShowNotification("TODO: StopTrollFG") end function FGTrollStatus() ShowNotification("TODO: FGTrollStatus") end -- 10. 指令 / 快捷键 RegisterCommand("chenmenu", function() ToggleMenu() end, false) RegisterKeyMapping("chenmenu", "打开 Chen 菜单", "keyboard", "F5") AddEventHandler("onResourceStop", function(res) if res == GetCurrentResourceName() then CloseMenu() end end) exports("OpenMenu", OpenMenu) exports("CloseMenu", CloseMenu) exports("ToggleMenu", ToggleMenu) exports("GetFeatures", function() return features end) exports("GetBypass", function() return bypass end) exports("GetNav", function() return nav end)