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.

Method forcing Ped to stay in seat of car?

Featured Replies

Spoiler

 

I am attempting to make a  functionality where an arrested ped can be transported in a policecar.
I have the ped entering the car and sitting in the correct seat index, but imediately the ped steps out of the car again.

Ped entering the car code:

//open left backdoor for purp transport
                    if (Game.IsKeyDown(System.Windows.Forms.Keys.K))
                    {
                        NativeFunction.Natives.SetVehicleDoorOpen(EmergencyVehicle, 2, false, true);
                       

                       
                        Ped[] suspectGroup = Game.LocalPlayer.Character.GetNearbyPeds(1);
                        Ped arrestee = suspectGroup[0];//Arrested Ped
                        if (arrestee != null)
                        {
                            //NativeFunction.Natives.TaskWarpPedIntoVehicle(arrestee, EmergencyVehicle, 2); Thiss works but it looks ugly
                            NativeFunction.Natives.SetPedIntoVehicle(arrestee, EmergencyVehicle, 2);//more gracefull entering


I have then attempted to keep the Ped in by

                            //NativeFunction.Natives.SetPedVehicleForcedSeatUsage(arrestee, EmergencyVehicle, 2, true); //No effect!

Shutting the door, does not work, the Ped opens it and leave the car

Any tips on how to make a Ped stay inside the car ?

                     

 

That 'spoiler' thing 👎

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

Why do you use Natives when you can use Rage internal functions?

 

Ped.Tasks.EnterVehicle(...)

(Or similar to this, I'm on phobe rn and cant check)

 

If you've done this the Ped should stay inside the vehicle unless you told them anywhere else to follow you. But this isn't visible in the code you posted

  • Author
8 hours ago, RicyVasco said:

Why do you use Natives when you can use Rage internal functions?

 

Ped.Tasks.EnterVehicle(...)

(Or similar to this, I'm on phobe rn and cant check)

 

If you've done this the Ped should stay inside the vehicle unless you told them anywhere else to follow you. But this isn't visible in the code you posted

Thanks for pointing me in that direction! I had NO idea that there was Rage internal functions. I have a reference for GTAV:
https://docs.fivem.net/natives/?_0xAC6E290D

Witch is the only documentation/ reference i have found
I would love to see a reference for RAGE's internal functions!
Do you know a link to one

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

8 minutes ago, GTAbear said:

Thanks for pointing me in that direction! I had NO idea that there was Rage internal functions. I have a reference for GTAV:
https://docs.fivem.net/natives/?_0xAC6E290D

Witch is the only documentation/ reference i have found
I would love to see a reference for RAGE's internal functions!
Do you know a link to one

You can find it here https://docs.ragepluginhook.net/

  • Author
On 9/11/2022 at 7:31 PM, RicyVasco said:

You can find it here https://docs.ragepluginhook.net/

Thats very useful, even though there are no search function!
Thanks a lot! Ricy

Btw, the Ped did exactly the same :p, but was 'freezable' with the method
.BlockPermanentEvents = true;
Now guess who will not get out of the car 🤣
Nae, i know how to fix that. I have to use two keys, one for getting in and one for getting out, i had hoped for a state-machine controlled with only one key, but if the clear path to the door is blocked, the 'get-in' cmd has to be given several times (one for each obstacle) so a toggle-bool is unhandy.
Thanks again for your help!

--------edit:

No -Hostile Peds do not stay in the car. They jump in, but then they are re-stated as Hostile (Relationship-group-wise) and they will jump out of the car.
I have tried changing the relationship to Neutral, and even Friendly, but that state is 'over-ruled' by something in main game-loop
The code that does not work:

Spoiler

                        if (arrestee != null)//Ped must exists
                        {
                            arrestee.BlockPermanentEvents = true;//stop all evachive actions
                            arrestee.Tasks.EnterVehicle(EmergencyVehicle, 0);
                            arrestee.IsInVehicle(EmergencyVehicle, true);
                            arrestee.BlockPermanentEvents = true;//stop all evasive actions
                            arrestee.RelationshipGroup = "caught";
                            Game.LocalPlayer.Character.RelationshipGroup = "catcher";
                            Game.SetRelationshipBetweenRelationshipGroups("caught", "catcher", Relationship.Neutral);
                            arrestee.BlockPermanentEvents = true;                          
                        }

 

 

Edited by GTAbear
added update

See my plugin here:
https://www.youtube.com/watch?v=peqSXuTfIyY

Let me know if you find it interesting.
Best Regards.

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.