Hello, I'm pretty new to C#, LSPSFR and RPH APIs.
I have 2 different problems with my codes.
The first one is that for some reason in the process method, the if statement that checks weaponPickedUp == true is not considering the distance check, so it executes the End() method without me being within 3 meters to NotesCoroner.
The other weird part of it is, it executes the End() method, but I don't have "[Homicide Crime Scene] The coroner took the knife!" in the console, so it's like the if statement is not even passed.
So I don't know what's wrong with this.
Pastebin: https://pastebin.com/JFm9TpgD
The second problem is with my INI code.
I found PNWParksFan's reply in the forum about making an INI file:
I did exactly the same as he said, I created a new class, I called it "Settings", and I added this code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Rage;
using LSPD_First_Response.Mod.API;
namespace Crime_Scene_Callouts
{
internal static class Settings
{
internal static string officerName = "SetYourOfficerNameHere";
internal static void LoadSettings()
{
Game.LogTrivialDebug("Loading Crime Scene Callouts settings...");
string path = "Plugins/LSPDFR/CrimeSceneCallouts.ini";
InitializationFile ini = new InitializationFile(path);
ini.Create();
officerName = ini.ReadString("Player_Settings", "Officer_Name", "SetYourOfficerNameHere");
}
}
}
I also have Settings.LoadSettings(); in the Initialize() Method.
The problem is that I can't use the "officerName" variable in other methods/files.
It simply says that it does not exist in the current context.
Game.DisplaySubtitle("~o~Coroner: ~w~Hello, Officer " + officerName + ".");
Then I tried:
Game.DisplaySubtitle("~o~Coroner: ~w~Hello, Officer " + Settings.officerName + ".");
But now it shows "SetYourOfficerNameHere" no matter what I type in the .INI file.
This is how my INI file looks like:
[Player Settings]
//Change "SetYourOfficerNameHere" to set your name.
OfficerName=Adir
What should I do to make officerName accessible?
Thanks in advance.