[Release] jsfour-idcard [ESX]

but I do ?

Is there anyway you can add car insurance card too?
Also have it where it will show all at once?
Thanks

1 Like

Hey really nice release @jsfour really like it, big props. ive use ur id sens it came out and i like it easy to use. but there seems to be a problem for me, for some reason when i go in to my meny and press ID Cards, then every card is Shown to players nearby and checking them yourself. so u get all of them overlapping. and i havent even selected Show/Check in the undermeny… ive been redoing it and trying for hours now. u know why?

-- Servern callback
RegisterNetEvent('jsfour-idcard:open')
AddEventHandler('jsfour-idcard:open', function(playerData)
	cardOpen = true
	SendNUIMessage({
		action = "open",
		array = playerData
	})
end)

Citizen.CreateThread(function()
    while ESX == nil do
        TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
        Citizen.Wait(0)
    end
end)

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
  PlayerData = xPlayer   
end)

function OpenCivilianActionsMenu()

  ESX.UI.Menu.CloseAll()

  ESX.UI.Menu.Open(
  'default', GetCurrentResourceName(), 'civilian_actions',
  {
    title    = 'Personal Menu',
    align    = 'bottom-right',
    elements = {
      {label = 'ID-Cards', value = 'id_kort'},
    }
  },
    
    function(data, menu)

      if data.current.value == 'id_kort' then
        ESX.UI.Menu.CloseAll()

        ESX.UI.Menu.Open(
          'default', GetCurrentResourceName(), 'id_kort',
          {
            title    = 'Identification',
            align    = 'bottom-right',
            elements = {
                  {label = 'Check your ID Card', value = 'checkID'},
                  {label = 'Show your ID Card', value = 'showID'},
                  {label = 'Check your driver license', value = 'checkDriver'},
                  {label = 'Show your driver license', value = 'showDriver'},
                  {label = 'Check your firearms license', value = 'checkFirearms'},
                  {label = 'Show your firearms license', value = 'showFirearms'}
            }
          },
	function(data, menu)
		local val = data.current.value
		
		if val == 'checkID' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
		elseif val == 'checkDriver' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')
		elseif val == 'checkFirearms' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')
			--ESX.ShowNotification('~w~You are checking your Weapon license')
		else
			local player, distance = ESX.Game.GetClosestPlayer()
			
			if distance ~= -1 and distance <= 3.0 then
				if val == 'showID' then
				TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
				elseif val == 'showDriver' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver')
				elseif val == 'showFirearms' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon')
				end
			else
			 -- ESX.ShowNotification('~r~There is no one nearby')
			end
		end
	end,
        function(data, menu)
          menu.close()
          OpenCivilianActionsMenu()
        end
        )
      end

		-- Look at your own ID-card
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
			ESX.ShowNotification('~w~You are checking your ID card')

		-- Show your ID-card to the closest person
		local player, distance = ESX.Game.GetClosestPlayer()

		if distance ~= -1 and distance <= 3.0 then
		TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
		else
		ESX.ShowNotification('~r~There is no one near you to show your ID too.')
	end

		-- Look at your own driver license
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')
			ESX.ShowNotification('~w~You are checking your Driver license')

		-- Show your driver license to the closest person
		local player, distance = ESX.Game.GetClosestPlayer()

		if distance ~= -1 and distance <= 3.0 then
		TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver')
		else
		ESX.ShowNotification('~r~There is no one near you to show your Driver license.')
	end


		-- Look at your own firearms license
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')
			ESX.ShowNotification('~w~You are checking your Weapon license')
		-- Show your firearms license to the closest person
			local player, distance = ESX.Game.GetClosestPlayer()

			if distance ~= -1 and distance <= 3.0 then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon')
			else
			ESX.ShowNotification('~r~There is no one near you to show your weapon license.')
end
    end,
    function(data, menu)
      menu.close()
    end
  )
end

And how can I do that you only can show your id, driver license and your weapon license if you have these items in your inventory?

Im sorry for the headache,but i am confused on how to install this. Is it its own resource that can start and work, or do you have to install the “example” give on github in a already made resource (I.E. es_extended)? If you could help me with this id greatly appreciate it.

To be able to use it you need to add the triggers in a menu or something provided at the github under USAGE.

Ok, silly question do you recommend a menu to install it in? Or can I install it in es extended and use it under the F2 menu?

You should never add stuff to es_extended since it’s the core of the whole ESX framework. Either create a new resource or add it inside the jsfour-idcard.

And I don’t know what you want to use. If you wan’t to use a menu for it, then use a menu for it?

ok thank you for the help

First nice script. I have added the driver and weaon licenses as items in my database and know I want that you can only show your weapon and driver license when you have these in your inventory. How can I do that can you show it to me please. I am very crateful. Im looking forward to hearing from you.

Hello, I would like to add in the menu for a category to see the ID cards license of arms and car license

thanks for the help

https://hastebin.com/negoniwezo.rb

It works perfectly, what I can not find is to put a button to hide the id, by default it is in the “v” and it is annoying me, since I have the camera change there, could you help me? I was testing and it does not change :confused:

thanks :smiley:

backspace button is to close it

how i can open the menu? please help me

You can’t. Implement it yourself or use the example menu in the description.

when i press on check your license or your id the card shown for a second and then disappear someone can help me? please

^ please

1 Like

you can change the default key?

Hello
Can someone explain to me how to replace the man and woman photo file by the photo of our character in the game?
I know you have to use: mugshot

How do i need to put this code in ?
I tried it to add more licenses but i get error’s :frowning:

1 Like