Axel Posted April 19, 2012 Posted April 19, 2012 Is there a way to show an image when someone downloads the server files?
Wei Posted April 19, 2012 Posted April 19, 2012 I don't think so. Because images are client, so players need to download it. You can set a text instead of image.
Kenix Posted April 19, 2012 Posted April 19, 2012 First download image. When image is downloaded draw it and download all next files. https://wiki.multitheftauto.com/wiki/DownloadFile https://wiki.multitheftauto.com/wiki/OnC ... adComplete
Khtsjefen Posted April 20, 2012 Posted April 20, 2012 (edited) You can set the image resource as map and everything else as script/gamemode/misc, as maps downloads before the scripts. Then use a timer or so to check every sec maybe if it's done, unless it's a event for that. And kill the timer when it finds out that it's done. Edit: Removed lua. Was never ment to be a copy/paste script, just an idea for how it could be done. Edited April 20, 2012 by Guest
Kenix Posted April 20, 2012 Posted April 20, 2012 Khtsjefen, All what you write is wrong.. I written better solution.
arezu Posted April 20, 2012 Posted April 20, 2012 isn't downloadFile for next version of MTA? No. I just tested it on my server and it said that the function doesn't exist.
Michael# Posted April 20, 2012 Posted April 20, 2012 It seems to work, it has nothing related to version in the wiki.
Kenix Posted April 20, 2012 Posted April 20, 2012 Example local nWidth, nHeight = guiGetScreenSize( ) local sImage = 'image.png' local tDownloadFiles = { 'car.txd'; 'car.dff'; -- ... } local fDraw = function( ) dxDrawImage( 0.5 * nWidth, 0.5 * nHeight, 0.5 * nWidth, 0.5 * nHeight, sImage ) end addEventHandler( 'onClientFileDownloadComplete', root, function( sFile, bSucces ) if sFile == sImage and bSucces then addEventHandler( 'onClientRender', root, fDraw ) for _, s in ipairs( tDownloadFiles ) do downloadFile( s ) end elseif sFile == tDownloadFiles[1] then local uTxd = engineLoadTXD ( sFile ) engineImportTXD ( uTxd, 587 ) elseif sFile == tDownloadFiles[2] then local uDff = engineLoadDFF ( sFile, 587 ) engineReplaceModel ( uDff, 587 ) end end ) addEventHandler( 'onClientResourceStart', resourceRoot, function( ) downloadFile( sImage ) end ) meta.xml <meta> <script src='c.lua' type='client' /> <file src='image.png' download='false' /> <file src='car.txd' download='false' /> <file src='car.dff' download='false' /> </meta> downloadFile This function downloads a file from the HTTP server. This can only be used on files on the HTTP server associated with the MTA server and will only download files from within the folder of the resource that is calling it. The file should also be included in meta.xml with the download attribute set to "false", see meta.xml for more details. If the file has been previously downloaded and the CRC matches, the file will not be downloaded again but onClientFileDownloadComplete will still run. Who want test it http://www.getzilla.net/files/3280297/testing.rar.html http://depositfiles.com/files/v2yqqj3ag Updated
arezu Posted April 20, 2012 Posted April 20, 2012 It seems to work, it has nothing related to version in the wiki. FROM VERSION 1.3.1 ONWARDS- downloadFile the latest stable version is 1.3.0. I tested your script Kenix but downloadFile didn't work, and the files were downloaded as normally before the script started.
Michael# Posted April 20, 2012 Posted April 20, 2012 It must say something in the function page too Just in functions list is not enough, I think.
Kenix Posted April 20, 2012 Posted April 20, 2012 I tested it. All working perfectly .. https://nightly.multitheftauto.com/
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