Skip to content

v1.0.7

Compare
Choose a tag to compare
@partiusfabaa partiusfabaa released this 21 Dec 17:19
· 297 commits to main since this release

Added a new function that creates a config. Example of use:

using CounterStrikeSharp.API.Core;
using Modularity;
using VipCoreApi;

namespace TestConfig;

public class TestConfig: BasePlugin, IModulePlugin
{
    public override string ModuleName { get; }
    public override string ModuleVersion { get; }

    private IVipCoreApi _api;
    private TestConfig config;
    
    public void LoadModule(IApiProvider provider)
    {
        _api = provider.Get<IVipCoreApi>();
        
        //Write the title without the .json
        config = _api.LoadConfig<TestConfig>("name_config"); // You can also specify the path with the 2nd argument, but it is not necessary. By default the path to modules will be
    }
}

public class TestConfig
{
    public int Test1 { get; set; } = 50;
    public bool Test2 { get; set; } = true;
    public string Test3 { get; set; } = "TEST";
    public float Test4 { get; set; } = 30.0f;
}