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.

Make Ped shoot out of vehicle at closest hated target

Featured Replies

Hey, for a callout I a working on, I need something like the standard Pursuit of Armed Suspects, where (I assume) only the driver is added to the pursuit and the passengers are shooting at every cop they see.

The problem is, I can't find out how to make someone shoot out of a vehicle without leaving it first. Do you have any ideas?

  • Author
17 minutes ago, epicmrjuan said:

Maybe Tasks.FireWeaponAt

I tried that, didn't work, but thank you!

Any other suggestions? I'm out of ideas here and I'm sure there is a way!

Edited by Vaskulis

  • Author
1 hour ago, epicmrjuan said:

Maybe Tasks.FireWeaponAt

 

I found the solution! It's the native called "SET_PED_COMBAT_ATTRIBUTES".

You have to manually allow the ped to use vehicles (i.e. shoot out of them) in combat and that also means, apparently, that they will stay in the vehicle as long as it has a driver. Exactly what I was looking for.

13 hours ago, Vaskulis said:

 

I found the solution! It's the native called "SET_PED_COMBAT_ATTRIBUTES".

You have to manually allow the ped to use vehicles (i.e. shoot out of them) in combat and that also means, apparently, that they will stay in the vehicle as long as it has a driver. Exactly what I was looking for.

 

Can you please give me the exact line of code you used for this (Learning developer)

  • Author
6 hours ago, BlockBa5her said:

Can you please give me the exact line of code you used for this (Learning developer)

 

Well, you would first have to understand how to use natives. There is a very good example on how to do that in the official examples you can download on the RPH website.

Natives are basically functions the game has, but which are not yet per se implemented in RPH so you need to call them directly. You can find a list of all known natives in the NativeDB. Then, when you understand that, what you would need is basically:

using Rage;
using Rage.Native;

and then, in your plugin:

var myped1 = new Ped(Vector3.Zero);
var myped2 = new Ped(Vector3.Zero);
var mycar = new Vehicle("ORACLE2", Game.LocalPlayer.Character.GetOffsetPositionFront(3f);
myped1.WarpIntoVehicle(mycar, -1) //Driver's seat
myped2.WarpintoVehicle(mycar, 0)//Passenger's seat

//Now comes the interesting part:

NativeFunction.Natives.SetPedCombatAttributes(myped2, 1, true);

//This allows him to stay in the vehicle while in combat, and he will do so as long as the vehicle has a non-dead driver
//If you don't want him to leave the vehicle at all, you can do that as well with SetPedCombatAttributes, 
//look in the NativeDB to find out how.
//Now we make him fight the player:

myped2.Tasks.FightAgainst(Game.LocalPlayer.Character);

Hint: If you want him to attack all cops on sight, use RelationshipGroups (look at the examples). All cops have the RelationshipGroup "COP" per default.

Edited by Vaskulis

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.