Artix Posted May 19, 2020 Share Posted May 19, 2020 function myCallback(data, errno,path) if errno == 0 then triggerEvent("onFileTDownload", root, "sound.mp3", data); else outputChatBox ('Error '..errno) --it return error 7, when ip == localhost returns error 1006 end end addEvent("onFileTDownload", false); addEventHandler("onFileTDownload", root, function(path,data) local file; if not fileExists(path) then file = fileCreate(path); else file = fileOpen(path); end; fileWrite(file, data); fileClose(file); -- do whatever with the file ... end); function testdownload () fetchRemote("http://127.0.0.1:80/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3'); --[[i tried the following two examples too... fetchRemote("http://localhost/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3'); fetchRemote("http://localhost:80/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3'); ]] end addCommandHandler ('tts',testdownload) --[[ All in the client side]] How to solve it? can someone help me pls Link to comment
Moderators IIYAMA Posted May 19, 2020 Moderators Share Posted May 19, 2020 6 minutes ago, Artix said: How to solve it? can someone help me pls It is not as if players can download every file from the server. If they could, they would be able to steal all your stuff. You need to serve the file first with a webserver. Read: https://wiki.multitheftauto.com/wiki/Resource_Web_Access <html src="sound.mp3" raw="true" /> 1 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