APB - complete AI police control [QBCore][ESX][Standalone] Tier 5

APB - complete AI police control [QBCore][ESX][Standalone] Tier 5

£300.00

Add to Basket

These packages alone will only give you Discord role! DM MoravianLion first to get a confirmation on what price you classify for! Read requirements first! After the purchase, I'll give you access to the resource manually!


Situation - you're trying to have functional Police department, but things go south so bad and so often that you end up with even most resilient PD officers leaving, due to power play, too many wanna be gangstas shooting PD officers in the head even during a routine traffic stop. And you wish you'd have something to even out the power balance in your city.

Now you can! Introducing APB - complete AI police control.


"An all-points bulletin (APB) is an electronic information broadcast sent from one sender to a group of recipients, to rapidly communicate an important message."


In a nutshell, as a Police officer, this script allows you to:


- trigger specific wanted levels only for specific suspect(s) in the area of your choosing - colored sphere

- to have suspects be chased by AI even when you loose sight or connection to the server

- change NPCs' weapons (except for helicopter gunners) from lethal to non lethal tasers

- automatically trigger wanted levels for whoever kills you, if you're nearby an emergency vehicle (works even for groups of players in close vicinity of the killer)

- use intuitive controls

- have AI police search the area for you, as long as it has either traffic path or navmesh, meaning you can benefit from using APB even on addon maps like Mellow Spirits

- leverage GTA's wanted system to your benefit, with helicopter surveilance, road blocks, spike strips or NOOSE team for the most dangerous individuals

- keep your server optimised and never bug out any NPCs, as the game inteligently spawns and despawns entities natively

- instantly call off wanted levels for selected players only (even if you're not the original officer responsible for assigning the wanted levels) - white sphere

- wanted levels drop off naturally, if the suspect gets away - this is to give them chance to escape, just like in singleplayer (but can aggrevate AI police again, if not careful - this will be avoided, if relieved of wanted levels by player officer instead)

- customise and easily implement into your on duty/off duty system and rank permissions

- enjoy cool vehicle chases with AI police helping YOU for a change!


In the video below, I forgot to mention one important technical thing. To trigger wanted levels, you need to meet 2 conditions. The suspect(s) has to be in the vicinity of the selection sphere AND you need to have a visual contact with them. This is to prevent Police officers from misusing the selection mechanics to trigger wanted levels even for suspects that are hiding inside buildings, for example. Police officer can't report any suspect, if they can't even know someone is hiding inside in the first place, right?


Video demonstration

Quick recap:


- hold "N" to activate the sphere (area of influence) and for everything else related below

- scroll mouse wheel to adjust size of the sphere

- click mouse wheel to select desired wanted level

- left mouse click for switching between assigning and cancelling wanted levels (colored and white spheres respectively)

- right mouse click for AI officers in the area to switch weapons from lethal to non lethal (or the other way)

- release "N" key to assign or cancel wanted levels to whomever is currently located inside the sphere (can be multiple players at once)


This script, while encrypted, has rich customisation options to fit every server's needs:


```

Config = {

    Framework                             = '',         --     "QBCORE" or "" for no other/no framework    

                                                    --    If QBCORE is used, make sure following line is ACTIVE in fxmanifest, if other/no framework is used, comment them OUT eg.: -- commented out                                        

                                                    --    '@oxmysql/lib/MySQL.lua',                                                

                                                    --    You can always change your keybindings in game settings under "FiveM" section                                                

    TargetMessage                         =     "~r~Cops~w~ are onto you!",    --    Message received by the target(s)    

    OfficerDownAlert                     = true,        --    Anytime officer dies AND emergency class vehicle nearby -> APB alert

    OfficerDownAlertWantedLevel         = 5,        --    Wanted level for attacker(s) - from 2 and up is recommended, 5 is max

    OfficerDownAlertGroup                 = true,        --    FALSE -> Picks up the attacker only, TRUE -> attacker + nearest group of players, grabs players through walls and vehicles.

    OfficerDownAlertGroupDistance         = 5,        --    5 is enough for all vehicle occupants for example. With OneSync, 500 is max due to culling.

    OfficerDownAlertVehicleDistance     = 20,        --    How far the attacker can be from nearest emergency vehicle to trigger APB (group) alert? Outside this radius is alert disabled.

    

    Message_Registration                =    "You're registered!",

    Message_UnRegistration                =    "You were unregistered!",

    Message_WeaponsSwitchingTooOften     =    "Don't try to switch NPC weapons so often!",

    Message_By                            =    "APB by ",                                            --    as literally "from which" officer APB was initiated from 

    Message_EndOfTransmission            =    "The end of APB transmission",                        --    used for spacing out the text over HUD elements in the way

    Message_BOLOGeneric                 =    "To all ~b~LSPD units~w~, be on lookout for armed and dangerous suspect!",

    Message_BOLOPartial                 =    "To all ~b~LSPD units~w~, be on lookout for~y~",    --    following with in-script number of suspects AND either Message_SingleSuspect or Message_MultipleSuspects

    Message_SingleSuspect                 =    " ~w~armed and dangerous suspect! Stage: ~y~",        --    message about singular individual

    Message_MultipleSuspects             =    " ~w~armed and dangerous suspects! Stage: ~y~"        --    message about multiple individuals

}

```

About script's integration and rank system:


APB's integration depends on 2 things:


- allowing AI police to work (enabling them within your framework), as it needs to manage wanted levels exclusively by itself

- adding officer's APB (un)registration - add them into your duty script for example and/or assign them to specific ranks only

  - TriggerServerEvent('apb_register_officer')

  - TriggerServerEvent('apb_relieve_officer')


Detailed instructions for integrating APB for QB and ESX frameworks are included inside the script.


Things you may not like:


- Mugshots in QBcore version sometimes don't work. I couldn't figure out why. It's pretty rare though.

- I wasn't able to figure out how to make mugshots work for ESX version at all (without going through some crazy hoops), so you get same treatment as for standalone variant.

- If hitting "N" key for selection sphere (default) while typing into the chat (and while on duty), you can trigger the chase for nearby player. While I could disable N key input after pressing T for chat, I'm not entirely sure this wouldn't become a problem in some very specific situations. If anyone has a tip on how to disable specific keys reliably only when chat window is opened, let me know. Alternatively, **you could switch the sphere from assigning levels to disabling levels instead before opening the chat window to prevent starting a chase by accident**. This way the sphere becomes "harmless".

- I had to implement cooldown for switching AI police weapons, to prevent client crashes. It's about 2 seconds now before you can give out the order again. But I can't imagine who would have the need to trigger this every second anyway. And the best practice would be to have only a single player in charge or every chase anyway, most likely the highest rank available, to retain ideal unit coordination.


| Code is accessible          | No                

| Subscription-based       | One time or subscription              

| Lines (approximately)  | 1000  

| Requirements                   | None

| Support                                 | Yes                 



Both client and server sided demands are practically zero during using APB script:

2fa14429052583223e8a2a0b24a2b67049fe8f9b.jpg



Discord


This package alone will only give you Discord role! DM MoravianLion first to get a confirmation on what package you classify for! Read requirements first! After the purchase, I'll give you access to the resource manually!