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

@Spacetrucker
I did not make PIS, that’d be KNOBs. PIS was a big inspiration for me but I did not write that script ^^

@Captain_Waterloo and @JAMYBBOYJD
The issue with the radialmenu (X) is surely related to the resourcename. Have you renamed your resource to be all lowercase, i.e. pd5m ? This has to be done otherwise the exact error you describe will happen.

ESX and vRP are only supported on a basic level. This resource is intended to be used standalone.

@Captain_Waterloo
Regarding the issue with E-Menu: Do you have ESX or vRP installed? If yes please check if you got the job ‘police’ set. If not please contact me privately, I’ll have to look into this in detail.

@PolarisSurvivor
The Tow- and Coroner-Script has been “fixed” after 1.1 to not get the cars stuck indefinitely. Seems like my fix doesn’t work so I’ll need to provide a better script to fix the issue with cars getting stuck. Will try to fix it this evening.
Regarding the notifications this is a compability issue. This naturally happens since E is a pretty often used key for interactions.
The reason the notifications show is because of the way I code. Pressing E will trigger the following if-clause:

if IsControlPressed(0, 51) and not (atheal or at[insert-location-here]) then
   if IsAimingAtPed -- not an actual function but you get the idea
      .
   else
      Notify('No peds or cars close')
   end
end

atheal is short for player is standing at a heal point. I have defined these variables for every of the PD5M-interaction-points (like garage etc).
What I can offer is another variable atCustomLocation. This would be controlled using one thread:

local CustomLocations = {
   {x=500.12,  y= 611.34, z = 20.43}, -- my custom location
}

local playerped = GetPlayerPed(-1)
local distance = 0
atCustomLocation = false

while true do
   local playerpedcoords = GetEntityCoords(playerped)
   for i, Location in ipairs(CustomLocations) do
      distance = Vdist2(playerpedcoords.x, playerpedcoords.y, playerpedcoords.z, Location.x, Location.y, Location.z)
      if distance < 5.0 then
         atCustomLocation = true
         while distance < 5.0 do
            Wait(5000)
            distance = Vdist2(playerpedcoords.x, playerpedcoords.y, playerpedcoords.z, Location.x, Location.y, Location.z)
         end
         atCustomLocation = false
      end
   end
   Wait(0)
end

What this does is it activates the variable atCustomLocation if you are closer than 5 meters. The custom locations can be defined in the list CustomLocations. The only thing that would need to happen now is that you define the locations where to disable the E-menu by setting the coordinates in the list.
Would that be something I should add?

1 Like

The Console Peasant Update - v0.1.3.2

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

Please report back if the update didn’t resolve anything or made it even worse. Sadly my test server is down since today so I can’t properly test the update with multiple people.

1 Like

@Silverman thanks a lot. No I hadn’t seen the part where I had to rename. Everything works perfectly now thanks. Great work man can wait to see more

what file needs to be replaced for the updated corner and tow stuff?

Hey, question. Your update says “Integrated Warmenu and Radialmenu into PD5M”. Does that mean we no longer need the separate resources for warmenu and radial? Just need clarification. Thanks for the great script!

Yes that is correct. You can delete both of them resources as he integrated them into his script already

Awesome thanks!

On the fight or flee settings, for the percentages, just for clarification.
Are the percentages set as in 10.00 for 10%, 25.00 for 25% and so on? Just wondering because I have all the fight or flee chances set at 10.00 and they fight back every single time and with a firearm every time. So is 10.00 actually 10 percent or is it 100?

Hey,
that would be the folder /Service or both client-files in there (tow_cl.lua and coroner_cl.lua).

@R.Killinger
If I didn’t fail writing the fight or flee chances 10.00 = 10%. I’ll check that this evening.

Just make a combination of two keybindings. Mine is set to work with [ SHIFT + E ]

if  IsControlPressed(1, 21) and IsControlJustPressed(1, 51) and not (atarrest or atevidence or atcloth or atheal or atgarage or atweapon or athelp) and (PlayerData.job.name == 'police') then

Hey so I put this script into my server and everything works, meaning it loads in but, the radial menu stays on the screen up until FiveM fully closes, (its on the screen while exiting) and it glitches the mouse out. Any ideas?

rename the resource to pd5m. Make sure it is all lowercase.

Hey, i have the same problem. Making the resource name to lowercase did not help. Also tow and coroner services are still dumb(after update, i think they became more dumb than they were before update).

So Coroner and Towtruck…

I hope that the arrival of the two services works without problems. If that doesn’t please respond to this post.

Regarding the Towtruck actually taking the vehicle:
I’m using AttachEntityToEntity in order to attach the vehicle to the towtruck. Using the same native to grab peds I only managed to get this to work when triggering the native on every client. This doesn’t happen currently for the towtruck.
Thus I’ll be editing the towtruck script this evening in order to change that behavior.

Please notify me if there are problems with arrivals of the services or when picking up bodies for the coroner-service. Please explain the problems in as much detail as possible if you got some so I can look into fixing these problems.

EDIT: Actually there is a bug for picking up bodies which I forgot when writing this post. This is for the coroner-ped getting stuck on the back of the vehicle.

I have a fun little suggestion, dont really know how to implement it though, how about some kind of way to track arrests like a scoreboard or something. gives something the police boss can keep track of so he can maybe use some of that info towards promotions, Do not need to many trackers. total arrests. ped deaths, evidence collected , you could have it access-able from one of the cork boards in mission row

@Silverman Any update on the percent chances? I tried it again and it seems that putting it at 10% makes them fight every single time. And with a weapon every time.

Also, Coroner seems to still drive in circles, crashing into everything when called.

So I just tried both reports:

As for the flag issue I wasn’t able to reproduce the error. For me the variables seemed fine, I had no problem with PedFleeInstantBaseChange = 10.00 .
Please check if you have other options edited to higher values as well. As can be seen by the modifiers from line 39 to line 55 many factors go into the behavior modifiers. If other values were changed this would explain the problems you have.

As for the Coroner I had few problems when calling it however non of them involved driving in circles… I’ll try to simplify both scripts for a more consistent behavior (especially upping the ranges at which the next part of the script is triggered), maybe that will provide a temporary fix to the problems.
Please note though that I can’t do anything against pathing errors. If the coroner drives under a bridge it might falsely assume to be placed on it. This would result to big problems. I’ll try loading path nodes locally for the coroner but can’t promise anything on that.

1 Like

Another thing I noticed, whe running and ID, under FLAGS, it says none but then says Proceed with Caution. You only need Proceed with Caution if there is a flag.

Also, seem to have a very difficult time pulling over Sandkings. Most of the time, it will not catch it, but if I get lucky, it might do it 1 time out of 10.

A great way to do this until something is coded is using dpemotes and just typing /e notepad, and it works well

Are you planning to implement EMS on a future release? If there is anyway I can help, let me know, I am new to scripting but am a quick learner. Thanks for a great mod!