OnPlayerScreenShot: Difference between revisions
Jump to navigation
Jump to search
(Created page with "__NOTOC__ {{Server event}} This event is triggered when the screen capture requested by takePlayerScreenShot has completed. ==Parameters== <syntaxhighlight lang="lua"> resource theResourc...") |
mNo edit summary |
||
Line 13: | Line 13: | ||
**''"disabled"'' - The image capture failed because the player has disabled screen uploads. | **''"disabled"'' - The image capture failed because the player has disabled screen uploads. | ||
**''"minimized"'' - The image capture failed because the player has minimized the screen. (i.e. alt-tabbed) | **''"minimized"'' - The image capture failed because the player has minimized the screen. (i.e. alt-tabbed) | ||
*'''imageData''': A string which contains the JPEG image data. This can be saved with the file functions, or sent to players with triggerClientEvent or even | *'''imageData''': A string which contains the JPEG image data. This can be saved with the file functions, or sent to players with triggerClientEvent or even -oh my god- uploaded to a web site. | ||
*'''timestamp''': The server tick count when the capture was taken. | *'''timestamp''': The server tick count when the capture was taken. | ||
*'''tag''': The tag string passed to [[takePlayerScreenShot]]. | *'''tag''': The tag string passed to [[takePlayerScreenShot]]. |
Revision as of 16:47, 20 January 2012
This event is triggered when the screen capture requested by takePlayerScreenShot has completed.
Parameters
resource theResource, string status, string imageData, int timestamp, string tag
- theResource: The resource which called takePlayerScreenShot
- status: The status of the event which can be one of three values:
- "ok" - The image capture was successful and imageData will contain a JPEG image.
- "disabled" - The image capture failed because the player has disabled screen uploads.
- "minimized" - The image capture failed because the player has minimized the screen. (i.e. alt-tabbed)
- imageData: A string which contains the JPEG image data. This can be saved with the file functions, or sent to players with triggerClientEvent or even -oh my god- uploaded to a web site.
- timestamp: The server tick count when the capture was taken.
- tag: The tag string passed to takePlayerScreenShot.
Source
The source of this event is the player
Example
This example captures the screen of a random player every 2 seconds and shows it to everyone:
Click to collapse [-]
Server-------------------------------------------------- -- Take screen shot every 2 seconds function doTakeScreenShot() takePlayerScreenShot( getRandomPlayer(), 320, 200 ) end setTimer(doTakeScreenShot, 2000, 0) -------------------------------------------------- -- Receive screen shot result addEventHandler( "onPlayerScreenShot", root, function ( theResource, status, imageData, timestamp, tag ) triggerClientEvent( root, "onMyClientScreenShot", resourceRoot, imageData ) -- Relay to all players end )
Click to collapse [-]
Client-------------------------------------------------- -- Turn image data into a texture at the client addEvent("onMyClientScreenShot",true) addEventHandler( "onMyClientScreenShot", resourceRoot, function( imageData ) local newFile = fileCreate("temp.jpg") fileWrite(newFile, imageData ) fileClose(newFile) if image then destroyElement(image) end image = dxCreateTexture( "temp.jpg" ) end ) -------------------------------------------------- -- Show image addEventHandler( "onClientRender", root, function() if image then dxDrawImage( 100, 250, 320, 200, image ) end end )
Requirements
This template will be deleted.
See Also
Player events
- onPlayerACInfo
- onPlayerBan
- onPlayerChangeNick
- onPlayerChat
- onPlayerClick
- onPlayerCommand
- onPlayerConnect
- onPlayerContact
- onPlayerDamage
- onPlayerJoin
- onPlayerLogin
- onPlayerLogout
- onPlayerMarkerHit
- onPlayerMarkerLeave
- onPlayerModInfo
- onPlayerMute
- onPlayerNetworkStatus
- onPlayerPickupHit
- onPlayerPickupLeave
- onPlayerPickupUse
- onPlayerPrivateMessage
- onPlayerQuit
- onPlayerScreenShot
- onPlayerSpawn
- onPlayerStealthKill
- onPlayerTarget
- onPlayerUnmute
- onPlayerVehicleEnter
- onPlayerVehicleExit
- onPlayerVoiceStart
- onPlayerVoiceStop
- onPlayerWasted
- onPlayerWeaponFire
- onPlayerWeaponSwitch
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled