Skip to content

Configuration

Mike Puskar edited this page Dec 29, 2021 · 15 revisions

Configuration

Overview

IPT.Common contains an abstract Configuration class that can be inherited. This provides a simple interface to external INI files. Each desired setting is declared as a public instance member and is automatically loaded via the built-in LoadINI method. The settings can then be referenced using the Value property of each member. You must override the Load method.

Example Configuration

using IPT.Common.User;
using IPT.Common.Settings;

namespace IPT.TestPlugin
{
    internal class Config : Configuration
    {
        public SettingKeyCombo PerformActionKey = new SettingKeyCombo("Hotkeys", "PerformAction", "Performs an action.");
        public SettingInt PedCount = new SettingInt("Peds", "PedCount", "The number of Peds affected by the action.", 3, 0, 5, 1);
        public SettingFloat ActionRange = new SettingFloat("Peds", "ActionRange", "The range affected by the action.", 100f, 10f, 200f, 10f);

        public override void Load()
        {
            this.LoadINI("plugins/LSPDFR/TestPlugin.ini");
        }
    }
}
Clone this wiki locally