Bow yourself

This module will shoot a bow to yourself silently

local ticks = 0
local doBow = false

local bow = {
    on_enable = function()
        for i = 1, 9 do
            local name = player.inventory.item_information(35 + i)
            if name == "item.bow" then
                player.send_packet(0x09, i)
                player.send_packet(0x08, i)
                ticks = 5
                doBow = true
            end
        end
    end,
    on_pre_motion = function(t)
        if doBow then
            t.pitch = -88
            if ticks > 0 then
                ticks = ticks - 1
            else
                player.send_packet(0x07)
                player.send_packet(0x09, player.held_item_slot())
                doBow = false
            end
        end
        return t
    end,
}

module_manager.register('Bow', bow)

player.send_packet(0x09, i) swaps your hand to the bow hotbar slot

player.send_packet(0x08, i) starts using the item in that slot

player.send_packet(0x07) releases the item

player.send_packet(0x09, player.held_item_slot()) switches back to the item you actually have on hand

Last updated