Skip to content

DrawCircle

The DrawCircle function draws an outline of a circle in 3D space. This function is useful for visualizing circular areas or regions in the game world.

Parameters

  • x (number): The x-coordinate of the circle's center.
  • y (number): The y-coordinate of the circle's center.
  • z (number): The z-coordinate of the circle's center.
  • r (number): The red color component (0.0 to 1.0).
  • g (number): The green color component (0.0 to 1.0).
  • b (number): The blue color component (0.0 to 1.0).
  • a (number): The alpha (transparency) value (0.0 to 1.0).
  • radius (number): The radius of the circle.

Example Usage in Lua

Here is an example of how to use the DrawCircle function in Lua:

local api = ...

-- Function to draw a red circle with a radius of 5 at the specified coordinates
function DrawRedCircle(x, y, z)
    local r = 1.0
    local g = 0.0
    local b = 0.0
    local a = 1.0
    local radius = 5.0
    api.DrawCircle(x, y, z, r, g, b, a, radius)
    print("Drew a red circle at (" .. x .. ", " .. y .. ", " .. z .. ") with radius " .. radius)
end

-- Example usage: Draw a red circle at player coordinates coordinates 
local x,y,z = api.GetObjectPosition('player')
DrawRedCircle(x,y,z)