Oussema Posted April 3, 2017 Share Posted April 3, 2017 I Have this simple script to download and replace vehicle mods: function replaceModel() txd = engineLoadTXD("429.txd", 429 ) engineImportTXD(txd, 429) dff = engineLoadDFF("429.dff", 429 ) engineReplaceModel(dff, 429) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceModel) But the problem is that with more mods i add it is raising the ammount of MB that the player has to download. That script downloads mods and after that the player can join the game I want is a script that only downloads the mods when the player login so that he can play same time the mods are downloading.. i saw somthing like adding mods in the Meta with attribute: download = "false" And downloadFile after the player logs in for example. but i have no idea about that so anyone tell me ? i hope u can help me , Thanks . Link to comment
AE. Posted April 3, 2017 Share Posted April 3, 2017 (edited) go to another script and create onPlayerLogin event and use startResource to start the resource that have the txd and dff files but this maybe start for all the players so you need to do some triggers :3 Edited April 3, 2017 by 3laa33 Link to comment
Oussema Posted April 3, 2017 Author Share Posted April 3, 2017 8 minutes ago, 3laa33 said: go to another script and create onPlayerLogin event and use startResource to start the resource that have the txd and dff files but this maybe start for all the players so you need to do some triggers :3 Read all pls :v "But the problem is that with more mods i add it is raising the ammount of MB that the player has to download." Link to comment
AE. Posted April 3, 2017 Share Posted April 3, 2017 Just now, Oussema said: Read all pls :v "But the problem is that with more mods i add it is raising the ammount of MB that the player has to download." if the resource is stopping they won't download it Link to comment
Oussema Posted April 3, 2017 Author Share Posted April 3, 2017 the resource will not stop dude -__- Comon open your brain and read the full topic pls Link to comment
AE. Posted April 3, 2017 Share Posted April 3, 2017 1 minute ago, Oussema said: the resource will not stop dude -__- Comon open your brain and read the full topic pls it will start if you started it will stop if you stopped it you start the resource it doesn't start itself Link to comment
Oussema Posted April 3, 2017 Author Share Posted April 3, 2017 1 minute ago, 3laa33 said: it will start if you started it will stop if you stopped it you start the resource it doesn't start itself Are you kidding me dude ?!! lol who will start the resource ? my mom !!! you think i want know how to start the resource ? lol man ok i'll take you like your brain I want this script download the mods only when the player login so that he can play same time the mods are downloading.. it's not just 1 mod or 2 it's more than 10+ mods did you understand now ? Link to comment
AE. Posted April 3, 2017 Share Posted April 3, 2017 (edited) hmmm i dunno why you are attacking me like i'am the idiot but i will make it simple for you the mods don't download ok? unless you start the mod it doesn't matter if it's on your server so when you finish the mod don't start it ... omg omg it didn't download omg :3 so now you go for another script you make it and start this one function thisguyisidiot() startResource(yourmods) end addEventHandler("onPlayerLogin",getRootElement(),thisguyisidiot) now the player logged in and the resource started = the mod is downloading now Edited April 3, 2017 by 3laa33 1 Link to comment
Oussema Posted April 3, 2017 Author Share Posted April 3, 2017 WTF man due first i'm not attacking you but really you never understand me and you didn't too look look pls , that you gave me will make the resource start everytime play login :v ok look i logged in the resource start fine , and if another one join hhhhhh ? what resource will do ?!!! anwayway thx bro ! Any another one understand me and can help me pls ? Link to comment
AE. Posted April 3, 2017 Share Posted April 3, 2017 THAT'S WHY I TOLD YOU TO MAKE SOME TRIGGGERS AHAHAJHAHHUYAEHIUGHIUJIUFRBHJKOIFGKNJLHGRHJOLRBBGONIPFBJOIUHDJIUBDIUHF Link to comment
Oussema Posted April 3, 2017 Author Share Posted April 3, 2017 ok look with some tiggers i can understand that but show example if it's more than 5 mods please ? and thx you Link to comment
AE. Posted April 3, 2017 Share Posted April 3, 2017 just add more startResource(themode) startResource(themode) startResource(themode) like this Link to comment
Oussema Posted April 4, 2017 Author Share Posted April 4, 2017 (edited) ok ok Guys i have tried with that : addEvent("startCheckMods",true) addEventHandler("startCheckMods",root,function() for i, v in pairs ( getModsTable () ) do if ( not fileExists(v[2]) ) then downloadFile ( v[2] ) else if v[1] == "txd" then local txd = engineLoadTXD ( v[2],0) if ( not txd or not engineImportTXD ( txd, v[3] ) ) then outputDebugString ( "Failed to replace ".. tostring ( v[2] ).. " (Loading file as .txd | Tryed to replace model "..tostring(v[3])..")" ) end else local dff = engineLoadDFF ( v[2], 0 ) if ( not dff or not engineReplaceModel ( dff, v[3] ) ) then outputDebugString ( "Failed to replace ".. tostring ( v[2] ).. " (Loading file as .dff | Tryed to replace model "..tostring(v[3])..")" ) end end end end end) addEventHandler ( "onClientFileDownloadComplete", root, function ( _, success ) if ( success ) then local modsDone = true for i, v in pairs ( getModsTable() ) do if ( not fileExists ( v[2] ) ) then modsDone = false break end end if ( modsDone ) then for i, v in pairs( getModsTable() ) do if v[1] == "txd" then local txd = engineLoadTXD ( v[2],0) if ( not txd or not engineImportTXD ( txd, v[3] ) ) then outputDebugString ( "Failed to replace ".. tostring ( v[2] ).. " (Loading file as .txd | Tryed to replace model "..tostring(v[3])..")" ) end else local dff = engineLoadDFF ( v[2], 0 ) if ( not dff or not engineReplaceModel ( dff, v[3] ) ) then outputDebugString ( "Failed to replace ".. tostring ( v[2] ).. " (Loading file as .dff | Tryed to replace model "..tostring(v[3])..")" ) end end end end end end ) i got warning : attempt to load "Filename" before onClientFileDownloadComplete Edited April 4, 2017 by Oussema Link to comment
NanoBob Posted April 4, 2017 Share Posted April 4, 2017 (edited) You have to make your engineLoadTXD and engineLoadDFF functions get called after the download is finished. https://wiki.multitheftauto.com/wiki/OnClientFileDownloadComplete Also you really would not want to restart hte resource when the player logs in since that restarts it for all players, meaning all mods get unloaded and reloaded. Edited April 4, 2017 by NanoBob Link to comment
Oussema Posted April 4, 2017 Author Share Posted April 4, 2017 the problem not here bro :v if they player download it once then i restart script ! then the error will show but in the first time download it's fine , i want know how to check if the clinet already have the files don't download them , just replace 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