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.

Stopping Cops from targeting a Ped

Featured Replies

So I'm trying to work on a Partner plugin, however no matter what I try, I cannot get around one fatal flaw: As soon as the partner ped starts shooting near other cops, they all turn on him en-masse and slaughter him. I've set him to his own RelationshipGroup and obtained the hash for that, and am then trying to set his relations with both the player (to stop him slaughtering the player) and other police - the player relations seem to be working fine, however the cops still hate the poor guy. I've included the relevant code below, in case anyone can shed some light on wtf is going on:

Partner.partner = new Ped("mp_m_freemode_01", Game.LocalPlayer.Character.Position.Around(3f), );
Partner.partner.RelationshipGroup = "PARTNER";
Game.DisplayHelp(Partner.partner.RelationshipGroup.Hash.ToString()); // returns 169451935
NativeFunction.CallByName<uint>("SET_RELATIONSHIP_BETWEEN_GROUPS", 1, 1862763509, 169451935); //player->partner
NativeFunction.CallByName<uint>("SET_RELATIONSHIP_BETWEEN_GROUPS", 1, 169451935, 1862763509); // partner->player
NativeFunction.CallByName<uint>("SET_RELATIONSHIP_BETWEEN_GROUPS", 1, 4208871491, 169451935); //cop->partner
NativeFunction.CallByName<uint>("SET_RELATIONSHIP_BETWEEN_GROUPS", 1, 169451935, 4208871491); // partner->cop
                        
Partner.partner.CanAttackFriendlies = false;
Partner.partner.CanBeTargetted = false;

 

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.

There's any reason to why you're using the natives? You can use Game.SetRelationshipBetweenRelationshipGroups(), with this you don't need to know the hash of each group or the index of the relationships types.
Some time ago I also have this relationships problem wth preventing cops from shooting some normal peds, I solved it by using Relationship.Companion, or index 0 if you continue to use the native.

Example:
Game.SetRelationshipBetweenRelationshipGroups("COP", "MYGROUP", Relationship.Companion);

 

You can try what Albo said too, that should work.

Edited by alexguirre

  • Author
52 minutes ago, Albo1125 said:

Functions.SetPedAsCop(Partner); should do the trick.

I should've mentioned I did try this, but then LSPDFR likes to take over the Ped (part of the reason I'm using the freemode model instead of a cop model)

42 minutes ago, alexguirre said:

There's any reason to why you're using the natives? You can use Game.SetRelationshipBetweenRelationshipGroups(), with this you don't need to know the hash of each group or the index of the relationships types.
Some time ago I also have this relationships problem wth preventing cops from shooting some normal peds, I solved it by using Relationship.Companion, or index 0 if you continue to use the native.

Example:
Game.SetRelationshipBetweenRelationshipGroups("COP", "MYGROUP", Relationship.Companion);

 

You can try what Albo said too, that should work.

Only reason I used natives was I didn't know there was another way lol For some reason I seem to default to checking natives rather than poking about the Object Browser.

Will give Companion a try and see if that helps, thanks guys :D

Edit: Changing the relation to Companion worked perfectly, thanks again Alex!

Edited by Darkmyre

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.

25 minutes ago, Darkmyre said:

I should've mentioned I did try this, but then LSPDFR likes to take over the Ped (part of the reason I'm using the freemode model instead of a cop model)

Only reason I used natives was I didn't know there was another way lol For some reason I seem to default to checking natives rather than poking about the Object Browser.

Will give Companion a try and see if that helps, thanks guys :D

Edit: Changing the relation to Companion worked perfectly, thanks again Alex!

Great!

On a side note, there's a Functions.SetCopAsBusy() that should prevent LSPDFR from taking it over.

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.