Skip to content

GetLastClickPosition

The GetLastClickPosition function retrieves the world coordinates (X, Y, Z) of the last position clicked by the player. This function is useful for determining the exact location in the game world where the player last interacted with the environment via a mouse click.

Parameters

This function does not take any parameters.

Returns

  • x: The X coordinate of the last clicked position.
  • y: The Y coordinate of the last clicked position.
  • z: The Z coordinate of the last clicked position.

Example Usage in Lua

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

local api = ...

-- Function to print the last clicked position by the player
function PrintLastClickPosition()
    local x, y, z = api.GetLastClickPosition()
    if x and y and z then
        print("Last clicked position: X=" .. x .. ", Y=" .. y .. ", Z=" .. z)
    else
        print("No click position available.")
    end
end

-- Call the function
PrintLastClickPosition()