xeon17 Posted June 9, 2014 Posted June 9, 2014 I tried to create a script witch create a screenshot of player , extample write /ss ( playername or id ) and you get a screenshot of the player. But i no understand what i should do on server side , i already used triggerServerEvent but i have no idea how to finish the script on server side , it's my 2-3 time i create a client script so i'm newbie should i post the client script ? i tried something on server side with addEvent & addEventHandler but it not worked. A unique GangWar gamemode waiting for you!Click here for more information.
MIKI785 Posted June 9, 2014 Posted June 9, 2014 If you're creating the picture clientsided (i guess you're not using takePlayerScreenshot) then the server will be like the middle man that will receive it from the first player that made the screenshot and then using triggerClientEvent it will send the data to the player that requested the screenshot and this player will then display it. Best way would be to save the image data using fileCreate and fileWrite and then display that using guiCreateStaticImage. Lua Scripter Owner of mshost.cz MTA portal.
xeon17 Posted June 9, 2014 Author Posted June 9, 2014 i already created the client side , but i no understand how to create server side. it's my first time i do something like this. i'm working at this script 3 mounths. -------------------------------------------------- -- Turn image data into a texture at the client addEvent("onMyClientScreenShot",true) addEventHandler( "onMyClientScreenShot", resourceRoot, function(player, pixels ) if image then destroyElement(image) image = nil end if(pixels) then image = dxCreateTexture( pixels ) end screenShotPlayer = player; end ) -------------------------------------------------- -- Show image addEventHandler( "onClientRender", root, function() if image and isElement(screenShotPlayer) then dxDrawImage( 100, 250, 400, 300, image ) dxDrawText("SS - ".. getPlayerName(screenShotPlayer), 100, 250, 400, 300, tocolor ( 255, 255, 255, 255 ), 1, "pricedown" ) end if myTexture then local sw,sh = guiGetScreenSize () local w,h = dxGetMaterialSize( myTexture ) dxDrawImage( 10, sh/2-h/2, w, h, myTexture ) end end ) addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function( pixels ) if(pixels) then myTexture = dxCreateTexture( pixels ) else myTexture = nil end end ) local keyTable = { "mouse1", "mouse2", "mouse3", "mouse4", "mouse5", "mouse_wheel_up", "mouse_wheel_down", "arrow_l", "arrow_u", "arrow_r", "arrow_d", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "num_0", "num_1", "num_2", "num_3", "num_4", "num_5", "num_6", "num_7", "num_8", "num_9", "num_mul", "num_add", "num_sep", "num_sub", "num_div", "num_dec", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "backspace", "tab", "lalt", "ralt", "enter", "space", "pgup", "pgdn", "end", "home", "insert", "delete", "lshift", "rshift", "lctrl", "rctrl", "[", "]", "pause", "capslock", "scroll", ";", ",", "-", ".", "/", "#", "\\", "=" } addEvent( "onRequestCommandsBoundToKey", true ) addEventHandler( "onRequestCommandsBoundToKey", root, function( theKey, keyState ) triggerServerEvent("onResponseCommandsBoundToKey", localPlayer,theKey, keyState, getCommandsBoundToKey( theKey, keyState )) end ) A unique GangWar gamemode waiting for you!Click here for more information.
xeon17 Posted June 10, 2014 Author Posted June 10, 2014 bumb A unique GangWar gamemode waiting for you!Click here for more information.
xeon17 Posted June 17, 2014 Author Posted June 17, 2014 someone ? A unique GangWar gamemode waiting for you!Click here for more information.
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