ESX Shop with Job Whitelist

Hi. Im currently working on a ESX Police Shop script. I want to whitelist the ESX police job for my Shop. I tryed a lot but it didn’t work for me. Can someone pls help me with that ? :slight_smile:

My script i tryed (but failed to work):

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(10)

		if CurrentAction == nil then
			Citizen.Wait(500)
		else
			ESX.ShowHelpNotification(CurrentActionMsg)

			if IsControlJustReleased(0, Keys['E']) then
				if CurrentAction == 'shop_menu' then
					if Config.PoliceJobEnable then
						if xPlayer.job.name == 'police' then
							OpenShopMenu()
						else
							ESX.ShowNotification(_U('not_a_cop'))
						end
2 Likes

The thing is you doing it wrong, don’t use, using server side functions in client side.

You should use if PlayerData.job.name == ‘police’ in client side.

1 Like

Oh ok thx :slight_smile: Yep im not that good in lua. Just being a 3D modeler trying my first lua edits :smiley: Hope it works.

If it not works, tell me, I’ll make it work :slight_smile:

3 Likes

I would like to see how this turns out

Doesnt work for me. I use esx_vehicleshop as a base btw. Its like a cardealer just for EMS stuff.

Upload here esx_vehicleshop. I gonna fix it and upload back :stuck_out_tongue:

1 Like

Thx to @Promil he did the fix for me.

This line is what you need to get it working:

if ESX.PlayerData.job.name == 'police' then

So it looks like this:

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(10)

		if CurrentAction == nil then
			Citizen.Wait(500)
		else
			ESX.ShowHelpNotification(CurrentActionMsg)

			if IsControlJustReleased(0, Keys['E']) then
				if CurrentAction == 'shop_menu' then
					if Config.PoliceJobEnable then
						if ESX.PlayerData.job.name == 'police' then 
							OpenShopMenu()
						else
							ESX.ShowNotification(_U('not_a_cop'))
						end
3 Likes

Dude i need whitelist a group for example an admin car categorie, can u help me please?

here is my esx esx_vehicleshop.rar (59.9 KB)

1 Like

When you have made an admin job in ESX you just need to add:

if ESX.PlayerData.job.name == 'admin' then

Just replace the license line in your client.lua and activte “use license” in the config.

is there someone that can help me with the esx_policejob cause I am tryin to fix the salary for cops and ems and the mechanic jobs you can pm me on discord atvman97#1997

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.