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.

Functions.GetPersonaForPed(ped) causing a NullReferenceExcpetion

Featured Replies

I'm using the following code to create a Ped Persona for one of the peds within a new callout I'm developing:

 

subjectPersona = LSPDFR.GetPersonaForPed(subject); // where LSPDFR is a using directive to the Functions class.

 

However, this appears to be creating a NullReferenceException for no particular reason, as far as I can see. I have verified that the subject Ped instance is not null, and have ensured it is valid before this call is made.

 

[1/10/2023 8:33:28 PM.652] LSPD First Response: ==============================
[1/10/2023 8:33:28 PM.653] LSPD First Response: UNHANDLED EXCEPTION DURING GAME FIBER TICK
[1/10/2023 8:33:28 PM.654] LSPD First Response: ------------------------------
[1/10/2023 8:33:28 PM.655] LSPD First Response: Origin: Game fiber "<UNNAMED THREAD>".
[1/10/2023 8:33:28 PM.655] LSPD First Response: ------------------------------
[1/10/2023 8:33:28 PM.656] LSPD First Response: Exception type: System.NullReferenceException
[1/10/2023 8:33:28 PM.656] LSPD First Response: Exception message: Object reference not set to an instance of an object.
[1/10/2023 8:33:28 PM.657] LSPD First Response: ------------------------------
[1/10/2023 8:33:28 PM.657] LSPD First Response: Inner exceptions:
[1/10/2023 8:33:28 PM.658] LSPD First Response: ------------------------------
[1/10/2023 8:33:28 PM.659] LSPD First Response: Stack trace:
[1/10/2023 8:33:28 PM.659] LSPD First Response: at oHDdIriQcLVuwugmjFOZzQTfTAKqA.oNfhzRJQeuKYnsmpOIvisxPFlIhC(Ped ) in D:\GTA V\LSPD First Response\LSPD First Response\Engine\Scripting\Entities\CPedCache.cs:line 18
[1/10/2023 8:33:28 PM.660] at LSPD_First_Response.Mod.API.Functions.GetPersonaForPed(Ped ped) in D:\GTA V\LSPD First Response\LSPD First Response\Mod\API\Functions.cs:line 926
[1/10/2023 8:33:28 PM.661] at Section136Callouts.Callouts.ConcernForWelfare.<OnCalloutAccepted>b__15_0() in C:\Users\maxpl\source\repos\section136callouts\Section136Callouts\Callouts\ConcernForWelfare.cs:line 242
[1/10/2023 8:33:28 PM.661] at Rage.GameFiber.Main()
[1/10/2023 8:33:28 PM.662] LSPD First Response: ==============================

 

ConcernForWelfare.cs:242 contains only the snippet I've pasted above.

 

To be clear:

- I'm looking for this function to create a persona for the ped if one does not already exist. As far as I am ware, Persona.FromExistingPed(ped) is deprecated, but does also have the same outcome.

 

 

Any tips/help would be appreciated!
Cheers,

Max

 

Max Playle | (Retired-ish) Plugin Developer

🚓 Developer of Section136Callouts, using real-life policing knowledge!

📨 Please don't send me unsolicited DMs! It's quite irritating, please instead tag me in a message on my Discord Server

🙋🏻‍♂️ Here's a list of questions I am often asked. Please check them out here before asking me something! Thank you.

🦸‍♀️ Want early access, test builds and access to concept features as they're built in my plugin? Join my Early Access Club on Patreon today!

  • Management Team

Are you sure it is valid the same tick you are requesting the persona? Also, how is the function that does this invoked? It looks like it is some kind of anonymous function.

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

I cant help im afraid
But i have to ask where this

On 1/10/2023 at 9:40 PM, thatmaxplayle said:
LSPDFR.GetPersonaForPed(subject)

 

comes from?
Neither docs.ragepluginhook.net/  or Natives has this "GetPersonaForPed" method. What is the API you are using?
Is there a page for this LSPDFR API ?
I have only used RAGE and Natives in my programs, so if one more exists, i would really like to dig into that

 

For your issue I would look into what

LSPDFR.GetPersonaForPed(subject)

Actually contain, is it by chance a null-reference ?
Try dumping it into log and see what comes out

 

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

  • Management Team
14 minutes ago, GTAbear said:

I cant help im afraid
But i have to ask where this

 

comes from?

 

He is using a type alias where LSPDFR is LSPD_First_Response.Mod.API.Functions.

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

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.