Skip to content

Plugin Examples

Here is a minimal plugin example to help you get started quickly.

Basic Structure

A standard plugin usually consists of the following files:

  • header.lua: Defines plugin metadata (ID, name, load conditions).
  • menu.lua: Defines the plugin's menu options.
  • main.lua: The entry point containing the main logic.

Create a new folder in directory hanbot - league of legends - developer - YOUR_NAME, for exmaple Simple Range Draw

Create these files in this new folder

Example: Simple Range Draw

This simple plugin draws a circle representing the attack range around your hero.

1. header.lua

Defines the basic information of the plugin.

lua
return {
  id = 'simple_range_draw',
  name = 'Simple Range Draw',
  load = function()
    return true -- Always load
  end,
}

2. menu.lua

Creates a simple menu allowing the user to toggle the drawing.

lua
local menu = menu('simple_range_draw', 'Range Draw')

menu:header('settings', 'Settings')
menu:boolean('draw_range', 'Draw Attack Range', true)
menu:color('range_color', 'Color', 255, 255, 255, 255)

return menu

3. main.lua

Loads the menu and registers the drawing callback.

lua
-- Load the menu.lua module
local menu = module.load('simple_range_draw', 'menu')

-- Register the draw callback
cb.add(cb.draw, function()
  -- Check if the menu option is enabled
  if menu.draw_range:get() then
    -- Get the current attack range
    local range = player.attackRange + player.boundingRadius
    
    -- Get the color from the menu
    local color = menu.range_color:get()
    
    -- Draw the circle
    graphics.draw_circle(player.pos, range, 2, color, 100)
  end
end)

print('Simple Range Draw loaded!')

Next Steps

You can try modifying main.lua to add more features, such as:

  • Checking key presses to change colors.
  • Calculating spell ranges.
  • Integrating with the orbwalker module.