Jump to content
download500

How to dismiss nearest cop?

Recommended Posts

Ideally I'd like to have a way to auto dismiss all the cops, but until I re-write my code I was hoping for a temporary way to just dismiss the nearest cop to me.

My plugin currently will spawn a cop to drive to your location and he will stand there with the door open forever.

I do this mainly for backup and traffic control purposes.

What's a code I can use to get and then dismiss the nearest cop to me, and have him get in the nearest police vehicle to him, and drive away?

Share this post


Link to post
Share on other sites
1 hour ago, download500 said:

My plugin currently will spawn a cop to drive to your location and he will stand there with the door open forever.

 

 

That means you spawned the cop yourself, so you should be able to do it this way.

If not, you can use Game.LocalPlayer.Character.GetNearbyPeds(), loop over the array until ped.RelationShipGroup=="COP" and then take control over that cop.

Share this post


Link to post
Share on other sites
2 hours ago, download500 said:

That single snip of code dismisses the nearest cop?  Or just a ped object that I've explicitly named cop? 

A ped object named cop. But you can loop through all of the nearby peds who are cops, just like Albo posted above.

Share this post


Link to post
Share on other sites

I created a plugin that has various cleanup options, useful for when LSPDFR crashes mid-pursuit or if a callout is a bit buggy resulting in some peds just standing around forever. It can do the following: 

  • Dismiss all peds in game
  • Dismiss all vehicles in game
  • Remove all blips from map
  • Delete all vehicles (option to delete only police vehicles and/or only occupied vehicles)

It works fairly well, although for some reason the "remove all blips" needs to be re-run a few times to clear all the blips, so I'm still working on fixing that before I upload the plugin.

Share this post


Link to post
Share on other sites
6 minutes ago, PNWParksFan said:

I created a plugin that has various cleanup options, useful for when LSPDFR crashes mid-pursuit or if a callout is a bit buggy resulting in some peds just standing around forever. It can do the following: 

  • Dismiss all peds in game
  • Dismiss all vehicles in game
  • Remove all blips from map
  • Delete all vehicles (option to delete only police vehicles and/or only occupied vehicles)

It works fairly well, although for some reason the "remove all blips" needs to be re-run a few times to clear all the blips, so I'm still working on fixing that before I upload the plugin.

This! This! This! Yes please! :D The last days i often have the problem that sometimes arrested peds in the cells at mission row stay on the map as a fat red dot/blip. Then after a couple of minutes this big fat red blip starts to jump every few seconds over the map. It is not harming the game at all but for me it is irretating and annoying as ****. I try to ignore it but then i mostly end up with a game restart.

Share this post


Link to post
Share on other sites
32 minutes ago, PNWParksFan said:

I created a plugin that has various cleanup options, useful for when LSPDFR crashes mid-pursuit or if a callout is a bit buggy resulting in some peds just standing around forever. It can do the following: 

  • Dismiss all peds in game
  • Dismiss all vehicles in game
  • Remove all blips from map
  • Delete all vehicles (option to delete only police vehicles and/or only occupied vehicles)

It works fairly well, although for some reason the "remove all blips" needs to be re-run a few times to clear all the blips, so I'm still working on fixing that before I upload the plugin.

I suppose you didn't know about the CleanWorld console command from RPH(CleanWorld true true true true true true), all the trues all options(remove living peds, remove dead peds, remove living vehicles, remove dead vehicles. remove persistant entities and reload world). The command doesn't remove blips though.

Share this post


Link to post
Share on other sites
1 hour ago, alexguirre said:

I suppose you didn't know about the CleanWorld console command from RPH(CleanWorld true true true true true true), all the trues all options(remove living peds, remove dead peds, remove living vehicles, remove dead vehicles. remove persistant entities and reload world). The command doesn't remove blips though.

Yeah I'm aware of that function but I wanted more flexibility - the ability to dismiss peds/vehicles, and the ability to only delete police vehicles, and the ability to clear blips. 

Share this post


Link to post
Share on other sites
3 hours ago, alexguirre said:

I suppose you didn't know about the CleanWorld console command from RPH(CleanWorld true true true true true true), all the trues all options(remove living peds, remove dead peds, remove living vehicles, remove dead vehicles. remove persistant entities and reload world). The command doesn't remove blips though.

I guess we all learn something new every day. Thanks for this :thumbsup:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×