TakePlayerScreenShot: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (→‎Syntax: consistency)
(Added missing argument(maxPacketSize))
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool takePlayerScreenShot ( player thePlayer, int width, int height [, string tag = "", int quality = 30, int maxBandwith = 5000 ] )         
bool takePlayerScreenShot ( player thePlayer, int width, int height [, string tag = "", int quality = 30, int maxBandwith = 5000, maxPacketSize = 500 ] )         
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[player]]:takeScreenShot||}}
{{OOP||[[player]]:takeScreenShot||}}
Line 17: Line 17:
*'''quality:''' Quality of the final JPEG image from 0 to 100. A lower value can reduce the memory used by the image considerably which will result in faster and less intrusive uploads.
*'''quality:''' Quality of the final JPEG image from 0 to 100. A lower value can reduce the memory used by the image considerably which will result in faster and less intrusive uploads.
*'''maxBandwith:''' The amount of client upload bandwidth to use (in bytes per second) when sending the image.
*'''maxBandwith:''' The amount of client upload bandwidth to use (in bytes per second) when sending the image.
*'''maxPacketSize: ''' The maximum size of one packet.


===Returns===
===Returns===

Revision as of 00:03, 4 January 2019

This function forces a client to capture the current screen output and send it back to the server. The image will contain the GTA HUD and the output of any dxDraw functions that are not flagged as 'post GUI'. The image specifically excludes the chat box and all GUI (including the client console). The result is received with the event onPlayerScreenShot.

Syntax

bool takePlayerScreenShot ( player thePlayer, int width, int height [, string tag = "", int quality = 30, int maxBandwith = 5000, maxPacketSize = 500 ] )         

OOP Syntax Help! I don't understand this!

Method: player:takeScreenShot(...)


Required Arguments

  • thePlayer: the player to get the screen capture from.
  • width: the width of the capture image.
  • height: the height of the capture image.

Optional Arguments

  • tag: A string to help identify the screen capture. The string is passed to the matching onPlayerScreenShot event for your personal convenience.
  • quality: Quality of the final JPEG image from 0 to 100. A lower value can reduce the memory used by the image considerably which will result in faster and less intrusive uploads.
  • maxBandwith: The amount of client upload bandwidth to use (in bytes per second) when sending the image.
  • maxPacketSize: The maximum size of one packet.

Returns

Returns true if the function was successfully, false if invalid arguments are specified.

Example

This example will initiate a capture of a Random Players screen

local player = getRandomPlayer()
takePlayerScreenShot( player, 320, 240 )

Requirements

Minimum server version 1.3
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.3" />

See Also