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.

INI help!

Featured Replies

So, I've seen the github and the previous post about inis, and I made one.  However, I'm not sure where to put my code since my callouts won't recognize it.  This is my code: 

namespace INI
{
    public class EntryPoint
    {
        public static InitializationFile initializeFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/SecondaryCallouts.ini");
            ini.Create();
            return ini;
        }
        public static String getVehicleType()
        {
            InitializationFile ini = initializeFile();
            string VehicleType = ini.ReadString("Vehicle", "VehicleType", "Police3");
            return VehicleType;
        }
    }
}

Do I put this in the "Secondary Callouts" namespace, make my own above it (like code above), or do I put it under Main?  I've tried all three but I can't get it to work.  This is what I used to try to fetch the ini option:

 myCopCar = new Vehicle("" + VehicleType + ".", SpawnPoint, 0f);

and it won't register the vehicle type stated by the ini.  Any help?

Thanks!

 

 

 

39 minutes ago, fiskey111 said:

So, I've seen the github and the previous post about inis, and I made one.  However, I'm not sure where to put my code since my callouts won't recognize it.  This is my code: 

namespace INI
{
    public class EntryPoint
    {
        public static InitializationFile initializeFile()
        {
            InitializationFile ini = new InitializationFile("Plugins/LSPDFR/SecondaryCallouts.ini");
            ini.Create();
            return ini;
        }
        public static String getVehicleType()
        {
            InitializationFile ini = initializeFile();
            string VehicleType = ini.ReadString("Vehicle", "VehicleType", "Police3");
            return VehicleType;
        }
    }
}

Do I put this in the "Secondary Callouts" namespace, make my own above it (like code above), or do I put it under Main?  I've tried all three but I can't get it to work.  This is what I used to try to fetch the ini option:

 myCopCar = new Vehicle("" + VehicleType + ".", SpawnPoint, 0f);

and it won't register the vehicle type stated by the ini.  Any help?

Thanks!

 

to be honest I don't use the ragehook defined ini class I use my own that is built off of the windows kernel's own ability to create/read/write ini files

My plugins by me are on this site in addition to my own site as well.

Do Not PM Me for Support! follow the instructions for getting support with any mods. 

What I do is create a static class named Settings(or whatever you want to name it) and there have a static field with the InitializationFile and static properties with the settings:

Example:

namespace SecondaryCallouts
{
    	using Rage;
    	using System.Windows.Forms;

	public static class Settings
	{
	    public static InitializationFile INIFile = new InitializationFile(@"Plugins\INIFileName.ini");
	    
	    public static Keys Key1 { get { return Settings.INIFile.ReadEnum<Keys>("Keys", "Key1", Keys.Y); } }
	}
}

Then in other parts of your code you can call your settings like this:

        Settings.Key1

Edited by alexguirre

  • Author
1 hour ago, alexguirre said:

What I do is create a static class named Settings(or whatever you want to name it) and there have a static field with the InitializationFile and static properties with the settings:

Example:


namespace SecondaryCallouts
{
    	using Rage;
    	using System.Windows.Forms;

	public static class Settings
	{
	    public static InitializationFile INIFile = new InitializationFile(@"Plugins\INIFileName.ini");
	    
	    public static Keys Key1 { get { return Settings.INIFile.ReadEnum<Keys>("Keys", "Key1", Keys.Y); } }
	}
}

Then in other parts of your code you can call your settings like this:

        Settings.Key1

The issue is that I don't need a key, I'm looking for a vehicle.  I tried using that, but I'm getting the error "Cannot implicitly convert type 'String' to 'Rage.Vehicle'"

public static Vehicle VehicleType { get { return Settings.INIFile.ReadEnum<String>("Vehicles", "VehicleType", "Police3"); } } (that's my code for the error)

How do I convert from a string to a vehicle?

Thanks for you help!

 

 

4 minutes ago, fiskey111 said:

The issue is that I don't need a key, I'm looking for a vehicle.  I tried using that, but I'm getting the error "Cannot implicitly convert type 'String' to 'Rage.Vehicle'"

public static Vehicle VehicleType { get { return Settings.INIFile.ReadEnum<String>("Vehicles", "VehicleType", "Police3"); } } (that's my code for the error)

How do I convert from a string to a vehicle?

Thanks for you help!

What you need is the model.

Example:

 

public static Model VehModel { get { return Settings.INIFile.ReadString("General", "Vehicle Model", "police3"); } }

Edited by alexguirre

  • Author
On 12/29/2015 at 2:30 PM, alexguirre said:

What you need is the model.

Example:

 


public static Model VehModel { get { return Settings.INIFile.ReadString("General", "Vehicle Model", "police3"); } }

Just another quick question.  I got approval from Stealth33 to use the Beats/Units/Areas in my callout pack, but I'm having some trouble figuring out how to set it up in the ini.  I'd like to use that above method, but what do I use in place of "Model"?   I've tried searching for the correct term but I've come up empty handed!  It's no big deal, I'll survive without it, but it would be nice to have!

Thanks anyone!

 

 

42 minutes ago, fiskey111 said:

Just another quick question.  I got approval from Stealth33 to use the Beats/Units/Areas in my callout pack, but I'm having some trouble figuring out how to set it up in the ini.  I'd like to use that above method, but what do I use in place of "Model"?   I've tried searching for the correct term but I've come up empty handed!  It's no big deal, I'll survive without it, but it would be nice to have!

Thanks anyone!

I don't know how Stealth does it but I will go for string.

I built a class of Enums for every audio file. But string will work just as well. 

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

  • Author
2 hours ago, alexguirre said:

I don't know how Stealth does it but I will go for string.

Thank you, that worked! I thought I had tried that, but I guess I either did it wrong or am going crazy!

 

1 hour ago, Stealth22 said:

I built a class of Enums for every audio file. But string will work just as well. 

Thank you, it worked as string so I'm going to leave it be so I don't screw it up, haha!

 

 

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.