spoty Posted October 8, 2014 Share Posted October 8, 2014 hi i have a question is it possible to decrease my total download from my server? i have a total downloaf from 800mb and that scares new players and insta quit i am running server from a vps is there any kinda solution for this like a mysql script loader inplace of download Link to comment
Saml1er Posted October 8, 2014 Share Posted October 8, 2014 Yes, it is. Shrink your images and try not to use too much mods but if you want to use mods then you can also make a custom downloader and players can download mods of their own choice. Link to comment
spoty Posted October 8, 2014 Author Share Posted October 8, 2014 Yes, it is. Shrink your images and try not to use too much mods but if you want to use mods then you can also make a custom downloader and players can download mods of their own choice. ok and how can i create a costum downloader ? never did that before Link to comment
Saml1er Posted October 8, 2014 Share Posted October 8, 2014 Yes, it is. Shrink your images and try not to use too much mods but if you want to use mods then you can also make a custom downloader and players can download mods of their own choice. ok and how can i create a costum downloader ? never did that before You can make it using fileRead fileGetSize fileCreate fileWrite triggerLatentClientEvent -- after reading file from server side then trigger a event with those data using this function and write those files on client pc ---- addEventHandler("onClientRender",root, function ( ) dxDrawRectangle dxDrawText -- rendering your custom downloader bar end ) Link to comment
spoty Posted October 8, 2014 Author Share Posted October 8, 2014 Yes, it is. Shrink your images and try not to use too much mods but if you want to use mods then you can also make a custom downloader and players can download mods of their own choice. ok and how can i create a costum downloader ? never did that before You can make it using fileRead fileGetSize fileCreate fileWrite triggerLatentClientEvent -- after reading file from server side then trigger a event with those data using this function and write those files on client pc ---- addEventHandler("onClientRender",root, function ( ) -- rendering your custom downloader bar end ) ok thanks gonna make something with it Link to comment
Saml1er Posted October 8, 2014 Share Posted October 8, 2014 (edited) Remember do not start the resources with those files or mta downloader will start downloading them but still this is not enough you also need to load the scripts using loadString. You'll also need sand boxes. Here's an example: local files = {txd = {}, model = {} } -- you need to insert all functions into rows like event handlers, timers and more if you also want to unload the scripts. local env = { } -- for storing functions and variables _engineImportTXD = engineImportTXD local engineImportTXD = function(txd,model) local model = _engineImportTXD(txd,model) or false if not model then return end table.insert(files.model, model) return model end _engineLoadTXD = engineLoadTXD local engineLoadTXD = function(txd) local file = _engineLoadTXD(res.."/"..txd) or false if not file then return end table.insert(files.txd,file) return file end -- loading scripts in client side local function LoadScript (commandstring) local notReturned local commandFunction,errorMsg = loadstring("return "..commandstring) if errorMsg then notReturned = true commandFunction, errorMsg = loadstring(commandstring) end if errorMsg then return end --- set the new environment to env table so variables including functions are not stored in global scope "_G" setmetatable(env, {__index = _G}) ----- Now copy all variables and functions to env table setfenv(commandFunction, env) results = { pcall(commandFunction) } if not results[1] then return end if not notReturned then local resultsString = "" local first = true for i = 2, #results do if first then first = false else resultsString = resultsString..", " end local resultType = type(results[i]) if isElement(results[i]) then resultType = "element:"..getElementType(results[i]) end resultsString = resultsString..tostring(results[i]).." ["..resultType.."]" end end end local function unLoadData ( ) for i,v in ipairs(files.model) do engineRestoreModel(v) end for i,v in ipairs(files.txd) do destroyElement(v) end env = {} end Usage: LoadScript ( script ) -- should be string and you can use fileRead to read the file from server and side and load them at client side. unLoadData ( ) -- unloading script Edited October 8, 2014 by Guest Link to comment
spoty Posted October 8, 2014 Author Share Posted October 8, 2014 ok thanks i ask you for help if i fail in it Link to comment
myonlake Posted October 9, 2014 Share Posted October 9, 2014 Or rather just use the downloadFile function. https://wiki.multitheftauto.com/wiki/DownloadFile 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