#RooTs Posted March 18, 2016 Posted March 18, 2016 is that a good guy can make a table for me to add multiple images? example table,{ image01 = "http://www.example.com/image.jpg", image02 = "http://www.example.com/image2.jpg", image03 = "http://www.example.com/image3.jpg", } all my code server.lua function startImageDownload( playerToReceive ) fetchRemote ( "http://www.example.com/image.jpg", myCallback, "", false, playerToReceive ) end function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end client.lua addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function( pixels ) if myTexture then destroyElement( myTexture ) end myTexture = dxCreateTexture( pixels ) end ) addEventHandler("onClientRender", root, function() if myTexture then local w,h = dxGetMaterialSize( myTexture ) dxDrawImage( 200, 100, w, h, myTexture ) end end )
Dimos7 Posted March 18, 2016 Posted March 18, 2016 local images ={ {"", 1} } function startDownloadImage(playerToReceive) for i = 1 , #images do fetchRemote(images, myCallback, "", false, playerdToReceive) end end function myCallback(responseData, errno, playerToReceive) if errno == 0 then triggerClientEvent(playerToReceive, "onClientGotImage", resourceRoot, responseData) end end
#RooTs Posted March 18, 2016 Author Posted March 18, 2016 and clientSide ? dxDrawImage( 200, 100, w, h, myTexture1 )--?? dxDrawImage( 200, 100, w, h, myTexture2 ) dxDrawImage( 200, 100, w, h, myTexture3 )
Captain Cody Posted March 18, 2016 Posted March 18, 2016 dxDrawImage is indeed clientSide. If you were asking. But now realizing what you may have been asking you wanna send the response data client side, and define it client side.
#RooTs Posted March 18, 2016 Author Posted March 18, 2016 the table need to both sides. client and server
Enargy, Posted March 18, 2016 Posted March 18, 2016 local images ={ {"", 1} } function startDownloadImage(playerToReceive) for i = 1 , #images do fetchRemote(images, myCallback, "", false, playerdToReceive) end end function myCallback(responseData, errno, playerToReceive) if errno == 0 then triggerClientEvent(playerToReceive, "onClientGotImage", resourceRoot, responseData) end end fetchRemote(images[i], myCallback, "", false, playerdToReceive)
#RooTs Posted March 18, 2016 Author Posted March 18, 2016 @Gaberiel, you can create table in clientSide?
Captain Cody Posted March 18, 2016 Posted March 18, 2016 Yes you can create a table client side, it's a shared function.
#RooTs Posted March 18, 2016 Author Posted March 18, 2016 Yes you can create a table client side, it's a shared function. I do not know how do
#RooTs Posted March 19, 2016 Author Posted March 19, 2016 Table = {} Table["Value"] = value this did not help me at all
Captain Cody Posted March 19, 2016 Posted March 19, 2016 You define the table with Table = {} then set the values with Table["Value"] = value you'd like then load them with value = Table ["Value"]
#RooTs Posted March 19, 2016 Author Posted March 19, 2016 You define the table withTable = {} then set the values with Table["Value"] = value you'd like then load them with value = Table ["Value"] ?? dxDrawImage( 200, 100, w, h, Table["Value"] ) boy ... much do it for me? my god...
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