Hi Guys,
Can anyone help with working code to access a private Dictionary firedProjectiles in the BasePlayer class using reflections? I need to get the initialPosition and initialVelocity values of the projectile. I tried to get at least some private data using the code from the link https://oxidemod.org/threads/noobguide-using-reflections-to-access-private-fields-of-an-object-c.28730/, but without success. The code returns an error (NullReferenceException: Object reference not set to an instance of an object).
private object OnPlayerLand(BasePlayer player)
{
PlayerLifeStory lifeStory = typeof(BasePlayer).GetField("lifeStory", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(player) as PlayerLifeStory;
if(lifeStory.secondsAlive< 3)
{
Puts("Player has been alive for more than 3 seconds");
}
return null;
}
Thank you in advance
