[Release] jsfour-idcard [ESX]

hi OP…i want to make a request or a question i guess…can you teach me or give me the js code to make firearm license to be like driving license? i mean firearm license will have weapon type just like driving license have vehicle type like bike, truck and car. btw your script is really great and i dont have any error installing it. I just wanna make firearm license have weapon type like driving license. If you can help me

What key do I show the ID to the person? default

would love to get your version with items instead of pushing a button to show id

That would be an awesome release.

Did you release it in the end?

I want to know it too

That’s easy to do you have the events already, just make a item and add those trigger when people use the item so you can show the id to other people.

So i’m having this issue with the id script. When someone dose /showid [#] the other person will get /viewid but then this error pops up in F8. https://i.imgur.com/BHKKoq5.png

How can i add this in the policejob for ID check, like that if an officer presses the button for ID check he will see the civillian his JSfour IDCARD

can i add in the aircraft license to this?

It took me hours to fix this and add buttons here you go replace your config with the code below. I use the L 182 button.

local open = false
local esx = nil

– esx
– Added this so you can include the rest of the Usage-stuff found on the GitHub page
Citizen.CreateThread(function()
while esx == nil do
TriggerEvent(‘esx:getSharedObject’, function(obj) esx = 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/

    -- 182 = l
    if IsControlJustReleased(0, 182) 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()
esx.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
esx.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 = esx.Game.GetClosestPlayer()

  if distance ~= -1 and distance <= 3.0 then
    TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
  else
    esx.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 = esx.Game.GetClosestPlayer()

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

)
end

1 Like

Can u share a file

Hey! I have programmed a Reworked Version of JSFOUR IDCARD!
It has a full customis Config file where you can add new card. and a build in menu!

Hey! I have programmed a Reworked Version of JSFOUR IDCARD!
It has a full customis Config file where you can add new card. and a build in menu!
[FiveM] [ESX] luca_idcard | A Reworked Version of jsfour-idcard you can use it if you want to

1 Like

Hey! I have programmed a Reworked Version of JSFOUR IDCARD!
It has a full customis Config file where you can add new card. and a build in menu!
[FiveM] [ESX] luca_idcard | A Reworked Version of jsfour-idcard you can use it if you want

Hi!

Is it possible to edit which are the licences a player start with?

I try to make a new player start with the id, and the driver licenses, but i cant get it.

thanks

I don’t think this works with onesync is there a way I can edit it to work with it?

Press F1

any way to make this an item

WORKING CODE FOR THOSE WHO NEEDED HELP OPENING A MENU W/ ID CARDS
Make this your ‘client.lua’

local open = false
local ESX = nil

TriggerEvent('esx:getSharedObject', function(obj) ESX = obj 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/
        if IsControlJustReleased(0, 243) then --` Key
            -- (Taken from the Usage-guide on the GitHub page)
            -- OpenIDMenu
            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()
  ESX.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
        ESX.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 = ESX.Game.GetClosestPlayer()

      if distance ~= -1 and distance <= 3.0 then
        TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
      else
        ESX.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 = ESX.Game.GetClosestPlayer()

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