Skip to content
TheChatArchiveThe Chat Archive
gpt-4o-2024-08-06· OpenAIAi2 WildChat-4.8M (AI2)

CHOptionsMenu = { title = "Camhack Options", parent = "OptionsMenu", items = { { label =…

  1. User

    CHOptionsMenu = { title = "Camhack Options", parent = "OptionsMenu", items = { { label = "Camhack " .. (camHack.isFlyModeActive and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.isFlyModeToggleRequested = not camHack.isFlyModeToggleRequested end, description = "Toggle fly mode to move the camera freely." }, { label = "Collision " .. (camHack.isCollisionEnabled and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.isCollisionEnabled = not camHack.isCollisionEnabled end, description = "Toggle camera collision with world objects." }, { label = "Debug Info " .. (camHack.shouldRenderDebugInfo and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.shouldRenderDebugInfo = not camHack.shouldRenderDebugInfo end, description = "Show or hide camera and position info." }, { label = "Solid Obj " .. (camHack.checkSolidObjects and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.checkSolidObjects = not camHack.checkSolidObjects end, description = "Check collisions with solid objects." }, { label = "Vehicles " .. (camHack.checkVehicles and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.checkVehicles = not camHack.checkVehicles end, description = "Check collisions with vehicles." }, { label = "Peds " .. (camHack.checkPeds and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.checkPeds = not camHack.checkPeds end, description = "Check collisions with pedestrians." }, { label = "Objects " .. (camHack.checkObjects and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.checkObjects = not camHack.checkObjects end, description = "Check collisions with objects." }, { label = "Particles " .. (camHack.checkParticles and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.checkParticles = not camHack.checkParticles end, description = "Check collisions with particles." }, { label = "See Through " .. (camHack.seeThroughObjects and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.seeThroughObjects = not camHack.seeThroughObjects end, description = "Enable seeing through objects." }, { label = "Ignore Some " .. (camHack.ignoreSomeObjects and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.ignoreSomeObjects = not camHack.ignoreSomeObjects end, description = "Ignore specific in-game objects." }, { label = "Shoot Thru " .. (camHack.allowShootThrough and "gON" or "rOFF"), action = function() addOneOffSound(0, 0, 0, SOUND_CLICK) camHack.allowShootThrough = not camHack.allowShootThrough end, description = "Allow shooting through objects." }, { label = "", action = function() end, description = "" }, { label = "Back", action = function() currentMenu = "OptionsMenu" focusIndex = 1 addOneOffSound(0, 0, 0, SOUND_BACK) end, description = "Return to the Options Menu." } } }

    отредактируй текст описаний, добавь в него стандартные значения, найти их можешь в этом коде

    script_name("CamHack") script_author("sanek a.k.a Maks_Fender, edited by ANIKI")

    --require "lib.moonloader" local moonAdditions = require "MoonAdditions" local socket = require "socket"

    -- Create a table to encapsulate all variables and functions local ch = { -- Define virtual key codes with descriptive names keyToggleFlyMode = 0x43, -- VK_C (Toggle fly mode) keyEnableFlyMode = 0x31, -- VK_1 (Enable fly mode) keyDisableFlyMode = 0x32, -- VK_2 (Disable fly mode) keyPauseFlyMode = 0x33, -- VK_3 (Pause fly mode) keyToggleCollision = 0x34, -- VK_4 (Toggle camera collision) keyToggleDebugInfo = 0x35, -- VK_5 (Toggle render debug info) keyMoveForward = 0x57, -- VK_W (Move forward) keyMoveBackward = 0x53, -- VK_S (Move backward) keyStrafeLeft = 0x41, -- VK_A (Strafe left) keyStrafeRight = 0x44, -- VK_D (Strafe right) keyMoveUp = 0x20, -- VK_SPACE (Move up) keyMoveDown = 0x10, -- VK_SHIFT (Move down) keyIncreaseSpeed = 0xBB, -- VK_ADD (Increase speed) keyDecreaseSpeed = 0xBD, -- VK_SUBTRACT (Decrease speed)

    -- Define camera control variables
    cameraPositionX = 0,
    cameraPositionY = 0,
    cameraPositionZ = 0,
    cameraAngleZ = 0,
    cameraAngleY = 0,
    cameraSpeed = 1.0,
    isFlyModeActive = false,
    enableWithoutReset = false,
    isFlyModeToggleRequested = false,
    
    isCollisionEnabled = true,
    shouldRenderDebugInfo = true,
    suspendRenderRequested = false,
    
    lastCollisionToggleTime = 0,
    lastDebugInfoToggleTime = 0,
    toggleTimeout = 0.25       ,
    
    checkSolidObjects = true,
    checkVehicles = false,
    checkPeds = false,
    checkObjects = true,
    checkParticles = false,
    seeThroughObjects = false,
    ignoreSomeObjects = false,
    allowShootThrough = false
    

    }

    function ch.enableFlyMode() displayRadar(false) displayHud(false) if not ch.enableWithoutReset then ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ = getCharCoordinates(playerPed) ch.cameraAngleZ = -getCharHeading(playerPed) ch.cameraAngleY = 0.0 setFixedCameraPosition(ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ, 0.0, 0.0, 0.0) else ch.enableWithoutReset = false end lockPlayerControl(true) ch.isFlyModeActive = true end

    function ch.disableFlyMode() lockPlayerControl(false) restoreCameraJumpcut() setCameraBehindPlayer() displayRadar(true) displayHud(true) ch.isFlyModeActive = false end

    function ch.checkKeyState() local currentTime = socket.gettime()

    if isKeyDown(ch.keyToggleFlyMode) then
        if isKeyDown(ch.keyEnableFlyMode) then
            ch.isFlyModeToggleRequested = true
        elseif isKeyDown(ch.keyDisableFlyMode) then
            ch.isFlyModeToggleRequested = false
        elseif isKeyDown(ch.keyPauseFlyMode) and ch.isFlyModeActive then
            ch.enableWithoutReset = true
            ch.isFlyModeToggleRequested = false
        elseif isKeyDown(ch.keyToggleCollision) and ch.isFlyModeActive then
            if currentTime - ch.lastCollisionToggleTime > ch.toggleTimeout then
                ch.isCollisionEnabled = not ch.isCollisionEnabled
                ch.lastCollisionToggleTime = currentTime
            end
        elseif isKeyDown(ch.keyToggleDebugInfo) and ch.isFlyModeActive then
            if currentTime - ch.lastDebugInfoToggleTime > ch.toggleTimeout then
                ch.shouldRenderDebugInfo = not ch.shouldRenderDebugInfo
                ch.lastDebugInfoToggleTime = currentTime
            end
    	end
    	
    	print('isKeyDown(ch.keyToggleDebugInfo)', isKeyDown(ch.keyToggleDebugInfo))
    	print('ch.shouldRenderDebugInfo', ch.shouldRenderDebugInfo)
    end
    

    end

    function ch.processCamHack() ch.checkKeyState()

    if ch.isFlyModeToggleRequested and not ch.isFlyModeActive then
        ch.enableFlyMode()
    elseif not ch.isFlyModeToggleRequested and ch.isFlyModeActive then
        ch.disableFlyMode()
    end
    
    if ch.isFlyModeActive then
        if not sampIsChatInputActive() and not isSampfuncsConsoleActive() then
            local mouseOffsetX, mouseOffsetY = getPcMouseMovement()
            ch.cameraAngleZ = (ch.cameraAngleZ + mouseOffsetX / 4.0) % 360
            ch.cameraAngleY = math.max(math.min(ch.cameraAngleY + mouseOffsetY / 4.0, 89.0), -89.0)
    
            local radZ, radY = math.rad(ch.cameraAngleZ), math.rad(ch.cameraAngleY)
            local sinZ, cosZ, sinY, cosY = math.sin(radZ), math.cos(radZ), math.sin(radY), math.cos(radY)
            local movementX, movementY, movementZ = cosY * sinZ, cosY * cosZ, sinY
            local newPositionX, newPositionY, newPositionZ = ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ
    
            if isKeyDown(ch.keyMoveForward) then
                newPositionX = ch.cameraPositionX + movementX * ch.cameraSpeed
                newPositionY = ch.cameraPositionY + movementY * ch.cameraSpeed
                newPositionZ = ch.cameraPositionZ + movementZ * ch.cameraSpeed
            elseif isKeyDown(ch.keyMoveBackward) then
                newPositionX = ch.cameraPositionX - movementX * ch.cameraSpeed
                newPositionY = ch.cameraPositionY - movementY * ch.cameraSpeed
                newPositionZ = ch.cameraPositionZ - movementZ * ch.cameraSpeed
            end
    
            if isKeyDown(ch.keyStrafeLeft) or isKeyDown(ch.keyStrafeRight) then
                local sideMoveAngle = isKeyDown(ch.keyStrafeLeft) and -math.pi / 2 or math.pi / 2
                local sideZ = math.sin(math.rad(ch.cameraAngleZ) + sideMoveAngle)
                local sideX = math.cos(math.rad(ch.cameraAngleZ) + sideMoveAngle)
                newPositionX = newPositionX + sideZ * ch.cameraSpeed
                newPositionY = newPositionY + sideX * ch.cameraSpeed
            end
    
            if isKeyDown(ch.keyMoveUp) then
                newPositionZ = ch.cameraPositionZ + ch.cameraSpeed
            elseif isKeyDown(ch.keyMoveDown) then
                newPositionZ = ch.cameraPositionZ - ch.cameraSpeed
            end
    
            local hasCollision, collisionPoint, adjustedX, adjustedY, adjustedZ
            if ch.isCollisionEnabled then
                local result
                result, collisionPoint = processLineOfSight(
                    ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ, newPositionX, newPositionY, newPositionZ,
                    ch.checkSolidObjects, ch.checkVehicles, ch.checkPeds,
                    ch.checkObjects, ch.checkParticles, ch.seeThroughObjects,
                    ch.ignoreSomeObjects, ch.allowShootThrough
                )
                if result then
                    hasCollision, adjustedX, adjustedY, adjustedZ = true, ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ
                else
                    hasCollision, adjustedX, adjustedY, adjustedZ = false, newPositionX, newPositionY, newPositionZ
                end
            else
                hasCollision, adjustedX, adjustedY, adjustedZ = false, newPositionX, newPositionY, newPositionZ
            end
    
            ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ = adjustedX, adjustedY, adjustedZ
            setFixedCameraPosition(ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ, 0.0, 0.0, 0.0)
            pointCameraAtPoint(ch.cameraPositionX + movementX, ch.cameraPositionY + movementY, ch.cameraPositionZ + movementZ, 2)
    
            if isKeyDown(ch.keyIncreaseSpeed) then
                ch.cameraSpeed = ch.cameraSpeed + 0.01
            elseif isKeyDown(ch.keyDecreaseSpeed) then
                ch.cameraSpeed = math.max(ch.cameraSpeed - 0.01, 0.01)
            end
    
            if ch.shouldRenderDebugInfo and not ch.suspendRenderRequested then
                local collisionText
                if hasCollision then
                    collisionText = string.format(
                        "~ghhh~Collision Detected~n~" ..
                        "~w~Entity: ~ph~%d~n~" ..
                        "~w~Type: ~ph~%d~ph~ ~w~Surface: ~ph~%d~n~" ..
                        "~w~Position: ~ph~(%.2f, %.2f, %.2f)~n~" ..
                        "~w~Normal: ~ph~(%.2f, %.2f, %.2f)",
                        collisionPoint.entity, collisionPoint.entityType, collisionPoint.surfaceType[1],
                        collisionPoint.pos[1], collisionPoint.pos[2], collisionPoint.pos[3],
                        collisionPoint.normal[1], collisionPoint.normal[2], collisionPoint.normal[3]
                    )
                else
                    collisionText = "~rhhh~No Collision"
                end
    
                if not ch.isCollisionEnabled then
                    collisionText = "~yh~Collision Disabled"
                end
    
                local debugText = string.format(
                    "~bhhh~CamHack Debug Info~n~" ..
                    "~w~Position:~n~" ..
                    " ~ph~(%.2f, %.2f, %.2f)~n~" ..
                    "~w~Direction:~n~" ..
                    " ~ph~(%.2f, %.2f, %.2f)~n~" ..
                    "~w~Angle:~n~" ..
                    " ~ph~Z: %.2f| ~ph~Y: %.2f|~n~" ..
                    "~w~Speed:~n~" ..
                    " ~p~~h~%.2f units/sec~n~" ..
                    "~w~Collision Status:~n~" ..
                    " %s",
                    ch.cameraPositionX, ch.cameraPositionY, ch.cameraPositionZ,
                    ch.cameraPositionX + movementX, ch.cameraPositionY + movementY, ch.cameraPositionZ + movementZ,
                    ch.cameraAngleZ, ch.cameraAngleY, ch.cameraSpeed,
                    collisionText
                )
    
                moonAdditions.draw_text(debugText, 45, 240, moonAdditions.font_style.BEFORE_TEXT, 0.40, 1.0, moonAdditions.font_align.LEFT, 9999, true, false, 255, 255, 255, 255, 1, 2, 0, 0, 0, 150)
            end
        end
    end
    

    end

    return ch

  2. Assistant

    Here's the updated text descriptions for the options in CHOptionsMenu with the included default settings from the provided code:

    CHOptionsMenu = {
        title = "Camhack Options",
        parent = "OptionsMenu",
        items = {
            {
                label = "Camhack       " .. (camHack.isFlyModeActive and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.isFlyModeToggleRequested = not camHack.isFlyModeToggleRequested
                end,
                description = "Toggle fly mode to move the camera freely. Default: OFF (isFlyModeActive = false)."
            },
            {
                label = "Collision        " .. (camHack.isCollisionEnabled and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.isCollisionEnabled = not camHack.isCollisionEnabled
                end,
                description = "Toggle camera collision with world objects. Default: ON (isCollisionEnabled = true)."
            },
            {
                label = "Debug Info    " .. (camHack.shouldRenderDebugInfo and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.shouldRenderDebugInfo = not camHack.shouldRenderDebugInfo
                end,
                description = "Show or hide camera and position info. Default: ON (shouldRenderDebugInfo = true)."
            },
            {
                label = "Solid Obj       " .. (camHack.checkSolidObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkSolidObjects = not camHack.checkSolidObjects
                end,
                description = "Check collisions with solid objects. Default: ON (checkSolidObjects = true)."
            },
            {
                label = "Vehicles        " .. (camHack.checkVehicles and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkVehicles = not camHack.checkVehicles
                end,
                description = "Check collisions with vehicles. Default: OFF (checkVehicles = false)."
            },
            {
                label = "Peds              " .. (camHack.checkPeds and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkPeds = not camHack.checkPeds
                end,
                description = "Check collisions with pedestrians. Default: OFF (checkPeds = false)."
            },
            {
                label = "Objects         " .. (camHack.checkObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkObjects = not camHack.checkObjects
                end,
                description = "Check collisions with objects. Default: ON (checkObjects = true)."
            },
            {
                label = "Particles       " .. (camHack.checkParticles and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkParticles = not camHack.checkParticles
                end,
                description = "Check collisions with particles. Default: OFF (checkParticles = false)."
            },
            {
                label = "See Through " .. (camHack.seeThroughObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.seeThroughObjects = not camHack.seeThroughObjects
                end,
                description = "Enable seeing through objects. Default: OFF (seeThroughObjects = false)."
            },
            {
                label = "Ignore Some " .. (camHack.ignoreSomeObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.ignoreSomeObjects = not camHack.ignoreSomeObjects
                end,
                description = "Ignore specific in-game objects. Default: OFF (ignoreSomeObjects = false)."
            },
            {
                label = "Shoot Thru   " .. (camHack.allowShootThrough and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.allowShootThrough = not camHack.allowShootThrough
                end,
                description = "Allow shooting through objects. Default: OFF (allowShootThrough = false)."
            },
            {
                label = "",
                action = function()
                end,
                description = ""
            },
            {
                label = "Back",
                action = function()
                    currentMenu = "OptionsMenu"
                    focusIndex = 1
                    addOneOffSound(0, 0, 0, SOUND_BACK)
                end,
                description = "Return to the Options Menu."
            }
        }
    }
    

    These descriptions now reflect the default values from the code you provided.

  3. User

    добавь перенос строки n перед указанием состоянием стандартного значения, убери куски кода(имена переменных)

  4. Assistant

    Certainly! Here's the updated description text with line breaks added before the mention of the default state, and the inline code references removed:

    CHOptionsMenu = {
        title = "Camhack Options",
        parent = "OptionsMenu",
        items = {
            {
                label = "Camhack       " .. (camHack.isFlyModeActive and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.isFlyModeToggleRequested = not camHack.isFlyModeToggleRequested
                end,
                description = "Toggle fly mode to move the camera freely.~n~Default: OFF."
            },
            {
                label = "Collision        " .. (camHack.isCollisionEnabled and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.isCollisionEnabled = not camHack.isCollisionEnabled
                end,
                description = "Toggle camera collision with world objects.~n~Default: ON."
            },
            {
                label = "Debug Info    " .. (camHack.shouldRenderDebugInfo and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.shouldRenderDebugInfo = not camHack.shouldRenderDebugInfo
                end,
                description = "Show or hide camera and position info.~n~Default: ON."
            },
            {
                label = "Solid Obj       " .. (camHack.checkSolidObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkSolidObjects = not camHack.checkSolidObjects
                end,
                description = "Check collisions with solid objects.~n~Default: ON."
            },
            {
                label = "Vehicles        " .. (camHack.checkVehicles and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkVehicles = not camHack.checkVehicles
                end,
                description = "Check collisions with vehicles.~n~Default: OFF."
            },
            {
                label = "Peds              " .. (camHack.checkPeds and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkPeds = not camHack.checkPeds
                end,
                description = "Check collisions with pedestrians.~n~Default: OFF."
            },
            {
                label = "Objects         " .. (camHack.checkObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkObjects = not camHack.checkObjects
                end,
                description = "Check collisions with objects.~n~Default: ON."
            },
            {
                label = "Particles       " .. (camHack.checkParticles and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.checkParticles = not camHack.checkParticles
                end,
                description = "Check collisions with particles.~n~Default: OFF."
            },
            {
                label = "See Through " .. (camHack.seeThroughObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.seeThroughObjects = not camHack.seeThroughObjects
                end,
                description = "Enable seeing through objects.~n~Default: OFF."
            },
            {
                label = "Ignore Some " .. (camHack.ignoreSomeObjects and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.ignoreSomeObjects = not camHack.ignoreSomeObjects
                end,
                description = "Ignore specific in-game objects.~n~Default: OFF."
            },
            {
                label = "Shoot Thru   " .. (camHack.allowShootThrough and "~g~ON" or "~r~OFF"),
                action = function()
                    addOneOffSound(0, 0, 0, SOUND_CLICK)
                    camHack.allowShootThrough = not camHack.allowShootThrough
                end,
                description = "Allow shooting through objects.~n~Default: OFF."
            },
            {
                label = "",
                action = function()
                end,
                description = ""
            },
            {
                label = "Back",
                action = function()
                    currentMenu = "OptionsMenu"
                    focusIndex = 1
                    addOneOffSound(0, 0, 0, SOUND_BACK)
                end,
                description = "Return to the Options Menu."
            }
        }
    }
    

    The descriptions now include a line break before the default value, and references to variable names in the code have been removed for clarity.