Jump to content

downloadFile


xTravax

Recommended Posts

Posted

hello

i wanted to ask if this thing would be possible

i got much mods in my server so im wondering about this

-- meta 
"modname.dff" download="false" /> 
"modname.txd" download="false" /> 
  

--script 
function downloadTimer() 
setTimer(downloadFiles,30000,1) 
end 
addEventHandler("onClientResourceStart",root,downloadTimer) 
  
function downloadFiles() 
    downloadFile ( "modname.dff" ) 
    downloadFile ( "modname.txd" ) 
end 
  

this script has some flaws like

whenever resource would start for someone,it would restart download and overwrite files but it can be fixed with fileExists function

i was just wondering would this kind of thing work?

Posted
If the file has been previously downloaded and the CRC matches, the file will not be downloaded again but onClientFileDownloadComplete will still run.
Posted

i tried this in my local server and it said http file mismatch resourcename/filename.txd or whatever

i thought this is downloading from resource folder and not from the internet?

Posted

Yeah it is. The mta server has in inbuild http server to stream files..

This message you encountered is probably a bug since I've experienced the same.

Posted

as far as i know it could be mta related bug as you said or it could be that the files are damaged,but my files are 100% sure not damaged so it must be a mta bug.

would be nice if someone could report this bug as i can't make account on bugs.mtasa.com site

Posted

You could try to navigate to: "C:\Program Files (x86)\MTA San Andreas 1.4\mods\deathmatch\resources" and see if your resource is in there. Disconnect from your local server and remove your resource from above directory, refresh your server resources and connect again. CRC mismatch are, just like the name says mismatched resources. Not fully sure about this but it's a good idea to try it out, if it works it sure is a good idea which let your players enjoy the game while downloading too.

Posted

i can't find the resource folder in both 1.3 and 1.4 folder

F8 console outputs this

Download error: HTTP server file mismatch (resourcename) font.ttf

Download error: HTTP server file mismatch (resourcename) image.jpg

Download error: HTTP server file mismatch (resourcename) test.mp3

Download error: HTTP server file mismatch (resourcename) test.png

and local server console:

[09:36:50] DIAGNOSTIC: *playername* #1002 HTTP server file mismatch (resourcename) font.ttf

i checked in fetchRemote and it says 1002 is download aborted

however i still dont get it,why does this function have anything to do related with html?

could this error come because im using local server?

Posted

lol the only reason i got mta 1.4 at all is because i saw that topic,so it has been updated to official release before i made this topic

and it doesnt work and i dont know what to do

Posted

I changed my custom download system from fetchRemote to downloadFile and it works perfect, so it must be something on your sever, rather than a MTA bug.

Posted

well then maybe my code or meta is wrong

function downloadTimer() 
setTimer(downloadFiles,30000,1) 
end 
addEventHandler("onClientResourceStart",root,downloadTimer) 
  
function downloadFiles() 
outputChatBox("downloading server files...") 
    downloadFile ( "test.png" ) 
    downloadFile ( "test.mp3" ) 
    downloadFile ( "image.jpg" ) 
    downloadFile ( "font.ttf" ) 
end 
  
function downloadFinish() 
outputChatBox("Download Finished!") 
addEventHandler("onClientFileDownloadComplete",root,downloadFinish) 


perhaps i need to have same order in meta as in script with downloading files?

btw here are test files i've used

https://www.mediafire.com/?wx6446kmkdpf651

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...