[FREE] [QBCore] AI Police


This is a fairly basic script that allows you to easily add Wanted Stars to players that commit crime if no cops are presently online.

TL;DR: Normal GTA Police, but you can specify what exactly gives a player wanted stars and how many.

This script was created in large-part by my friend Phade, but he couldn’t be bothered posting it. :frowning_face:

Download :policeman:

21 Likes

Hello are you going to do this for ESX? Thanks

3 Likes

I might add ESX support soon.

4 Likes

I can’t wait for the ESX version to come out :heart_eyes:

4 Likes

esx please u.u

4 Likes

ESX PLS need this

3 Likes

Is it possible to make the cops fight other AI?

1 Like

yes it is possible if you have knowledge.

2 Likes

This is a server killer script

1 Like

It’s meant to be used on servers with low pop, so people aren’t just sat around waiting for enough cops to do a robbery. Which, I know might be shocking to you, doesn’t happen on servers with hundreds of people playing it.

3 Likes

The client side loop will kill any server, if you have 100 players then u have 100 callbacks every 1 second checking 100 players job. You can change the loop server side and check for online cops every 1 minute and then update the whole server, that way you are running 1 loop and checking 100 players 1 time every 1 minute :smiley: I wish I could do a PR but I have no clue how to do it haha :slightly_frowning_face:

2 Likes

Gotcha, I thought eden was referring to the script killing a server, due to the amount of users that could have wanted stars and therefore the massive amount of Peds. If he had pointed that out, I’d have sorted it by now. Thanks for the info though! :slight_smile:

EDIT: Thanks to AV, the script has now been optimized :slight_smile:

1 Like

Oh this is a good idea, cant wait to test this out

1 Like

I do think in the install there’s a small mistake at the Config.DisableAmbience section

  • the comment block is closed wrong “–]]” instead of “]]–”

The Readme has been updated to correct that :slight_smile:

1 Like

Police still spawning while on duty, seems SetCopsOffline / SetCopsOnline not triggered?

1 Like

I will test the script once again, in a short while.

Tested it out adding the export to a few scripts and i’m a big fan of the idea/script.
A quiet/low pop server immediately felt more alive.

Only thing i noticed is heli’s would target and tail me correctly while the cars usually would drive past me or not spot me. it feels like they focus on a location I was at x-amount of seconds ago when they spawned in and then target me correctly afterwards.

Other than that, this is great. Will follow this along closely :slight_smile:

2 Likes

Sorry about that, I forgot to add a Callback to the function itself. Now when the export is used, the function that’s triggered will check for cops and only give you wanted stars if copCount = 0.

1 Like

Thank you for checking! Did try to call the SetCopsOnline / SetCopsOffline function but had some weird stuff going on with them only following me for short distance then just disappear and only spawning at police station and around legion square. Before I did change that not had that issue. Not tried with the callback yet so will test that tomorrow and let you know.