Police off duty remove guns

Hi there,

I am using OnDuty for Police.
My question is that I am trying to remove the guns when police goes off duty so they dont carry their guns as normal civilians. Is it possible to make it so when a police goes off duty it removes their uniform and gives back their weapons they has as civilians and remove the police ones?

Hope yall can help me. Thank you.

if you are using ESX try this


ESX            = nil
local lastjob	=nil
local PlayerData = {}

Citizen.CreateThread(function ()
  while ESX == nil do
    TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
    Citizen.Wait(0)
  end
  while ESX.GetPlayerData().job == nil do
		Citizen.Wait(100)
	end
	PlayerData = ESX.GetPlayerData()
	lastjob = PlayerData.job.name
  end)
  
  
 RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)

 if lastjob =='police' then
RemoveAllPedWeapons(PlayerPedId(),true)
 end
lastjob=job.name
end)

Thank you for your reply.

Is it also possible that it will give back the weapons you had as civilian (Off Duty)?

thats script work if you use


for duty
.
but if you want remove weapon when change clothes
add RemoveAllPedWeapons(PlayerPedId(),true) on client.lua in esx_policejob

if data.current.value == 'citizen_wear' then
RemoveAllPedWeapons(PlayerPedId(),true) --- < HIRE To remove weapon when use citizen wear
			if Config.EnableCustomPeds then
				ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
					local isMale = skin.sex == 0

					TriggerEvent('skinchanger:loadDefaultModel', isMale, function()
						ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
							TriggerEvent('skinchanger:loadSkin', skin)
							TriggerEvent('esx:restoreLoadout')
						end)
					end)

				end)
			else
				ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin)
					TriggerEvent('skinchanger:loadSkin', skin)
				end)
			end

Hi i use qbcore ?