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

There’s still the calls for E when doing other things, like opening doors and taking out vehicles from garages as police. :stuck_out_tongue:

and should the folders name be set et small letters to avoid the multi-charater issues?

What do you mean with calls for “E”?

Foldername is to be lowercase only because radialmenu uses an NUI-function. I’m not entirely sure how it works but that function only works if the resourcename is lowercase only (comparable to how every single internet page will have a lowercase name only, e.g. fivem.net for FiveM). The docs explain this:

The multi-character issue happens as follows:
The permission system in PD5M works by checking PlayerData.job.name == police. The background is that when connecting to an ESX-server your config data will get loaded. This is a list PlayerData which includes a list job that includes its name.

Now multi-character scripts don’t have you instantly load a configuration on connect but only after you have chosen your char. However this means that the check will return an error: Since PlayerData is not yet defined, it’ll return nil. Now Lua doesn’t like it at all if you try to index a nil-value thus the radialmenu-script crashes.
To fix it I am checking if the lists are defined:

if PlayerData ~= nil then
   if PlayerData.job ~= nil then
      if PlayerData.job.name == 'police' then
.
.
.

etc. This way if your character wasn’t yet loaded the first if-clause returns false thus the error-prone message will never be checked.

Now I’m not sure if it’s the best way to approach that error but it surely works.

so i made it look like this
–SetIgnoreLowPriorityShockingEvents(player, true)
SetPoliceIgnorePlayer(player, true)
–SetPlayerCanBeHassledByGangs(player, false)

and

–“Interaction/pednopanic_cl.lua”,

, restarted the script, does not seem to help much, I will give you a update after I restart the server, there are people on it right now be later tonight
Thanks again
for all your help

that fixed it thanks!

Yikes you don’t even have permission

Read again:
I got permission from Warxander.

Now read the forum rules again:

Sharing content that is not yours is allowed as long as you credit the original author and don’t violate their terms/license. Try to contact the author via their contact information found on their profile, leaving a comment/reply, or by creating an issue (if it’s a repository). After allowing the original author time to reply ( ~1 week ) and you’ve not received a reply, you may use their content under the terms that you credit them and share your contact attempt (i.e. with a screenshot).

Only thing I didn’t do is sharing my contact attempt (because a direct message is above anything private) but mentioned that I would provide proof on demand.

So yeah, I got the permissions I could get and am save according to the release rules. Also I specifically mention that I hope Brent will give his permission (read that as I will remove radialmenu if he voices that he doesn’t approve of it).

Is that enough permission for you?

Silverman - the Npc doctors and Towtrucks worked better in the first script. They can’t find the cars and npcs in like75% of the times they’re called.

1 Like

Do you have the original files still?

1 Like

Do you mean PIS or my first publish? Either way, I got them. Thanks for the bug report. Since I only did one change I feel like I know exactly what the issue is… will not revert but try fixing the issues tomorrow correctly.

holy cow I did not know you made PIS thats what i get for not reading , I loved that too

1 Like

Hello @Silverman.
I love the script and the idea I do tho have 1 problem not sure if it’s only on my end but when I click “X” the menu won’t close no matter what I do. I also have a problem with the E Menu where it dosent show up when am talking to peds. I have the newest version installed.

The problem is that if you press “E” as cop, like if you want to open a door or take out a car from the ls customs garage you get the “Notify” in the left corner, “no peds or cars close” or something like that. That’s unfortunate and a bit annoying. I took the 1.1 script you made for Tow and Ambulances. And it works perfectly, so yeah… thanks for fixing things :slight_smile:

i have the same issue as captain_waterloo. i dont run esx or vrp, is this the problem?

@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!