WiBox Posted June 4, 2019 Share Posted June 4, 2019 If I need to download a picture via link, which should be used? fetchRemote or callRemote ? Link to comment
WiBox Posted June 4, 2019 Author Share Posted June 4, 2019 (edited) -- Server function startImageDownload( playerToReceive ) fetchRemote ("https://imgur.com/download/B8ta5Aa/The+Senate+upvote+this+image+of+our+glorious+ruler+so+it's+the+first+image+when+you+google+%22The%20Senate%22", myCallback, "", false, playerToReceive ) end addCommandHandler( "d", startImageDownload) function myCallback( responseData, errno, playerToReceive ) if errno == 0 then triggerClientEvent( playerToReceive, "onClientGotImage", resourceRoot, responseData ) end end -- Client addEvent( "onClientGotImage", true ) addEventHandler( "onClientGotImage", resourceRoot, function( pixels ) downloadFile( pixels ) end ) File doesn't exist, it is the first time I use fetchRemote, so I'm not sure what's the wrong thing in it, now I know so I can download it I should edit meta.xml, but the image has not been downloaded, so any explanations? Edited June 4, 2019 by R.I.P Logic Link to comment
DNL291 Posted June 4, 2019 Share Posted June 4, 2019 You'll need to create a file with the received data. For that use fileCreate, fileWrite, fileClose. PS: Your link isn't working. Link to comment
WiBox Posted June 4, 2019 Author Share Posted June 4, 2019 How can I check if a link works? I've tried to write " https://imgur.com/download/B8ta5Aa/The+Senate+upvote+this+image+of+our+glorious+ruler+so+it's+the+first+image+when+you+google+%22The%20Senate%22 " and it worked, : How can I know if the link will work in MTA? Okay, thanks I tried to use, fileCreate, fileWrite, fileClose and it worked! I used outputChatBox and print, and suddenly I remembered that that encrypted language doesn't work in MTA, so I tried those 3 functions, worked. Thanks! 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