This event emitted when CaptureRequest receive new message.
Event arguments:
request -
type -
message - string
source -
-- Example of using request.onMessage event
local request = RSC.CaptureRequest.New()
-- Print every message
request.onMessage:On(function(request, type, message) print(message) end)
-- Capture a player with index 1
request:Capture( Entity(1) ):Await()
-- Printed messages to console:
-- #rsc.notify.copying_screen
-- #rsc.notify.screen_to_image
-- ...
This event emitted when CaptureRequest receive result.
Event arguments:
ok - bool
result - string
-- Example of using request.onMessage event
local request = RSC.CaptureRequest.New()
-- Print every message
request.onResult:On(function(request, ok, result) print(ok, result) end)
-- Capture a player with index 1
request:Capture( Entity(1) ):Await()
-- Printed result to console:
-- true 2a975c6d-c086-4c81-8e7a-b5d7dddcac9d
:Capture(...)
Promise<nil> CaptureRequest:Capture( victim: Player, serviceName?: str, quality?: number )
Errors:
Requester doesn't have enough rights #rsc.errors.no_rightsClientside only
Invalid victim #rsc.errors.invalid_victim
Invalid service (rarely can happen) #rsc.errors.invalid_service
Trying to start new :Capture(...) while in in queue already in queue
-- Make 10 capture requests
for i = 1, 10 do
local request = RSC.CaptureRequest.New()
-- Print result when it is received
request.onResult:On(function(request, ok, result) print("Got result:", result) end)
-- Start a capture
print("Starting a capture number " .. i)
local ok, err = request:Capture( Entity(1) ):SafeAwait()
if not ok then return ErrorNoHaltWithStack(err) end -- Something failed
print("Capture successfully started!")
end
-- Console log:
-- Starting a capture number 1
-- Capture successfully started!
-- Got result: 23c97d34-bf73-470c-a32e-f30fae9d0ec8
-- Starting a capture number 2
-- Capture successfully started!
-- Got result: 6b83d65d-9545-42ed-8134-47d97d28c922
-- Starting a capture number 3
-- ...
Gets a download url after result received. Can also throw an error.
Same as request:GetService():GetDownloadURL( result, request:GetQuality(), request:GetPrepareData() )
Downloads capture image after result received. Can also throw an error.
Same as request:GetService():Download( result, request:GetQuality(), request:GetPrepareData() )
Starts a capture of given player. You can also specify name (by default ) and (by default 2). Also it will wait until capture queue is free and capture has successfully requested. Also this function can fail.
Returns a promise that will be fulfilled with a capture result. If capture failed, then promise become rejected with a capture fail reason. Internally used in and .