[Release] [ESX] [Police Job]

So when adding more category’s to the fines list, It says ‘Translation [en] (Name of category) does not exist’

If anyone knows the fix for this, please let me know asap.

you just need to add that string in locale folder and write what is that.

Thanks, Figured it out on my own, but I appreciate the efforts!

1 Like

F6 menu

Something like this
Server:

RegisterServerEvent('esx_police:buyItem')
AddEventHandler('esx_police:buyItem', function()
  	TriggerEvent('esx_addonaccount:getSharedAccount', 'society_police', function(account)
	TriggerEvent('esx_addoninventory:getSharedInventory', 'society_police', function(inventory)

		if account.money >= 20then
		
		  TriggerClientEvent('esx:showNotification', source, 'You bought bread for $20')
		  
		  inventory.addItem('bread', 1)
		  account.removeMoney(20)
		  
		else
		  TriggerClientEvent('esx:showNotification', source, 'Error')
		end

	end)
	end)
end)

Client:

if data.current.value == 'buy_bread' then
	TriggerServerEvent('esx_police:buyItem')
end

Because the vehicle is on your account. This can be fixed by using another garagescript.

Hi guys , how can i add another type of vest (bulletproof_vest) for both female and male , i try and my esx_policejob wont start anymore…hope some kind soul can help me with this as i wan my traffic officer to have another bulletproof vest .

I’m getting an error when trying to use this if anyone’s on I’d love some help

Hey I was wondering if you could help me I have my weapons as items now which broke the armory how can I set it to where the armory sells items instead of just the regular weapons? I tried adding your code but it never worked

Someone can help me? I cant deposit items

thats notworking

it should works show me your code.

Possibility to lock/unlock police job vehicle ?

That is my Code for the getStockItem

RegisterServerEvent(‘esx_policejob:getStockItem’)
AddEventHandler(‘esx_policejob:getStockItem’, function(itemName, count)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local sourceItem = xPlayer.getInventoryItem(itemName)

TriggerEvent(‘esx_addoninventory:getSharedInventory’, ‘society_police’, function(inventory)
local inventoryItem = inventory.getItem(itemName)

  -- is there enough in the society?
  if count > 0 and inventoryItem.count >= count then

  	-- can the player carry the said amount of x item?
  	if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
  		TriggerClientEvent('esx:showNotification', _source, _U('quantity_invalid'))
  	else
  		inventory.removeItem(itemName, count)
  		xPlayer.addInventoryItem(itemName, count)
  		TriggerClientEvent('esx:showNotification', _source, _U('have_withdrawn', count, inventoryItem.label))
  	end
  else
  	TriggerClientEvent('esx:showNotification', _source, _U('quantity_invalid'))
  end

end)
end)

replace it with this because you dont delete source item.limit new esx format not work more with limit
so just remplace your shared code with mine then it should work :slight_smile:

AddEventHandler('esx_policejob:getStockItem', function(itemName, count)
	local _source = source
	local xPlayer = ESX.GetPlayerFromId(_source)
	local sourceItem = xPlayer.getInventoryItem(itemName)

	TriggerEvent('esx_addoninventory:getSharedInventory', 'society_police', function(inventory)
		local inventoryItem = inventory.getItem(itemName)
		if count > 0 and inventoryItem.count >= count then
			if xPlayer.canCarryItem(itemName, count) then
				inventory.removeItem(itemName, count)
				xPlayer.addInventoryItem(itemName, count)
				TriggerClientEvent('esx:showNotification', _source, _U('have_withdrawn', count, inventoryItem.label))
			else
				TriggerClientEvent('esx:showNotification', _source, _U('quantity_invalid'))
			end
		else
			TriggerClientEvent('esx:showNotification', _source, _U('quantity_invalid'))
		end
	end)
end) 

Thank you so much. It´s working now. Have a Nice Day man.

how do i make it so that when a player purchases a police vehicle it doesn’t go to there personal garage. I’m using esx_eden_garage2

anyone knows fix for armory duping…?

What kind of duping?

Im able to do lots of stuff. Im a dev running 4 RP Servers. If you need need something u could contact me i could provide you my IRC or Discord.

Best Regards,

Armory duping when 2 players open it the same time and takes weapon and then it dupes.