[Release] PD5M - Multiplayer PvE Police Script - Ambient Events

PD5M is a resource that aims to provide a functional police multiplayer to the game. Inspired by LSPDFR and PIS you can take on the role of an officer of the Police Departments to protect and to serve the citizens of San Andreas.

  • Interact with every ped and vehicle on the server
  • Talk to civilians, search them, use a drugtest or a breathalyzer
  • Seize cars or items, fine peds or arrest them
  • Call Coroner and Towtrucks to get rid of dead bodies resp. seized cars
  • Departments: LSPD, LSSD, SAHP, SAPR (Park Ranger), SWAT
  • Advanced and fully customizable armory, wardrobe and garage - systems
  • Full EUP wardrobe support
  • Work as a towtruck driver for the DPOS (Department of Public Order and Safety; very limited script-support)
  • Wardrobe and garage support for Fire Department and EMS (no script-support currently)
  • Custom TP-script to quickly get you to each police-station
  • Config file pre-set to work with a few mods (listed below)
  • Backend: Sync-structure so every client gets the same information of the peds

Controls

  • Use F3 to enable a crosshair that will help you determine what you are looking at

Keyboard

  • Use E to interact with an npc you are looking at. Is also used to interact with every marker on the map
  • Hold X to open the radialmenu. You can see every action your officer can possibly take. Hover your mouse over an action and release the key (no click necessary) to perform the action. Has different options on foot and in a car

Controller

  • Use DPad Right to interact with an npc you are looking at. Is also used to interact with every marker on the map
  • Press DPad Down to open the radialmenu. You can see every action your officer can possibly take. Use the right analog stick to move the cursor over an action and press DPad Down again to perform the action. Has different options on foot and in a car

On foot: To carry out an action look at a ped and use E or X as described above.
In a car: The actions will get carried out for the vehicle directly in front of your vehicle.

Make sure to talk to people before taking an action against them (e.g. arresting them). You wouldn’t like that in real life either!

Video Tutorial
View this video tutorial to learn the basics about the controls:

Base

PD5M is based on the following resources:

Both resources have been integrated into PD5M. A huge thank you to the authors for these awesome resources and the permission for the integration.

Other resources are recommended for better playability. For the full list see the readme in the github (link at the bottom of the post).

Installation Instructions

Please make sure that the resource is called pd5m in all lowercase!

Described in the readme of the github. You can also find information on the licences there.

Pictures

Pictures

Interacting with peds

Starting a traffic stop

Searching a vehicle

Handcuffing

Resistance

Armory

Clothing Main Menu

Park Ranger Outfit

SWAT Outfit

LSPD Garage Main Menu

Shoutouts to

  • The teams of LSPDFR and PIS for their inspiration and code-examples that I could rely on
  • Brent_Peterson for his resource radialmenu
  • Warxander for his resource warmenu
  • Vespura for the recommended addon vMenu
  • WolfKnight for the recommended addon Delete Vehicle Script
  • MrDaGree, T0y, BradM, Kipz, Thehurk, Broderick, SLB2k11, Bamboozled, matus77, Smokey7, grzybeek and MrBrown1999 for their creations and resources that can be used to greatly enhance the playing experience of an officer.
  • DrBlackError for his tremendous help regarding setting up and maintaining the github.
  • MobTV for his contribution to offer ESX-integration.
  • ChieF TroN for his contribution to offer vRP-integration.

github-Link
https://github.com/xSilvermanx/PD5M/releases/tag/v0.2.4

https://github.com/xSilvermanx/PD5M

Newest Patch Notes
This release updates the wardrobe to EUP-Version 9.3 and includes the option to save your outfits. It also includes Armories for Tow Trucks and Fire Departments with Fire Extinguishers and Jerry Cans.

  • Armories and Wardrobe have been updated to EUP 9.3
  • Json-Database to save outfits for each department
  • BCSO has changed to LSSD
  • Added Support for SAHP-Station LaMesa by Matus and LSPD-Station Del Perro Pier by Pablito
  • Added TP-markers at every department, removed /tp-command
  • Added the rank-command into the wardrobe, removed /rank-command
  • Added Vehicle-Repair and -Impound/Deletion Markers. They are located at every tow truck station and a few police stations
  • Ped Props now get removed when you open the uniform tab in the wardrobe
Older Patch Notes

v0.2.3 Mostly OneSync-ready

This release is not useable with normal FiveM however it should be much more stable with OneSync. Note that coroner and towtruck might be very unreliable.

Fixed peds and vehicles not having synced wanted status
Fixed peds randomly spawning arrested (that was a fun one)
Fixed Sandy Shores Bamboozled Station having the wrong handle name
Fixed some custom police vehicles spawning with neon light
Fixed “Unknown command” error popping up in chat for ESX
Added ESX ambulance and fire department to whitelisted players (they can
use the different menus)
Fixed some vehicles not being able to transport arrested peds even
though it theoretically should be possible
Removed “Firstname Surname” from the ped search for easier entry of
names
Removed script that reset the player’s clothes on death

v0.2.2.1

  • Fixed a bug where the permission system for ESX and vRP didn’t work at all.
  • Fixed medic stations not being loaded properly.

v0.2.2 Usability Update

  • Updated __resource.lua to fxmanifest.lua
  • Included Variables in fxmanifest.lua to easily activate and deactivate the files you need

v0.2.1 The wardrobe update

  • Completely rewrote the wardrobe to feature much better customizability
    of your mp-ped
  • Full support for EUP Law & Order + Serve & Rescue
    • To utilize the EUP-wardrobe, use the EUP Serve & Rescue
      Pack
      .
      Only install the eup-stream part of the download, you neither need
      NativeUI nor eup-ui for the PD5M-wardrobe to function
  • Added a check to keep you from opening the wardrobe without an mp-ped
  • Added fire department and paramedic wardrobe and garage for every
    hospital and fire station (no script-support, only for RP-purposes
    currently)
  • Added command /rank so you can set your department rank for every
    ingame department. Uniforms that can display rank insignia will display
    the appropriate rank insignia when choosing that piece of clothing in
    the wardrobe

Minor changes

  • Moved ESX and vRP-integration to new folder Integration
  • Removed debug messages in Ambient Event “Non Roadworthy Vehicle” that
    were in the live version on accident
  • Discovered, traced and removed a bug where only a “few” markers were
    displayed (turns out that there is a limit on how many markers can be
    displayed at all. I seem to have reached that quite fine :-P). As an
    unintended side effect performance of PD5M was improved from 0.6 CPU
    msec to 0.2 CPU msec

v0.2 Ambient Events

  • Added a system that provides work for officers while on-duty
  • System works fully automatic, doesn’t need to be activated nor started
  • Added ambient event: car ignoring red lights (randomized, more things may happen)
  • Added ambient event: car not in a road-worthy condition (randomized, different things may happen)

Tbh this is not the big update I was hoping to bring to you guys. However Callouts are a huge problem and the first version didn’t work at all. Thus I completely removed the Callout-system to publish the mostly-working ambient events. I’ll target callouts later on, an idea on how to get a dynamic system done does exist. However this will be extremely complicated so might take a long while.

More patchnotes, sorted for files:
common_cl_fct.lua:

  • Added sync to automatically create data for all entities when peds drive vehicles
  • Mission System Handler added: when using the SyncPedAndVeh()-function the mission system detects the used entities as interacted
  • Fixed a bug where vehicles and peds wouldn’t have synced data if you used the CheckPlate()-command without prior interaction to the vehicle

config_cl.lua:

  • Edited the Standard Driving Behavior. The peds should now drive way more predictable, and should not overtake anymore after being stopped.
  • The towtrucks and coroners shouldn’t drive the wrong direction of streets anymore.

station config Pillbox Hill Medical Center:

  • Markers at Pillbox Hill Medical Center now heal you instead of displaying the controls.

cleanupthreads_cl.lua:

  • Added events that trigger SetEntityAsMissionEntity and SetEntityAsNoLongerNeeded on every client
  • Added event that sets mission entities to wander if they exist
  • Added checks to make sure that mission entities properly get deleted and properly start wandering around after an interaction. Deletion of mission entities only works if the script doesn’t get restarted.

def_gl.lua and dev_sv.lua:

  • Every custom list that was defined serverside only is now global (items, weapons, names, offenses, …)
  • Serverside definitions of lists related to the mission system

interaction_cl.lua:

  • Fixed interaction with E-menu for players with ping > 200 (now problems will occur with a ping > 1000)
  • Changed the FinePed()-function so you can directly start typing a sum instead of deleting huge amounts of text
  • Upped the distance to grab peds using GrabPed()-function
  • included targetveh-support in pedflee()-event. Should properly delete cars now
  • peds in vehicles will now drive way slower when sending them on their way after a traffic stop
  • Fixed a bug that caused a crash of the interaction-script when trying to set weapons for a ped which shouldn’t have them
  • Changed the speed at which the peds drive after interacting with you. Should be less speedy in the city, maybe a little bit too slow on the highway.
  • Upped the distances at which you can use RunPlate to reflect the changes made to TrafficStops
  • Set the max cruise speed of fleeing targets in vehicles higher and changed their driving style to be less chaotic. Chases should be harder now.
  • Deleted Blips for fleeing peds. Chases should be harder now.
  • Deleted Blips for hostile peds that get triggered through the interaction script.
  • Fixed a bug where peds you interacted with wouldn’t get properly marked as no longer needed.

interaction_sv.lua:

  • Fixed a bug where illegal weapons for peds would generate out of the list for legal weapons thus rendering illegal weapons never used
  • Added flagismissionped which if set prevents dead bodies from despawning without calling a coroner. Used for mission peds.

markers_cl.lua:

  • Deleted large chunks of commented code that was left on accident
  • Changed the creation of the vehicle blip such that it is not named ‘Getaway Vehicle’ anymore

towtruck_cl.lua, towtruck_sv.lua, coroner_cl.lua and coroner_sv.lua:

  • Changed distances and speeds of the coroner during approach and on-scene. Should behave way calmer now
  • Hopefully fixed a bug where the coroner would sometimes only pick up the first dead body. He’d go to every body, pick them up, the bodies would disappear and reappear almost instantly.
  • Fixed towtruck and coroner spawning with incorrect orientation (should work 95% of the time now, last 5% are not a bug but a result of how the script works)

startup_cl.lua:
Deactivated dispatch services for cruising PD and pulled over PD

v0.1.3 The Console Peasant Update

  • Added controller support for radialmenu and warmenu
  • Integrated Warmenu and Radialmenu into PD5M
  • Finished ESX- and vRP-permissions. Every menu should be permission-guarded now
  • fixed a bug in radialmenu that could mess up the controls of other menus
  • Completely rewrote armories and garages
  • Added large config sections so you can customize most aspects of armories and garages
  • Changed the crosshair-function not to use the SniperScope but a sprite
  • Changed the help-function to also display controller-buttons
  • Fixed a bug that made it impossible to pull over cars with trailers

v0.1.3.1

  • Fixed a bug related to multicharacter scripts in ESX / vRP that caused a crash of radialmenu

v0.1.3.2

  • Rewrote coroner and tow stuck check. They will hopefully do their duty way more reliable.

v0.1.3.3

  • Fixed a bug that had LaMesa-coroners spawn under a bridge on Los Santos Freeway
  • Fixed a bug that caused radialmenu to be stuck open when opening chat
  • Changes to tow and coroner-scripts to hopefully improve their behavior
  • Sorted __resource.lua-config options
  • Added three tow truck-stations

v0.1.2 Yet another Config Update

  • Config files were expanded yet again. Features great customability for stations and is now a lot cleaner than before.
  • vRP-integration thanks to ChieF TroN. To activate it uncomment the files in __resource.lua.
  • Bugfix: Improved performance by not performing a large amount of distance-checks in while-loops with Wait(0).
  • Bugfix: Coroners and Towtrucks should now more reliably drive away from stations. Please report issues about it stating the exact location that caused the bug.

v0.1.1.1

  • ESX-integration thanks to MobTV.
  • Bugfix: Stealing cars is possible again.
  • Bugfix: Pullover is more reliable on intersections with traffic lights.

v0.1.1 The config update

  • Config files were greatly expanded and now feature many variables to tweak the ped-generation of the resource.
  • Probabilities for peds possessing weapons, using drugs, drinking, and fleeing / fighting have been increased.
  • Fixed a bug where imprisoned peds were still stuck to a player for everyone else.

v0.102:

  • Fix: Pack-function should work on most police vehicles now.
  • Fix: Error messages for the garages are now written in english.
  • Fix: Fixed variable names so the resisting-function is functioning properly for peds in vehicles.
  • Fix: Fixed an error that allowed players in cars to be interacted with.
  • Fix: Disabled controller input for radialmenu.
  • Fix: Grab-function now properly works on peds that have been arrested by other players.

v0.101: Fixed radialmenu not working as intended. This was related to me not uploading every changed file. Whoopsie.

48 Likes

So are there callouts like robberies and shots fired?
also cool release

Currently there are no callouts. Syncing the relevant information for callouts is not an easy task sadly.

Thus this release doesn’t feature it.
I hope that there will be a v0.2 which would then add a callout-system.

1 Like

Is there a way to have them mimic you. And also there are button conficts for controller is there a way to disable controller support!

1 Like

Hey,

a mimic function will not be implemented as far as I am concerned.
The reason for this is that my goal is to have every car pull over properly themselves.
A basic code which mostly works in the county and on highways is already implemented. The problem is that it utilizes TaskVehicleTempAction which ignores everything surrounding the vehicle. This is going to be optimized later on if I have the time to code.

Regarding the button conflicts for controller: I don’t know if it’s possible to deactivate the controller input (probably radialmenu?). I do not have a controller myself and can only guess but I’ll try to fix that.

2 Likes

I found the problem with the botton conflicts it is radialmenu and a simple fix would be just to change the menu keybind, as “A” on a xbox controller is x on the keyboard.

Okay, I have put this in my server, but the F3 does not work. Neither does the War Menu. Any solutions?

really cool script, but I have a bug, I can’t do the action from the X menu without clicking… Any idea where this is coming from?

Sending you a PM.

What you describe is actually the standard radialmenu.
I changed that behavior in the resource PD5M/Radialmenu/radialmenu.lua. Solution might be that the file isn’t copied over to resource radialmenu/radialmenu.lua. Can you doublecheck that you copied this file?

Cheers mate for the awesome script but how can we Whitelist people on the server? now anyone can be a cop

Currently there is no whitelist-feature. This is intended to be a PvE-script only so PvP-features are not supported at all (and most likely will never be: there are enough PvP-scripts out already). That’s why I didn’t think it is necessary at first.

Patch v0.101: Fixed a bug regarding the radialmenu. Forgot to upload a file. Please refer to installation instructions on how to install it (one file: menu.html). Whoopsie.

2 Likes

Thnx man so everyone can be a cop , so only good for solo server then

Amazing work, keep it up

I have a problem I can’t get the arrested civilian on SUVs like tahoe or explorer how I fix it? thanks

1 Like

Grab the arrested ped, then aim for the car. You might need a few tries since some of the variables are set too low accidentally. Will try to publish a fix on saturday.

1 Like

thanks i still have no salt problem and it crashes for example on 20 attempts is fine 1 but only on SUVs and taurus on the crown and dodge works well tips?

Just a note the problems with pack seem to be fixed by changed a few parameters in the script. Fix will be published asap, please do not report errors for this anymore :wink:

thank you for the fix, it worked for me!