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.

2 Questions - Code problem and INI

Featured Replies

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.

Edited by AdirB

  • Author

I another problem with the INI.

The PlayScannerAudio() function won't read the division number, unit and beat number from the INI file.

For example, when I do

Functions.PlayScannerAudio("COPY_THAT" + Settings.Division + Settings.Unit + Settings.Beat);

It will only play the COPY_THAT file.

This is how I set the numbers in the INI file:

        internal static string Division = "13";
        internal static string Unit = "XRAY";
        internal static string Beat = "13";
----
        Division = ini.ReadString("Player Settings", "Division", "13");
        Unit = ini.ReadString("Player Settings", "Unit", "XRAY");
        Beat = ini.ReadString("Player Settings", "Beat", "13");

 

var yourString = "COPY_THAT" + Settings.Division + Settings.Unit + Settings.Beat;

if(yourString == "COPY_THAT13XRAY13")
{
  throw new Exception("You need to put spaces between the names of audio clips to play");
}

Also, make sure the files you want to play are located in proper \Audio\ folder.

Edited by LtFlash

  • Author
On 7/21/2017 at 4:40 PM, LtFlash said:

var yourString = "COPY_THAT" + Settings.Division + Settings.Unit + Settings.Beat;

if(yourString == "COPY_THAT13XRAY13")
{
  throw new Exception("You need to put spaces between the names of audio clips to play");
}

Also, make sure the files you want to play are located in proper \Audio\ folder.

Hi, thanks for your answer.

Can you please explain how this works?

"COPY_THAT13XRAY13", do I need to do that on every code, like COPY_THAT1ADAM15?

1. Check the folder Grand Theft Auto V\lspdfr\Police Scanner\ for filenames you can use.

2. Use that with Functions.PlayScannerAudio(string) but remember to separate filenames with spaces, eg.

 

Functions.PlayScannerAudio("REPORT_RESPONSE_COPY_04" + " " + "OUTRO_02");

 

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.