[Release] jsfour-idcard [ESX]

How can I convert it to command to show ur id card and all that stuff?

esx_license. You can get it from the esx github. Import the .sql from esx_license and make sure you add a weapon license into the database. I’m newer to esx myself, but I believe this will help you.

https://github.com/ESX-Org/esx_license

For the people wondering. U can make an aircraft license show by editing the file server.lua
and edit the init.js in the js folder

i have upload it and add to my server the F5 menu is working but i can’t see my cards when i click on it. How can i solve this?

can someone help me make a menu for this please

how did you solve the undefined problem?
i really may need help with this

Hey, could you send this to me ? and i have a question, you fixed the server lua at line 8 error ?

I have the same error at line 8

SCRIPT ERROR: @jsfour-idcard/server.lua:8: attempt to index a nil value (upvalue ‘ESX’)

where do we put the code that was provided?

Hello everyone, how do I make it so I can open the menu with F5?

Why come out with a script and not add in what is needed to even make this useful? That is just being lazy.

Anyone care to help me out? I want to add in where I can view and show my license and weapons license.

hi all
Does anybody know how to add this to a police menu
so the police can grab the ID of the player closest near to them
I have been trying hours to do this With no result

To everyone struggling to get the menu working, here is the code, make this your client.lua. E to open Menu and Backspace to close. You can configure this in the code if you read it.

Make sure you do a search and replace and replace sc for ESX



local open = false
local sc  = nil
 
-- sc
-- Added this so you can include the rest of the Usage-stuff found on the GitHub page
Citizen.CreateThread(function()
    while sc == nil do
        TriggerEvent('sc:getSharedObject', function(obj) sc = obj end)
        Citizen.Wait(0)
    end
end)
 
-- Open ID card
RegisterNetEvent('jsfour-idcard:open')
AddEventHandler('jsfour-idcard:open', function( data, type )
    open = true
    SendNUIMessage({
        action = "open",
        array  = data,
        type   = type
    })
end)
 
-- Key events
Citizen.CreateThread(function()
    while true do
        Wait(0)
        -- Controls found in the FiveM docs:
        -- https://docs.fivem.net/game-references/controls/
 
        -- 38 = E
        if IsControlJustReleased(0, 38) then
            -- (Taken from the Usage-guide on the GitHub page)
            -- Look at your own ID-card
            openMenu()
        end
        if IsControlJustReleased(0, 322) and open or IsControlJustReleased(0, 177) and open then
            SendNUIMessage({
                action = "close"
            })
            open = false
        end
    end
end)

-- A menu (THIS IS AN EXAMPLE)
function openMenu()
  sc.UI.Menu.Open(
	'default', GetCurrentResourceName(), 'id_card_menu',
	{
		title    = 'ID menu',
		elements = {
			{label = 'Check your ID', value = 'checkID'},
			{label = 'Show your ID', 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)
		if data.current.value == 'checkFirearms' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')
		elseif data.current.value == 'showFirearms' then
			 if distance ~= -1 and distance <= 3.0 then
        TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'weapon')
      else
        sc.ShowNotification('No players nearby')
      end
		elseif data.current.value == 'checkID' then
			TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
    elseif data.current.value == 'showID' then
      local player, distance = sc.Game.GetClosestPlayer()

      if distance ~= -1 and distance <= 3.0 then
        TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
      else
        sc.ShowNotification('No players nearby')
      end
    elseif data.current.value == 'checkDriver' then
      TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')
    elseif data.current.value == 'showDriver' then
      local player, distance = sc.Game.GetClosestPlayer()

      if distance ~= -1 and distance <= 3.0 then
        TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player), 'driver')
      else
        sc.ShowNotification('No players nearby')
      end
		end
	end,
	function(data, menu)
		menu.close()
	end
)
end
1 Like

@Red_Rock_Roleplay Yes its really easy in esx_policejob/client/main.lua in line 270 it should say “OpenIdentityCardMenu(closestPlayer)” you need to replace it with “TriggerServerEvent(‘jsfour-idcard:open’, GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))” and it should work if you need any help let me know i may know how to help you. Have a nice day and be happy!

Why come out with a script and not add in what is needed to even make this useful? That is just being lazy.

I’m the lazy one? Have you even had a look in the readme? You have everything you need, even a working example. You literally have to copy and paste the events which you wanna use. What else do you need?

I never included a menu or a key-press event in the resource. Because it’s simple, I don’t want to force a server to use it in a certain way. It’s bad enough that I limited it to ESX when it’s not really dependent on it. But yeah the resource is 2 years old.

Every server has their own system of handling stuff. I find it easier to show how you’re supposed to use the events so the servers can easily adapt them to their own systems. I don’t want to create 4 different versions because of people that are incapable of copy pasting some lines of code

3 Likes

Hello, a question, how did you get the photo of the character to appear?

Hmm :thinking: always when i go to my server, id card pop up. Whats wrong with this?

Hi :smiley: everything it working really lovely but im just using ems insurance where table it different, it makes like server file is importing to essentialmode.user its any chance to get help with that ? thanks for time

1 Like

el problema que al mostrar a otra persona no muestra tu personaje. muestra la foto del personaje de quien la ve pero los nombres si esta bien

I dont see the document, please can you help me?