Skip to main content

Camera State

is_camera_active

Checks if the camera is currently active (holding, viewing, or photo mode).
---@return boolean is_active
local is_active = exports["no-camera"]:is_camera_active()

get_camera_state

Gets the current camera state.
---@enum CAMERA_STATE
CAMERA_STATE = {
    DEACTIVE = 0,
    HOLDING = 1,
    VIEWING = 2,
    PHOTO_MODE = 3
}

---@return CAMERA_STATE state
local state = exports["no-camera"]:get_camera_state()

is_photo_mode

Checks if the player is currently in photo mode (viewfinder active).
---@return boolean is_photo_mode
local is_photo_mode = exports["no-camera"]:is_photo_mode()

is_viewing_mode

Checks if the player is currently viewing the camera menu.
---@return boolean is_viewing
local is_viewing = exports["no-camera"]:is_viewing_mode()

is_taking_photo

Checks if a photo is currently being taken.
---@return boolean is_taking_photo
local is_taking = exports["no-camera"]:is_taking_photo()

Camera Control

activate_camera

Activates the camera (enters holding state).
exports["no-camera"]:activate_camera()

deactivate_camera

Deactivates the camera completely.
exports["no-camera"]:deactivate_camera()

toggle_camera

Toggles the camera on/off.
---@return boolean is_active Returns true if camera is now active
local is_active = exports["no-camera"]:toggle_camera()

enter_photo_mode

Enters photo mode (viewfinder).
---@return boolean success
---@return string? error Error message if failed
local success, error = exports["no-camera"]:enter_photo_mode()

exit_photo_mode

Exits photo mode (returns to holding state).
exports["no-camera"]:exit_photo_mode()

toggle_photo_mode

Toggles photo mode on/off.
---@return boolean is_photo_mode
local is_photo_mode = exports["no-camera"]:toggle_photo_mode()

enter_viewing_mode

Enters viewing mode (camera menu).
exports["no-camera"]:enter_viewing_mode()

exit_viewing_mode

Exits viewing mode (returns to holding state).
exports["no-camera"]:exit_viewing_mode()

toggle_viewing_mode

Toggles viewing mode on/off.
exports["no-camera"]:toggle_viewing_mode()

take_photo

Takes a photo (must be in photo mode).
---@return boolean success
---@return string? error Error message if failed
local success, error = exports["no-camera"]:take_photo()

Camera Settings

get_camera_settings

Gets all current camera settings.
---@class CameraSettingsData
---@field iso number
---@field shutter_speed string
---@field aperture number
---@field zoom_level number
---@field flash_mode string

---@return CameraSettingsData settings
local settings = exports["no-camera"]:get_camera_settings()

set_iso

Sets the camera ISO value.
---@param value number ISO value (100, 200, 400, 800, 1600, 3200, 6400)
---@return boolean success
local success = exports["no-camera"]:set_iso(400)

set_shutter_speed

Sets the camera shutter speed.
---@param value string Shutter speed ("1/4000", "1/2000", "1/1000", "1/500", "1/250", "1/125", "1/60", "1/30", "1/15", "1/8", "1/4", "1/2", "1")
---@return boolean success
local success = exports["no-camera"]:set_shutter_speed("1/250")

set_aperture

Sets the camera aperture.
---@param value number Aperture value (1.4, 2, 2.8, 4, 5.6, 8, 11, 16, 22)
---@return boolean success
local success = exports["no-camera"]:set_aperture(2.8)

set_zoom

Sets the camera zoom level.
---@param value number Zoom level (1, 1.5, 2, 3, 5, 10)
---@return boolean success
local success = exports["no-camera"]:set_zoom(2)

set_flash_mode

Sets the camera flash mode.
---@param value string Flash mode ("auto", "on", "off")
---@return boolean success
local success = exports["no-camera"]:set_flash_mode("auto")

update_camera_settings

Updates multiple camera settings at once.
---@param settings table Settings to update (iso, shutter_speed, aperture, zoom_level, flash_mode)
---@return table result { success = table, settings = table }
local result = exports["no-camera"]:update_camera_settings({
    iso = 800,
    aperture = 4,
    flash_mode = "on"
})

reset_camera_settings

Resets all camera settings to defaults.
exports["no-camera"]:reset_camera_settings()

Photo Display

show_photo

Shows a photo in the player’s hand.
---@param image string URL of the photo
---@param location string? Optional location string
---@param timestamp number? Optional timestamp
exports["no-camera"]:show_photo("https://example.com/photo.jpg", "Vinewood Hills", 1738656000000)

close_photo

Closes the currently displayed photo.
exports["no-camera"]:close_photo()

is_photo_active

Checks if a photo is currently being displayed.
---@return boolean is_active
local is_active = exports["no-camera"]:is_photo_active()

focus_photo

Focuses the current photo in fullscreen NUI view.
exports["no-camera"]:focus_photo()

unfocus_photo

Unfocuses the current photo from fullscreen view.
exports["no-camera"]:unfocus_photo()

is_photo_focused

Checks if the photo is currently focused in fullscreen.
---@return boolean is_focused
local is_focused = exports["no-camera"]:is_photo_focused()

get_current_photo

Gets the current photo data.
---@class PhotoData
---@field image string URL of the photo
---@field location? string Location where the photo was taken
---@field timestamp? number Unix timestamp when the photo was taken

---@return PhotoData? photo The current photo data or nil if none
local photo = exports["no-camera"]:get_current_photo()