Results 1 to 2 of 2

Thread: Tjbot

  1. #1
    Junior Member
    Join Date
    Apr 2015
    Posts
    1

    Tjbot

    Someone got one to share?

  2. #2
    Junior Member
    Join Date
    Feb 2013
    Posts
    9

    Re: Tjbot

    -- IMPORTANT: Load weapon ids etc
    require ( "et_definitions.lua" )

    tjBot = 0
    autojumpBot = 0
    etHook:AddCommand( "+jumpBot" )
    etHook:AddCommand( "-jumpBot" )
    etHook:AddCommand( "+autoJump" )
    etHook:AddCommand( "-autoJump" )


    -- Check if cmd is active or not
    function et_ConsoleCommand()
    cmd = etHook:Argv(0)

    -- Is jumpBot on or off?
    if ( cmd == "+jumpBot" ) then
    tjBot = 1
    return true
    elseif ( cmd == "-jumpBot" ) then
    tjBot = 0
    return true
    end

    -- Is autoJump on or off?
    if ( cmd == "+autoJump" ) then
    autojumpBot = 1
    return true
    elseif ( cmd == "-autoJump" ) then
    autojumpBot = 0
    return true
    end

    return false
    end


    function AngleNormalize360(angle)
    return (360.0 / 65536) * ( bit.band((angle * (65536 / 360.0)), 65535) )
    end

    function AngleNormalize180(angle)
    angle = AngleNormalize360(angle)

    if (angle > 180.0) then
    angle = angle - 360.0
    end

    return angle

    end

    function AngleDelta(angle1, angle2)
    return AngleNormalize180(angle1 - angle2)
    end

    -- Main jumpBot function
    function JumpBot()

    -- Jumpbot ain't on, stop it
    if ( tjBot == 0 ) then
    return
    end

    -- Structs, calcs, etc ...
    local ps = GetPredictedPlayerState()
    local vel_x = ps.velocity.x
    local vel_y = ps.velocity.y
    local view_x = GetMuzzleAngles().y
    local accel_coef = (ps.groundEntityNum ~= 1023) and 10.0 or 1.0
    local vel_size = math.sqrt(vel_x * vel_x + vel_y * vel_y)
    local something = (320 - 320 / 125.0 * accel_coef) / vel_size * 1.1

    if (something > 1) then
    return
    end

    local cmd = GetUserCmd(GetCurrentCmdNumber())
    local per_angle = AngleNormalize180(math.deg(math.acos(something)))
    local vel_angle = math.deg(math.atan2(vel_y, vel_x))
    local accel_angle = math.deg(math.atan2(-cmd.rightmove, cmd.forwardmove))

    -- Main jumpBot function, where we set angle vector
    local yawangleadd

    if (cmd.forwardmove > 0) then -- Fullbeat --
    if (cmd.rightmove > 0) then
    yawangleadd = -AngleDelta(view_x + accel_angle, vel_angle - per_angle) - 0.3;
    elseif (cmd.rightmove < 0) then
    yawangleadd = -AngleDelta(view_x + accel_angle, vel_angle + per_angle) + 0.3;
    end
    elseif (cmd.forwardmove == 0) then -- HalfBeat/Invert --
    if (cmd.rightmove > 0) then
    yawangleadd = -AngleDelta(view_x + accel_angle, vel_angle - per_angle) - 0.3;
    elseif (cmd.rightmove < 0) then
    yawangleadd = -AngleDelta(view_x + accel_angle, vel_angle + per_angle) + 0.3;
    end
    elseif (cmd.forwardmove < 0) then -- Fullbeat Backward --
    if (cmd.rightmove > 0) then
    yawangleadd = -AngleDelta(view_x + accel_angle, vel_angle - per_angle) + 0.3;
    elseif (cmd.rightmove < 0) then
    yawangleadd = -AngleDelta(view_x + accel_angle, vel_angle + per_angle) - 0.3;
    end
    end

    -- Set the view angle (do the jumpBot)
    if ( yawangleadd ) then
    SetViewAngles( vec3(0, yawangleadd, 0) )
    end

    end


    -- Main autoJump function, hb/invert
    function autoJump()

    -- autoJump ain't on, stop it
    if ( autojumpBot == 0 ) then
    return
    end

    -- auto jump if we're not in the air
    if (GetPredictedPlayerState().groundEntityNum ~= 1023) then
    FakeMovement( 3, 3 )
    end
    end


    function et_DrawActiveFrame( serverTime )

    -- Jumpbot & autoJump
    JumpBot()
    autoJump()

    end

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •