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.

Detecting what type of ped I get from an array

Featured Replies

Hi guys!

I want to pull a specific ped from an array (like detect nearby cops or specific peds [like a s_m_y_cop_01]) but I'm not sure how to do that using rage or natives.  Any ideas/help?

Specifically, I'd like to include them so I can use them in my code later (like take a nearby cop and force him to do what I want).

Thanks!

Edit: Note the array I'm talking about is "Ped[] GetNearbyPeds()"

Edited by fiskey111
defined my array

 

 

You should look up LINQ queries for c#.

Without LINQ you'd have to manually iterate through the array and conditionally select the desired ped. With LINQ you deal with streams so you can intelligently filter your list.

You can also convert your Ped array into a List<Ped>

You get the model of the ped by checking ped.Model when performing the LINQ query

List<Ped> PedsWithSpecificModel = (from x in Game.LocalPlayer.Character.GetNearbyPeds(16) where x.Model.Name.ToUpper() == "S_M_Y_COP_01" select x).ToList<Ped>();

Also make sure you have a using System.Linq; statement at the top (should be default).

 

My YouTube: Click here. 

My Discord Server - https://discord.gg/0taiZvBSiw5qGAXU

Useful post? Let me and others know by clicking the Like button.
Check out my many script modifications! 
Having issues? LSPDFR Troubleshooter by Albo1125.

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.