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>