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.

[SOLVED] Random ped gender

Featured Replies

I know this is the way to spawn a random ped.
private Ped ped
ped = new Ped();

Is there a simple way to specify the gender of the random ped? 

I would like to spawn just male  or female peds at different times, but not limit them to a string that I would have to create.

 

Hope that makes sense.

Thanks in advance.

 

 

Edited by Radsel

As far as I'm aware the way to achieve that would be generating the ped in a loop which checks their gender, and if it is the desired gender then proceed, but if not then generate a new ped and check again.

 

Edit: Something like this should work

suspect = new Ped(spawnPoint);
while (suspect.IsMale)
{
  suspect.Delete();
  suspect = new Ped(spawnPoint);
}

 

Edited by SneakySteve
Adding code snippet

Everyone wants happiness, no one wants pain. But you can't have a rainbow, without a little rain.

  • Author

Thank you. I will give that a try. 

In the mean time, I just wrote a string with 10 different male ped models in it. Kind of messy, but it does work.

I'll share what I did later. Not at that computer ATM.

 

Thanks again, and thanks for all your contributions here. I couldn't of done any of this without your guide.

 

  • 2 weeks later...
  • Author

 

I figured it out.

used 

if (!Sup.IsMale)

      {

       Main code here for female peds

       }

 

else

     {

     Main code here for male peds

     }

 

 

 

 

Also, any advice on how to get these peds to do random day to day things?  They just stand there.

Tnx

 

Spoiler

 

 

 

           

 

Edited by Radsel

  • The title was changed to [SOLVED] Random ped gender
  • Author

Thanks all for the help.

I did discover their are two useful things for what I was trying to do:

 

spawn random ped

 

If (Ped.ismale)

{code for male here}

 

and 

 

if(Ped.isfemale)

{code for female here}

 

works great

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.