[Release] [ESX] [Police Job]

I would love to install this, excpet i dont know how to, any help or a walk through on team viewer?

Is there any way to change officer skin? I uploaded custom skin to the server, and I’m not sure how to add that for police officers

1 Like

essentialmode.addon_inventory doesn t exist

When I select my uniform in the cloakroom, I can’t edit my ped’s face/skintone. Not sure if I’m not doing something right or if it’s just not an available option yet.

1 Like

I seem to be having an issue where the locality wont change despite me settting “config.locale = ‘fr’ to config.locale = 'en”
I have changed that line in all of the preceding scripts as well (es_extended, esx_society, etc
)

the main issue im having is that I modified the authorized vehicles list in config.lua but when i approach the garage point, i get french localizations for base vehicles instead of the english localizations for my custom vehicles. any thoughts?

on config.lua:

    AuthorizedVehicles = {
      { name = 'police',  label = 'VĂ©hicule de patrouille 1' },
      { name = 'police2', label = 'VĂ©hicule de patrouille 2' },
      { name = 'police3', label = 'VĂ©hicule de patrouille 3' },
      { name = 'police4', label = 'VĂ©hicule civil' },
      { name = 'policeb', label = 'Moto' },
      { name = 'policet', label = 'Van de transport' },
    },

on client/ main.lua:

table.insert(elements, { label = 'VĂ©lo', value = 'fixter' })
    table.insert(elements, { label = 'Cruiser', value = 'police' })
    table.insert(elements, { label = 'Sheriff Cruiser', value = 'sheriff' })

    if PlayerData.job.grade_name == 'officer' then
      table.insert(elements, { label = 'Interceptor', value = 'police3'})
    end

    if PlayerData.job.grade_name == 'sergeant' then
      table.insert(elements, { label = 'Sheriff SUV', value = 'sheriff2'})
      table.insert(elements, { label = 'Interceptor', value = 'police3'})
      table.insert(elements, { label = 'Buffalo', value = 'police2'})
      table.insert(elements, { label = 'Moto', value = 'policeb'})
      table.insert(elements, { label = 'Bus pénitentiaire', value = 'pbus'})
      table.insert(elements, { label = 'Bus de transport', value = 'policet'})
      table.insert(elements, { label = 'Antiémeute', value = 'riot'})
    end

    if PlayerData.job.grade_name == 'lieutenant' then
      table.insert(elements, { label = 'Sheriff SUV', value = 'sheriff2'})
      table.insert(elements, { label = 'Interceptor', value = 'police3'})
      table.insert(elements, { label = 'Buffalo', value = 'police2'})
      table.insert(elements, { label = 'Moto', value = 'policeb'})
      table.insert(elements, { label = 'Bus pénitentiaire', value = 'pbus'})
      table.insert(elements, { label = 'Bus de transport', value = 'policet'})
      table.insert(elements, { label = 'Antiémeute', value = 'riot'})
      table.insert(elements, { label = 'FBI', value = 'fbi'})
      table.insert(elements, { label = 'FBI SUV', value = 'fbi2'})
    end

    if PlayerData.job.grade_name == 'boss' then
      table.insert(elements, { label = 'Sheriff SUV', value = 'sheriff2'})
      table.insert(elements, { label = 'Interceptor', value = 'police3'})
      table.insert(elements, { label = 'Buffalo', value = 'police2'})
      table.insert(elements, { label = 'Moto', value = 'policeb'})
      table.insert(elements, { label = 'Bus pénitentiaire', value = 'pbus'})
      table.insert(elements, { label = 'Bus de transport', value = 'policet'})
      table.insert(elements, { label = 'Antiémeute', value = 'riot'})
      table.insert(elements, { label = 'FBI', value = 'fbi'})
      table.insert(elements, { label = 'FBI SUV', value = 'fbi2'})
      table.insert(elements, { label = 'Voiture Banalisée ', value = 'police4'})
    end

on locales/en.lua:

  -- Authorized Vehicles
  ['police'] = 'patrol Vehicle 1',
  ['police2'] = 'patrol Vehicle 2',
  ['police3'] = 'patrol Vehicle 3',
  ['police4'] = 'unmarked Vehicle',
  ['policeb'] = 'motorcycle',
  ['policet'] = 'transport Van',

You can just replace the original config.lua(which is in french) to englishconfig(en.lua). you can find english config in localization/en_config. Then change main.lua labels.

Is there a way to add the impound command from the tow truck menu to the cop menu? this way if no tow truck drivers are on the police can impound

Hi there

I was wondering if I could get a line of code, that would allow me to restrict a specific job grade from issuing fines. I’m not the best scripter, but I understand that I could perhaps nest an if statement I could make it work but I’m unsure how.

Thanks,
Ethan

How can i set maxseats to 2 or 3?
Now i can put only 1 guy in a car :frowning:

RegisterNetEvent('esx_policejob:putInVehicle')
AddEventHandler('esx_policejob:putInVehicle', function()

  local playerPed = GetPlayerPed(-1)
  local coords    = GetEntityCoords(playerPed)

  if IsAnyVehicleNearPoint(coords.x, coords.y, coords.z, 5.0) then

    local vehicle = GetClosestVehicle(coords.x,  coords.y,  coords.z,  5.0,  0,  71)

    if DoesEntityExist(vehicle) then

      local maxSeats = GetVehicleMaxNumberOfPassengers(vehicle)
      local freeSeat = nil

      for i=maxSeats - 1, 0, -1 do
        if IsVehicleSeatFree(vehicle,  i) then
          freeSeat = i
          break
        end
      end

      if freeSeat ~= nil then
        TaskWarpPedIntoVehicle(playerPed,  vehicle,  freeSeat)
      end

    end

  end

end)
2 Likes

You can’t
 If you tried to increase the “maxSeats” you couldn’t put the player in the car because, the seat you’re trying to put the player into doesn’t exist.

For example, on a bike there’s only two seats (driver and passenger) if you tried to put another player onto the “third” seat, it wouldn’t work because it doesn’t exist.

1 Like

But i cant put 2 players in a police car. There is 3 slots free i can put only 1 guy.
How can i fix it?

Let me explain the code that you’ve sent for you:

for i=maxSeats - 1, 0, -1 do if IsVehicleSeatFree(vehicle, i) then freeSeat = i break end end --> in this part it gets the maximum number of seats of a vehicle with “i=maxSeats” and then checks if there are any free seats from the maximum seat for example if you are trying on a bike as Havok said:

It has 2 maximum seats, then it checks if there is any free seat or both two seats are occupied


So as the result you can’t, change it because you are not going to just detain the players in only one specific vehicle.

if freeSeat ~= nil then TaskWarpPedIntoVehicle(playerPed, vehicle, freeSeat) end

This part says if there is even one freeSeat, detain or warp the player, as Havok says it works correctly and I think that you are making a mistake


Good luck!

It is not workin for me at all. When i put 1 guy in car i just cant put another one. No idea what im doin wrong :frowning:

How would i go about adding officer to the police job_grades?
because i see that officer is in the job_grades but isn’t in the SQL

if PlayerData.job.grade_name == ‘recruit’ then
table.insert(elements, {label = _U(‘cadet_wear’), value = ‘cadet_wear’})
end

if PlayerData.job.grade_name == ‘officer’ then
table.insert(elements, {label = _U(‘police_wear’), value = ‘police_wear’})
end

if PlayerData.job.grade_name == ‘sergeant’ then
table.insert(elements, {label = _U(‘sergeant_wear’), value = ‘sergeant_wear’})
end

in main.lua step1:

      if data.current.value == 'police_wear' then
        ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
          if skin.sex == 0 then
            SetPedComponentVariation(GetPlayerPed(-1), 3, 30, 0, 0)--Gants
            SetPedComponentVariation(GetPlayerPed(-1), 4, 35, 0, 0)--Jean
            SetPedComponentVariation(GetPlayerPed(-1), 6, 24, 0, 0)--Chaussure
            SetPedComponentVariation(GetPlayerPed(-1), 8, 58, 0, 0)--mattraque
            SetPedComponentVariation(GetPlayerPed(-1), 11, 55, 0, 0)--Veste
            SetPedComponentVariation(GetPlayerPed(-1), 10, 8, 0, 0)--Grade
            SetPedComponentVariation(GetPlayerPed(-1), 5, 0, 0, 2)  --Bag
            SetPedPropIndex(GetPlayerPed(-1), 2, 2, 0, 1)--Oreillete
            SetPedPropIndex(GetPlayerPed(-1), 6, 3, 0, 1)--Montre

            ClearPedProp(GetPlayerPed(-1),  0)  -- Helmet
          else
            TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
          end
        end)
      end

step 2

if PlayerData.job.grade_name == 'officer' then
    table.insert(elements, {label = _U('police_wear'), value = 'police_wear'})
	table.insert(elements, {label = _U('cop_wear'), value = 'cop_wear_freemode'})
    table.insert(elements, {label = _U('sheriff_wear'), value = 'sheriff_wear_freemode'})
	table.insert(elements, {label = _U('ranger_wear'), value = 'ranger_wear_freemode'})
	table.insert(elements, {label = _U('highway_wear'), value = 'highway_wear_freemode'})
	table.insert(elements, {label = _U('swat_wear'), value = 'swat_wear_freemode'})
  end

+step 3 en.lua:

  ['police_wear'] = 'Officer Outfit',

Just delete all the peds and keep police_wear in main.lua if you dont use peds on server. if you want to use peds,
go to config and enable Config.EnableNonFreemodePeds = true

3 Likes

Getting this error when loading up the server

Error parsing script config.lua in resource esx_policejob: config.lua:1: unexpec
ted symbol near ‘<\239>’
Failed to load script config.lua.
Error loading script server/main.lua in resource esx_policejob: server/main.lua:
5: attempt to index a nil value (global ‘Config’)
stack traceback:
server/main.lua:5: in main chunk
Failed to load script server/main.lua.

Need help with this ASAP

Thanks,

Liam

I could use some direction on how to go about getting the Uniform Menu to work properly. I’m referring to the marker at the Sandy Shores HQ where you can choose from a list of PEDS . PED doesn’t load (I’m assuming it has to be setup first) and the console shows a response from server.

Job outfits error

it doesn’t look like you have esx_skin
https://github.com/ESX-Org/esx_skin

Thanks Up Time, I’m grabbing that now and cross my fingers.

  • Perry

Be sure to grab the requirements of esx_skin also. That should work for you. Let me know