Phoenix-Roleplay Posted July 22, 2012 Share Posted July 22, 2012 Hello MTA, I have another small issue on my hand, but not so much an issue. Using dxCreateScreenSource is there a way to transmit the taken image from one clients screen and send the same image to other players? I am working on a speedcam that takes a photo of the player who sped and want to transit the image to every police on duty, the image displays to all police and to the violator only the police receive an image of themselves. Link to comment
unknooooown Posted July 22, 2012 Share Posted July 22, 2012 I am not 100% sure about what you are trying to do here, but I get the idea that you want to take a screenshot of a client and display that for police on the server? If so, have a look at this: https://wiki.multitheftauto.com/wiki/Tak ... ScreenShot https://wiki.multitheftauto.com/wiki/OnPlayerScreenShot Link to comment
Phoenix-Roleplay Posted July 22, 2012 Author Share Posted July 22, 2012 OK. So I am not exactly sure the issue here, but it fails to show the photo to anyone. Client: addEvent("onMyClientScreenShot",true) addEventHandler( "onMyClientScreenShot", resourceRoot, function( pixels ) if image then destroyElement(image) end image = dxCreateTexture( pixels ) daPic() end ) --local screen = dxCreateScreenSource ( 340, 380 ); local sWidth,sHeight = guiGetScreenSize() function daPic() dxUpdateScreenSource(image); addEventHandler("onClientRender", root, showSpeedPic) setTimer(removeDaAnnoyingThingy, 5000, 1); end addEvent("showPicture", true) addEventHandler("showPicture", getLocalPlayer(), daPic) function showSpeedPic() rect = dxDrawRectangle(20.0,209.0,295.0,255.0,tocolor(0,0,0,140),false) dxDrawImage( 28.0,217.0,279.0,238.0, image) end function removeDaAnnoyingThingy() removeEventHandler("onClientRender", root, showSpeedPic) end -------------------------------------------------- --[[ Show image addEventHandler( "onClientRender", root, function() if image then rect = dxDrawRectangle(20.0,209.0,295.0,255.0,tocolor(0,0,0,140),false) dxDrawImage( 28.0,217.0,279.0,238.0, image) setTimer(removeDaAnnoyingThingy, 5000, 1); end end )]] function getScreenSize(value,thePlayer) local x,y = guiGetScreenSize() triggerServerEvent("takePicture",getLocalPlayer(),value,thePlayer,x,y) end addEvent("getScreenSize",true) addEventHandler("getScreenSize",getRootElement(),getScreenSize) Server: function takePicture(value,thePlayer,x,y) takePlayerScreenShot(thePlayer,x,y,"speedcam",100) end addEventHandler( "onPlayerScreenShot", root, function ( theResource, status, pixels, timestamp, tag ) triggerClientEvent( root, "onMyClientScreenShot", resourceRoot, pixels ) -- Relay to all players end ) And I have added triggerClientEvent("getScreenSize",getRootElement(),value,thePlayer) Link to comment
qaisjp Posted July 22, 2012 Share Posted July 22, 2012 https://community.multitheftauto.com/ind ... ls&id=3581 This does what you are looking at, check the code. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now