Jump to content

Checking if vehicle is stopped


Delco24

Recommended Posts

I want to be able to detect if a vehicle is currently stopped after the player initiates a pullover. I know you can use IsPlayerPerformingPullover(), but that returns true even if the suspect's vehicle hasn't stopped yet. I tried detecting the suspect ped and checking if they are stopped using:

LHandle pullover = Functions.GetCurrentPullover();
Ped suspect = Functions.GetPulloverSuspect(pullover);
if (Functions.IsPedStoppedByPlayer(suspect))

But, this only seems to return true if you pull the suspect out of the vehicle.

How can you check if the vehicle has stopped?

Thanks

Link to comment
Share on other sites

I would guess that IsPlayerPerformingPullover returns false once the vehicle stops? I'm not 100% sure though. 

You can always read Vehicle.Speed and check if it's 0, although that will be 0 if the vehicle stops and then starts going again while trying to find a spot to pull over, so it may not be ideal. 

[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Link to comment
Share on other sites

1 hour ago, PNWParksFan said:

I would guess that IsPlayerPerformingPullover returns false once the vehicle stops? I'm not 100% sure though. 

You can always read Vehicle.Speed and check if it's 0, although that will be 0 if the vehicle stops and then starts going again while trying to find a spot to pull over, so it may not be ideal. 

Unfortunately, IsPlayerPerformingPullover appears to keep returning true even once the vehicle stops.

I was playing around with trying to check the vehicle's speed, but I'm not getting ANY value for the vehicle speed once it stops. For testing, I had the speed getting logged repeatedly, but once it stopped, there were no further speed values reported. Even if I had the vehicle move elsewhere to find a better spot to pullover, the speed was no longer reported. I am completely new to coding with the Rage plugin and LSPDFR API so may have been doing something wrong, though.

EDIT: OK, I got the checking vehicle speed method to work. But, like you said, its not ideal because the vehicle may not be in its final location (such as if you initiated the pull over at a stop light). Any other suggestions?

Edited by Delco24
Link to comment
Share on other sites

Maybe detect when the officer first steps out of his vehicle? 

Stealth22
LSPDFR Tester | Plugin Developer
My Plugins: Code 3 Callouts | Traffic Control | Keep Calm | ALPR+

Please do not PM me for any kind of technical support.
I unfortunately do not have enough free time to answer every PM that I get. For issues with my plugins, please post in the comments section of the file, or it's forum thread. You'll get a much quicker response from me there than if you send me a PM; I do my best to respond to every question in the comments sections. For API/programming questions, please post them in the API Development forum, so all developers can benefit from the answer as well. Thanks!

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...