[Request] AI Police Backup

Hello !
I’m running a LSPDFROnline server and I was wondering if it is possible to make a script that spawns AI police, in car or on foot, like one or two streets apart, and they come to help you. When there is only one on the server, it’s kind of hard to play if you don’t have backup.

Do you think it could be possible ? With a menu like in the real LSPDFR ?

Thanks, have a good day :wink:

1 Like

It’s hard, but it might be possible to set the player(s) Relationship to COP if they are on an Police Team (and if they aren’t then they are simply CIVMALEs and CIVFEMALEs) then if the player (cop) calls for example police backup, it will dispatch an DT_PoliceAutomobile or DT_PoliceVehicleRequest who are friendly with the player (cop) and not friendly with criminals (other players who aren’t cops), it might also be possible to dispatch SWAT, which is DT_SwatAutomobile or Gangs and Merryweather as DT_Gangs/DT_Army

If you did’t get it, what im talking about, AI Police is dispatched in the vanilla game as DT_PoliceAutomobile (which is the common cops that pursue you) and DT_SwatAutomobile which is pretty much SWAT, there are also scripted spawns such as DT_Gangs which can be seen on story mode where if micheal and trevor is hunted by gangs.

2 Likes

Adding onto what you have said, this native looks like it could be useful:

https://runtime.fivem.net/doc/natives/#_0xDC0F817884CDD856

2 Likes

Cool ! I never wrote a FiveM script, do you think it is possible in Lua ?
Thanks

1 Like

Hey! I currently have a completely working copy. It is in beta stage however, so it will be taking time to develop. It currently has pursuit assistance, code 2 assistance, code 3 assistance, traffic stop assistance, and several others.

4 Likes

Hey ! Well done ! I was seeking for a script like that for an eternity. I am reaaally interested by your copy ! Can you please just explain the main stages of your program ? Or just a small piece of code ? Honestly, I would love to program it myself but I don’t know where to begin ^^ We are running on a local server with my brother (just the two of us) and it will be really great to have some backup from time to time. Thanks a lot !

1 Like

@ryanwalker I would be interested to have it also. Looking for such a script since ages

Hey! So essentially, my code works by spawning an AI inside a vehicle with a random offset from the player, the ped inside the vehicle is given a task to drive to the player, and park behind him. (Traffic Stop Assistance) Code 2 and Code 3 essentially drive until they’re a certain distance from the Player and once there, they will simply get out, help chase a suspect, or help defend a player if lethal force is needed.

3 Likes

/push :smiley:

@ryanwalker Can you share your code ?

2 Likes

!Push! would really love that

1 Like

https://github.com/Mooreiche/AIBackup i created this yesterday. it is still early early early alpha but you can use/edit or what ever you want with it just dont delete anyone from the credits and put your name to it if you change someting :slight_smile: AND release it then!!! :smiley:

3 Likes

Thank you @Mooreiche for sharing your code. With my brother, we managed to use it and edit it, this was the first mod ever edited :smiley: We added the possibilty to call several backup units + change it from LSPD/LSSD/SWAT + cancel the last backup unit + added a follow Me option (on foot) so that they can follow you if pressed. We are having some troubles coding the part where they must follow you if you are in a car (they must follow you in their car).We think we’ll release it when some bugs are fixed (like the heading of backup when called) and the last function (follow in car) is done.

1 Like

Hallo @Naash_Alex,

Could you publish it already. I would love to test this! Would be an addon every Single Player in FiveM/FivePD is waiting for. Maybe you can post it also on GTAPoliceMods.

Kind regards,

Rick

Hello @Rick_Rinkens !
After several days of debugging and after adding some new features, we are glad to share the final code with everyone. Here is the link :

We advice that you read the ReadMe carefully before using it. If you have questions, we will try our best to give you answers (if we have some spare time).

Another time, thanks to @Mooreiche for sharing his code. And as he said earlier, you can use/edit or do whatever you want with it just don’t delete anyone from the credits and put your name to it if you change something.

We will put it on the Release Section when possible.

Hi @Naash_Alex - Ive been looking into your script, attempting to add an ESX callout looking for a ‘police’ job before any of the buttons can be registered.

Would you know how to do that? everything im attempting is breaking the script :confused: