Jump to content
Darkmyre

Getting Ped details

Recommended Posts

I'm sure I've seen this in other callouts, but cant for the life of me figure it out. Is there a way somehow to get the particulars of a ped you've spawned, such as name/gender/etc?


My YouTube Channel: Darkmyre Gaming (Australian LSPDFR patrols, plugins in development, and other games)

My Discord Server | AusGamer Network

 

Please do not PM me for technical support or bug reports, use the appropriate forum or plugin's comments instead.

Share this post


Link to post
Share on other sites
On 20/07/2015 at 5:18 AM, Sam said:

Persona Data


Persona pedPersona = API.Functions.GetPersonaForPed(Game.LocalPlayer.Character, null);
Game.DisplayNotification(String.Format("My name is {0} and I am a {1}, born on {2}.", pedPersona.FullName, pedPersona.Gender.ToString().ToLower(), pedPersona.BirthDay.ToShortDateString()));

Used in conjunction with Game.DisplayNotifiction as shown above, This example might produce the following output:


My name is Will Peavey and I am a male, born on 16/01/1991

 

Share this post


Link to post
Share on other sites

Aha, thanks! Couldn't find it as Persona doesnt exist within the api itself, I had to reference LSPD_First_Response.Engine.Scripting.Entities. I've read elsewhere that this is frowned upon and will be removed in future versions, hopefully they'll move Persona to Mod.API at the same time.


My YouTube Channel: Darkmyre Gaming (Australian LSPDFR patrols, plugins in development, and other games)

My Discord Server | AusGamer Network

 

Please do not PM me for technical support or bug reports, use the appropriate forum or plugin's comments instead.

Share this post


Link to post
Share on other sites
1 hour ago, Darkmyre said:

Aha, thanks! Couldn't find it as Persona doesnt exist within the api itself, I had to reference LSPD_First_Response.Engine.Scripting.Entities. I've read elsewhere that this is frowned upon and will be removed in future versions, hopefully they'll move Persona to Mod.API at the same time.

Correct, I would recommend that you avoid using anything that is outside of the Mod.API namespace as it will all eventually be made internal and thus prevent you from accessing it. You'll then have to re-write code for things you're making. It's easier to just not bother for the time being and extend when it's available in the API.

And don't forget to check out the github for common and useful code snippets that have been given to you by the keen developers.
https://github.com/LMSDev/LSPDFR-API


GTA V Mods: [WIP] More Control V [WIP] CalloutsV [WIP] LSPDFR Chroma
GTA IV Mods: [REL] Callouts+

 

Share this post


Link to post
Share on other sites

I'm trying to do 

Persona pedPersona = API.Functions.GetPersonaForPed(Game.LocalPlayer.Character, null);

but I get a squiggly on the API portion. Do I have the wrong reference added or is this obsolete as of the new Rage?

Share this post


Link to post
Share on other sites

Ped human = new Ped(spawn);

 Persona persona = Functions.GetPersonaForPed(human);

try dat.

 

 

7 minutes ago, download500 said:

I'm trying to do 


Persona pedPersona = API.Functions.GetPersonaForPed(Game.LocalPlayer.Character, null);

but I get a squiggly on the API portion. Do I have the wrong reference added or is this obsolete as of the new Rage?

 

Edited by tanu1215

Share this post


Link to post
Share on other sites
12 hours ago, download500 said:

I'm trying to do 


Persona pedPersona = API.Functions.GetPersonaForPed(Game.LocalPlayer.Character, null);

but I get a squiggly on the API portion. Do I have the wrong reference added or is this obsolete as of the new Rage?

Which namespaces have you imported at the top with the using keyword?

Try changing it to LSPD_First_Response.Mod.API, or you can keep it as-is, and insert "using LSPD_First_Response.Mod;" at the top of your class file.

If you hover your mouse over the squiggly line on API (or look at the Error List window), Visual Studio will tell you what's wrong. Either it doesn't know what API is (because LSPD_First_Response.Mod is not imported), or you have two references that both have an API namespace, and it doesn't know which one to use.

Edited by Stealth22

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

Share this post


Link to post
Share on other sites
1 hour ago, tanu1215 said:

@Stealth22 Wait, im personally using  engine.scripting.entities..

Am I supposed to be using something else for personas?

You need that namespace for the Persona class, but you also need to import LSPD_First_Response.Mod in order to access the API.Functions.GetPersonaForPed function.

Either that, or change that line to LSPD_First_Response.Mod.API.Functions.GetPersonaForPed


Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

Share this post


Link to post
Share on other sites
42 minutes ago, Stealth22 said:

You need that namespace for the Persona class, but you also need to import LSPD_First_Response.Mod in order to access the API.Functions.GetPersonaForPed function.

Either that, or change that line to LSPD_First_Response.Mod.API.Functions.GetPersonaForPed

Okay good, just checking.

Share this post


Link to post
Share on other sites

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...