Skip to content
View in the app

A better way to browse. Learn more.

LCPDFR.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PSA To Devs: You do not need ini parser with RPH!

Featured Replies

  • Community Team

I'm seeing a new trend of plugins including ini parser to manage their config files. Thing is, RPH has it's own system to handle this. Using ini parser is absolutely not needed.
If you are one of those devs reading this, I will show how you can use RPH's system instead.

First, make a simple static file such as Settings.cs in your project. In this settings file you will manage everything to do with the config, and it's pretty darn simple.
I personally suggest making it static because in my own personal use case I find it better to never be instantiated. Inside this class:

 

 

  1. Simply make a bunch of public/internal declarations for the values you want.
  2. Create a LoadSettings() and optionally a SaveSettings() method.
  3. Initialize the ini file. You want to use its path. Most common is in the same path as the dll. (This requires the Rage import!) Example: 
    JxlnV2n.png
  4. Assign the values and set the defaults. You can use IntelliSense to see what is what in the ini.* Example:
    lDJKLJ1.png

    First string is the section name, and the second is the key name. You can have multiple keys per section. Example:
    jr7ycqx.png

    The third option is the default value. This is important because if the file is missing, or broken it will use the default value.

 

That's it for reading an ini file. All you do now is run the LoadSettings() in your main class when the plugin is loaded and it will set all of the variables to their corresponding ini value. Since the class is static, and the values are internal or public you can access them anywhere in your plugin and the value will always be correct.

You can optionally edit an ini file. It's pretty much the same. You initialize the file, then you write instead of read. Here is how it can look:
BUeWAT0.png

In this case, you can actually set those values you made in the Settings.cs and when you run the method, it will save them to the ini file. It's the exact same as reading the ini except in reverse.

Here is how the important parts of my settings file look:
HRwbWT5.png

That's it! Now we load the ini at startup by running your new load method. My example:
cGVCIOI.png

And now those settings are loaded! Keep in mind you can run this method at anytime, so if you have a button or console command to reload the config, you can! It works live.
Here is how you can access the setting in your code:
Ywj9HVW.png
 

Edited by SuperPyroManiac

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.