Skip to main content

no-camera:camera:state_changed

Triggered when the camera state changes.
---@enum CAMERA_STATE
CAMERA_STATE = {
    DEACTIVE = 0, -- Camera is inactive
    HOLDING = 1, -- Camera is being held
    VIEWING = 2, -- Viewing through the camera
    PHOTO_MODE = 3 -- In photo mode
}

---@param new_state CAMERA_STATE - The new camera state
---@param old_state CAMERA_STATE - The previous camera state
AddEventHandler("no-camera:camera:state_changed", function(new_state, old_state)
  print(("Camera state changed from %s to %s"):format(old_state, new_state))
end)

no-camera:camera:activated

Triggered when the camera is activated.
AddEventHandler("no-camera:camera:activated", function()
  print("Camera activated")
end)

no-camera:camera:deactivated

Triggered when the camera is deactivated.
AddEventHandler("no-camera:camera:deactivated", function()
  print("Camera deactivated")
end)

no-camera:camera:taking_photo

Triggered when the camera is taking a photo.
---@class CameraSettings
---@field iso number
---@field iso_idx number
---@field shutter_speed string
---@field shutter_speed_idx number
---@field aperture number
---@field aperture_idx number
---@field zoom_level number
---@field zoom_idx number
---@field flash_mode string
---@field flash_mode_idx number

---@param settings CameraSettings - The current camera settings
AddEventHandler("no-camera:camera:taking_photo", function(settings)
  print("Taking photo with current settings")
end)

no-camera:camera:photo_complete

Triggered when the photo capture is complete.
---@param success boolean - Whether the photo capture was successful
AddEventHandler("no-camera:camera:photo_complete", function(success)
  print(("Photo capture %s"):format(success and "succeeded" or "failed"))
end)

no-camera:photo_mode:activated

Triggered when photo mode is activated.
AddEventHandler("no-camera:photo_mode:activated", function()
  print("Photo mode activated")
end)

no-camera:photo_mode:deactivated

Triggered when photo mode is deactivated.
AddEventHandler("no-camera:photo_mode:deactivated", function()
  print("Photo mode deactivated")
end)

no-camera:settings:changed

Triggered when a camera setting is changed.
---@class CameraSettings
---@field iso number
---@field iso_idx number
---@field shutter_speed string
---@field shutter_speed_idx number
---@field aperture number
---@field aperture_idx number
---@field zoom_level number
---@field zoom_idx number
---@field flash_mode string
---@field flash_mode_idx number

---@param setting string - The setting that was changed
---@param value any - The new value of the setting
AddEventHandler("no-camera:settings:changed", function(setting, value)
  print(("Setting %s changed to %s"):format(setting, tostring(value)))
end)

no-camera:settings:reset

Triggered when camera settings are reset to defaults.
AddEventHandler("no-camera:settings:reset", function()
  print("Camera settings reset to defaults")
end)

no-camera:nui:view_changed

Triggered when the NUI view changes.
---@enum CameraNUIView
CAMERA_NUI_VIEW = {
    MENU = "menu",
    VIEWFINDER = "viewfinder",
    GALLERY = "gallery",
    SETTINGS = "settings"
}

---@param view CameraNUIView - The new NUI view
---@param old_view CameraNUIView - The previous NUI view
AddEventHandler("no-camera:nui:view_changed", function(view, old_view)
  print(("View changed from %s to %s"):format(old_view, view))
end)

no-camera:nui:activated

Triggered when the NUI is activated.
AddEventHandler("no-camera:nui:activated", function()
  print("NUI activated")
end)

no-camera:nui:deactivated

Triggered when the NUI is deactivated.
AddEventHandler("no-camera:nui:deactivated", function()
  print("NUI deactivated")
end)

no-camera:photo:shown

Triggered when a photo is shown. Payload
  • photo: table - The photo being shown
AddEventHandler("no-camera:photo:shown", function(photo)
  print(("Showing photo %s"):format(photo.id))
end)

no-camera:photo:closed

Triggered when a photo is closed. Payload
  • photo: table - The photo that was closed
AddEventHandler("no-camera:photo:closed", function(photo)
  print(("Closed photo %s"):format(photo.id))
end)