TorNix~|nR Posted July 19, 2017 Share Posted July 19, 2017 Hello guys, I'm using the moddownload of @xXMADEXx, it works fine LINK: https://community.multitheftauto.com/index.php?p=resources&s=details&id=11265 but there is something bad I want to change, you should open the panel and turn on the mods, how can I disable this, and make it always automatically on. help please? Link to comment
pa3ck Posted July 19, 2017 Share Posted July 19, 2017 (edited) I quickly took a look at it, it uses XML to save which mod should be downloaded. Override the function that load's the XML to always have it enabled - cMods.lua btw. Edited July 19, 2017 by pa3ck 1 Link to comment
TorNix~|nR Posted July 19, 2017 Author Share Posted July 19, 2017 @pa3ck thank you but please can you explain more for me? which line to modify on cMods.lua ? Link to comment
Saml1er Posted July 19, 2017 Share Posted July 19, 2017 Create a new lua file -> Add it to meta.xml and set type to "client" -> add this code: function LoadAllMods () Inter.refresh ( ); -- if player is in vehicle then don't load mods if ( localPlayer:getOccupiedVehicle ( ) ) then outputChatBox ( "Please exit your vehicle before enabling or disabling mods. Retrying in 15 seconds", 255, 255, 0 ); -- retry in 15 seconds by calling the same function again setTimer (LoadAllMods, 15000,1) return false end -- download the mods for i, v in pairs ( Downloader.Mods ) do Mods.SetModEnabled ( i, true ); end Inter.refresh ( ); return true end LoadAllMods () This should load all the mods, you want. If you want specific mods to be loaded then you can check them before loading: local MyMods = { ["someMod1"] = true, ["someMod2"] = true, ["SomeOtherMod"] = true } for i, v in pairs ( Downloader.Mods ) do if MyMods[i] then Mods.SetModEnabled ( i, true ); end end Link to comment
TorNix~|nR Posted July 26, 2017 Author Share Posted July 26, 2017 On 20/07/2017 at 23:41, Saml1er said: Create a new lua file -> Add it to meta.xml and set type to "client" -> add this code: function LoadAllMods () Inter.refresh ( ); -- if player is in vehicle then don't load mods if ( localPlayer:getOccupiedVehicle ( ) ) then outputChatBox ( "Please exit your vehicle before enabling or disabling mods. Retrying in 15 seconds", 255, 255, 0 ); -- retry in 15 seconds by calling the same function again setTimer (LoadAllMods, 15000,1) return false end -- download the mods for i, v in pairs ( Downloader.Mods ) do Mods.SetModEnabled ( i, true ); end Inter.refresh ( ); return true end LoadAllMods () This should load all the mods, you want. If you want specific mods to be loaded then you can check them before loading: local MyMods = { ["someMod1"] = true, ["someMod2"] = true, ["SomeOtherMod"] = true } for i, v in pairs ( Downloader.Mods ) do if MyMods[i] then Mods.SetModEnabled ( i, true ); end end Not work I want when a player login, turn all the mods automatically, that's what I need, a help please? Link to comment
Saml1er Posted July 26, 2017 Share Posted July 26, 2017 Login as admin and execute "/debugscript 3". Run the script again. Also try debugging the code I gave you by adding "outputChatBox ("Some text")" in the newly created lua file. Link to comment
TorNix~|nR Posted July 28, 2017 Author Share Posted July 28, 2017 (edited) I made a one by the command, but I do not know how to make it with for example resourcestart or playerlogin.. help please? addCommandHandler ( "turnmodson", function ( ) if ( not Downloader.gotResponse ) then outputChatBox ( "We're still waiting for the server to accept our request. Please wait", 255, 255, 0 ); return false; end for i, v in pairs ( Downloader.Mods ) do Mods.SetModEnabled ( i, true ); end end ); Edited July 28, 2017 by TorNix~|nR Link to comment
remaked Posted July 29, 2017 Share Posted July 29, 2017 (edited) Add an event handler addEventHandler ( "onPlayerLogin", root, function() if ( not Downloader.gotResponse ) then outputChatBox ( "We're still waiting for the server to accept our request. Please wait", 255, 255, 0 ); return false; end for i, v in pairs ( Downloader.Mods ) do Mods.SetModEnabled ( i, true ); end end ) Edited July 29, 2017 by Remaked Link to comment
TorNix~|nR Posted July 29, 2017 Author Share Posted July 29, 2017 this is a client-side. addCommandHandler ( "turnmodson", function ( ) if ( not Downloader.gotResponse ) then outputChatBox ( "We're still waiting for the server to accept our request. Please wait", 255, 255, 0 ); return false; end for i, v in pairs ( Downloader.Mods ) do Mods.SetModEnabled ( i, true ); end end ); 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