Jump to content

Download


Recommended Posts

Posted (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 by pa3ck
  • Like 1
Posted

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 

 

Posted
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?

Posted

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.

Posted (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 by TorNix~|nR
Posted (edited)

Add an event handler

 

  1. addEventHandler ( "onPlayerLogin", root,
  2. function()
  3. if ( not Downloader.gotResponse ) then
  4. outputChatBox ( "We're still waiting for the server to accept our request. Please wait", 255, 255, 0 );
  5. return false;
  6. end
  7.  
  8. for i, v in pairs ( Downloader.Mods ) do
  9. Mods.SetModEnabled ( i, true );
  10. end
  11. end 
  12. )
Edited by Remaked
Posted

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 );

 

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...