Lib47.TakeScreenshotCaptures the current game screen on-demand directly from GPU texture memory using the built-in WebGL GameRenderer. This operates entirely within ak47_lib and does not require screenshot-basic or any external capture resources. Minimap and HUD can be hidden automatically during the capture frame.
--- @param options table|nil Optional capture settings
--- @return string|nil dataUrl Base64 image data URL (e.g., 'data:image/jpeg;base64,...')
--- @return string|nil error Error message if the capture failed
local dataUrl, err = Lib47.TakeScreenshot({
encoding = 'jpg', -- 'jpg' or 'png' (default: 'jpg')
quality = 0.92, -- Image compression between 0.1 and 1.0 (default: 0.92)
hideRadar = true, -- Temporarily hide minimap/radar during capture (default: true)
crop = nil, -- Optional crop: { x = 0, y = 0, width = 1280, height = 720 }
})
if dataUrl then
print("Screenshot captured successfully!")
-- Use dataUrl locally or send to upload API
else
print("Failed to capture screenshot:", err)
endLib47.UploadToFiveManageUploads a single media file to FiveManage through the NUI bridge. Supports image, video, and audio formats as base64 data URLs or raw base64 strings. Requests are assigned unique upload IDs, allowing multiple concurrent uploads from different scripts without blocking.
--- @param fileData string Base64 data URL or raw Base64 string
--- @param token string Your FiveManage API authorization token
--- @param path string|nil Destination folder name in FiveManage (default: 'ak47_uploads')
--- @param mediaType string|nil File type: 'image' | 'video' | 'audio' (default: 'image')
--- @return string|nil url The public FiveManage hosted file URL
--- @return string|nil error Error message if the upload failed
local url, err = Lib47.UploadToFiveManage(imageData, 'YOUR_FIVEMANAGE_TOKEN', 'ak47_housing', 'image')
if url then
print("File uploaded successfully to:", url)
else
print("Failed to upload to FiveManage:", err)
endLib47.UploadMultipleToFiveManageUploads an array of files to FiveManage simultaneously in parallel. Each item is converted and uploaded asynchronously via Promise.all in NUI, returning a list of hosted URLs in the same order. Ideal for uploading galleries, document attachments, or multiple property angles.
--- @param filesList table Array of base64 strings or { file = ..., mediaType = ... } tables
--- @param token string Your FiveManage API authorization token
--- @param path string|nil Destination folder name in FiveManage (default: 'ak47_uploads')
--- @param mediaType string|nil Default media type for string items: 'image' | 'video' | 'audio' (default: 'image')
--- @return table|nil urls Array of public FiveManage hosted URLs
--- @return string|nil error Error message if the upload failed
-- Example 1: Batch upload multiple image strings
local images = {
photo1_dataUrl,
photo2_dataUrl,
photo3_dataUrl,
}
local urls, err = Lib47.UploadMultipleToFiveManage(images, 'YOUR_FIVEMANAGE_TOKEN', 'ak47_housing', 'image')
if urls then
for index, fileUrl in ipairs(urls) do
print(string.format("Image #%d URL: %s", index, fileUrl))
end
else
print("Batch upload failed:", err)
end
-- Example 2: Mixed media batch upload
local mixedMedia = {
{ file = photoDataUrl, mediaType = 'image' },
{ file = videoDataUrl, mediaType = 'video' },
{ file = audioDataUrl, mediaType = 'audio' },
}
local urls, err = Lib47.UploadMultipleToFiveManage(mixedMedia, 'YOUR_FIVEMANAGE_TOKEN', 'ak47_records')Lib47.TakeScreenshotAndUploadAn all-in-one convenience function that captures a screenshot on-demand and immediately uploads it to FiveManage in a single awaitable call. Handles the full capture, WebGL unmounting, blob conversion, and cloud upload lifecycle.
--- @param token string Your FiveManage API authorization token
--- @param path string|nil Destination folder name in FiveManage (default: 'ak47_uploads')
--- @param options table|nil Optional capture settings (passed to TakeScreenshot)
--- @return string|nil url The public FiveManage hosted image URL
--- @return string|nil error Error message if capture or upload failed
local imageUrl, err = Lib47.TakeScreenshotAndUpload('YOUR_FIVEMANAGE_TOKEN', 'ak47_housing', {
encoding = 'jpg',
quality = 0.90,
hideRadar = true,
})
if imageUrl then
print("Property screenshot uploaded to FiveManage:", imageUrl)
-- Example: Save to house data or database
housedata.image = imageUrl
else
print("Screenshot & upload failed:", err)
end