[Release] jsfour-idcard [ESX]

If you just read down a few more post… [Release] jsfour-idcard [ESX]

Can someone help me how can i use this script?i have no idea…im using zap hosting

Why i click on the key i choose to have the menu it only show the id not the menu !

How to get last digits to idcard?

You Will have to fetch it With the database in server.lua and after that you Will need to edit js, CSS.

where i put the usage code?

Anyone know how to add a verification of the user_licenses on the databases?
If i have on the database (user_licenses) the weapon type license then I can show and look my weapon license.

(Sorry for my bad English)


Getting this error client sided, no errors from server. :s

There’s an error in the resource esx_personmeny. It has nothing to do with my resource

The latest update checks if the player has the license before showing it. Since a lot of people have been asking me about this lately.

I’m too lazy to make a locale file for one line of text, you can change it in the server.lua.

How do make the “example menu” trigger by a key example when i press “E” ?

sorry keyboard broken X)

There’s a pastebin link at the GitHub you can look at

1 Like

how to config this script?

hi ive try edit this code, add some new field ‘job grade’
my server.lua look

local ESX = nil
-- ESX
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

-- Open ID card
RegisterServerEvent('jsfour-idcard:open')
AddEventHandler('jsfour-idcard:open', function(ID, targetID, type)
	local identifier = ESX.GetPlayerFromId(ID).identifier
	local _source 	 = ESX.GetPlayerFromId(targetID).source

	MySQL.Async.fetchAll('SELECT firstname, lastname, dateofbirth, sex, height FROM users WHERE identifier = @identifier', {['@identifier'] = identifier},
	function (user)
		MySQL.Async.fetchAll('SELECT job_grades.label FROM users INNER JOIN job_grades ON users.job = job_grades.job_name WHERE users.identifier=@identifier && users.job_grade = job_grades.grade', {['@identifier'] = identifier},
		function (grades)
			if (user[1] ~= nil) then
				MySQL.Async.fetchAll('SELECT type FROM user_licenses WHERE owner = @identifier', {['@identifier'] = identifier},
				function (licenses)
					local array = {
						user = user,
						grades = grades,
						licenses = licenses
					}
					TriggerClientEvent('jsfour-idcard:open', _source, array, type)
				end)
			end
		end)
	end)
end)


i have in init.js additional var grade = event.data.array[‘grade’];
and its not working. Some ideas to fix it?

Have you tried to print the table you get from the database?
It returns {"label":"name of grade" }

Which means you can’t access the name of the grade just by doing event.data.array[‘grade’];

Where i add these things ? (Sorry my english is bad)

Run them like every other resource

Can you help me with this code

-- ### Event usages:

-- Look at your own ID-card
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))

-- 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('No players nearby')
end


-- Look at your own driver license
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'driver')

-- 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('No players nearby')
end


-- Look at your own firearms license
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()), 'weapon')

-- 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('No players nearby')
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)
		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')
		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('No players nearby')
			end
		end
	end,
	function(data, menu)
		menu.close()
	end
)
end

I don’t know where to add this, i’m using esx_personmeny

Hi,
if you want my files for jsfour idcard and nb_menuperso, look my new tuto in YT, i share my files in description. Is for jsfour in the menu.
I’m french sorry for english people but you can dl the files and copy&paste.

3 Likes