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.

C# - Callout - ReadFromNode

Featured Replies

		 public override bool OnBeforeCalloutDisplayed()
        {

            Game.DisplayNotification($"Test value is {ReadFromNode(@"C:\\Program Files(x86)\\Steam\\steamapps\\common\\Grand Theft Auto V\\plugins\\LSPDFR\\CivilianCallouts\\Places\\Amount.xml" , "/Amount/")}");


            return base.OnBeforeCalloutDisplayed();
        }
		
		public static string ReadFromNode(string file, string node)
        {
            return SelectNodeFromXml(file, node).InnerText;
        }

        private static XmlNode SelectNodeFromXml(string filePath, string node)
        {
            if (!File.Exists(filePath)) throw new FileNotFoundException($"{nameof(SelectNodeFromXml)}(): specified file does not exist: {filePath}");

            using (TextReader reader = new StreamReader(filePath))
            {
                var doc = new XmlDocument();
                doc.Load(reader);
                return doc.SelectSingleNode(node);
            }
        }

Hey guys I want my Callout Plugin to get a variable from an xml node

here is my current code:

 

But i get this error:

[4/8/2021 5:09:42 PM.172] LSPD First Response: [FATAL] OnBeforeCalloutDisplayed crashed: System.IO.FileNotFoundException: SelectNodeFromXml(): specified file does not exist: C:\Program Files(x86)\Steam\steamapps\common\Grand Theft Auto V\plugins\LSPDFR\CivilianCallouts\Places\Amount.xml

 

Does anyone know how i shoud refer to the game path a smoother way, or did I make another mistake?

Thanks

 

 

<?xml version="1.0" encoding="utf-8" ?> 

<Amount>
	2
</Amount>

 

  • Author

PARTLY SOLVED: 

 

I got it to work like this : ReadFromNode(@"C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\plugins\LSPDFR\CivilianCallouts\Places\Amount.xml", "/Amount")

 

But still this Game Path will only work on my Pc. How do I always refer to the Gamepath Folder?

  • Management Team

A path that contains \ needs to be escaped since \ is a special character. The @ does this and so does using \\. If you want to use a relative path, you can combine it with the current directory, such as Path.Combine(Environment.CurrentDirectory, @"plugins\LSPDFR\CivilianCallouts\Places\Amount.xml").

Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

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...

Similar Content

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.