Deepu Posted March 31, 2014 Share Posted March 31, 2014 There is this problem that I wanna create 10 windows that shows different criminals who are wanted with 6 level. How can I make that? Tell the functions and explain how I can put different criminals in different windows.... Link to comment
Dealman Posted March 31, 2014 Share Posted March 31, 2014 Not entirely sure what you're on about, but... getPlayerWantedLevel guiCreateWindow As for designating criminals to the windows, it depends on how your system is made. Link to comment
cheez3d Posted March 31, 2014 Share Posted March 31, 2014 dxCreateScreenSource() -- get the screen of the criminals dxUpdateScreenSource() -- update the screen source every frame dxDrawImage() -- draw the texture returned by the function above setElementData() and getElementData() -- for transferring the textures from client to client Link to comment
myonlake Posted March 31, 2014 Share Posted March 31, 2014 Keep in mind that syncing like that will most likely end up laggy, so instead of setting on each frame, build your own "packet" system by limiting these 1 per 50 ms. Link to comment
Deepu Posted March 31, 2014 Author Share Posted March 31, 2014 what do you mean by packet? and btw cheezed, how you make criminals appear in the window with dxCreateScreenSource? You only make yourself appear in the window with screenSource...... Link to comment
cheez3d Posted March 31, 2014 Share Posted March 31, 2014 That is why you have to execute the function on the player's client, not on yours, and then transfer the data to your client and draw the image. Link to comment
Deepu Posted March 31, 2014 Author Share Posted March 31, 2014 heh? Well lets give it a try, but, how do you do that? Link to comment
Dealman Posted March 31, 2014 Share Posted March 31, 2014 Triggering events. Client -> Server -> Client. Is it efficient? No. But as far as I know, the only way of doing it without some serious modifications. Link to comment
Deepu Posted March 31, 2014 Author Share Posted March 31, 2014 eheh? oh I get it..... function ppp () ........ end addEvent("onPPP", true) addEventHandler("onPPP", getRootElement(), ppp) and then triggering it in server? function hhh () triggerClientEvent("onPPP", localPlayer) end addEvent("onHHH", true) addEventHandler("onHHH", getRootElement(), hhh) and then again to client? function kkk () triggerServerEvent("onHHH", localPlayer) end addEventHandler(.......) is this what you meant? Link to comment
Dealman Posted March 31, 2014 Share Posted March 31, 2014 Wat? Get the player's screen, send the result to the server via triggerServerEvent. Send the data the Server received to the specified client via triggerClientEvent. Player 1 -> Server -> Player 2 Not sure if it works, but you can try. I'd assume if it works, it's gonna lag quite a bit Link to comment
Deepu Posted March 31, 2014 Author Share Posted March 31, 2014 hmm.....Well I dint call anyone to the server and I tested it out myself.... I did the triggerings the same way and it worked but I can see only my image (since only I am the one playing in the server). So will it work if 2 players are online? Link to comment
WhoAmI Posted March 31, 2014 Share Posted March 31, 2014 Show me the code and I'll tell you. Link to comment
pa3ck Posted March 31, 2014 Share Posted March 31, 2014 I just tried it myself, but I got a black dxDraw. --SERVER addCommandHandler ( "screens", function ( p, cmd, targetPlayer ) if not targetPlayer then return end local tName, tPlayer = exports.global:getPlayer ( p, targetPlayer ) triggerClientEvent ( tPlayer, "updateSource", tPlayer ) triggerClientEvent ( p, "viewSource", p, tPlayer ) end ) --CLIENT addEvent ( "updateSource", true ) addEventHandler ( "updateSource", root, function () local sSource = dxCreateScreenSource ( 500, 500 ) if isElement ( sSource ) then outputChatBox ( "dxSource created" ) else outputChatBox ( "Error creating dxSource" ) end setElementData ( source, "screenSource", sSource ) end) addEvent ( "viewSource", true ) addEventHandler ( "viewSource", root, function ( tPlayer ) function handle() screenSource = getElementData ( tPlayer, "screenSource" ) dxDrawImage (0, 0, 500, 500, screenSource ) end addEventHandler ( "onClientRender", root, handle ) --outputChatBox ( tostring ( getElementData ( tPlayer, "screenSource" ) ) ) end) Link to comment
Deepu Posted April 1, 2014 Author Share Posted April 1, 2014 function screentis () myScreenSource = dxCreateScreenSource ( 640, 480 ) end addCommandHandler("st", screentis) function donetis () local players = getElementsByType("player") dxUpdateScreenSource( myScreenSource ) dxDrawImage( 10, 10, 800, 300, myScreenSource ) end function killstis () addEventHandler("onClientRender", root, donetis) end addEvent("onPPP", true) addEventHandler("onPPP", getRootElement(), killstis) function kkk () triggerServerEvent("onHHH", localPlayer) end addCommandHandler("onka", kkk) -- client function hhh () triggerClientEvent("onPPP", source) end addEvent("onHHH", true) addEventHandler("onHHH", getRootElement(), hhh) -- server EDIT: I used the dxDrawImage3D but the height of the image is too much and the width is too low dxDrawImage3D(-1234.98865, -87.49578, 14.14844, 5, -5, myScreenSource, tocolor(255,255,255,255), 90) 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