if you used the one i posted above you will need to add the others to the list
yeah trying to figure out on where to add the other ones and what code exactly, and yes i have used the one you posted above. I can’t seem to figure out how do i add those other cards
can you post screeshot on your file if you added them so i could see exactly where to put that code thanks
trying to learn this so badly
function OpenShowGiveID()
ESX.UI.Menu.Open(
'default', GetCurrentResourceName(), 'id_card_menu',
{
title = _U('id_menu'),
elements = {
{label = _U('check_id'), value = 'check'},
{label = _U('show_id'), value = 'show'}
}
},
function(data2, menu2)
if data2.current.value == 'check' then
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(PlayerId()))
elseif data2.current.value == 'show' then
local player, distance = ESX.Game.GetClosestPlayer()
if distance ~= -1 and distance <= 3.0 then
TriggerServerEvent('jsfour-idcard:open', GetPlayerServerId(PlayerId()), GetPlayerServerId(player))
OpenTrashCan()
else
OpenAttansCan()
ESX.ShowNotification(_U('nobody_near'))
end
end
end,
function(data2, menu2)
menu2.close()
OpenCivilianActionsMenu()
end
)
end
nice thanks so i was modifying the right file but didn’t seem to get it to work, need to tamper with it some more
This is one with all the jsfour id cards in it.
Im not running esx anymore so i could test if i missed a comma anywhere so just let me know…
jsfour id menu-all ids.rar (5.6 MB)
hi jsfour, thank you for your sharing of scripts, I would like to know how to add the head of our character on the ID card, I try this:
client side:
SetEntityAsMissionEntity (GetPlayerPed (-1))
local PED_ID = NetworkGetNetworkIdFromEntity (GetPlayerPed (-1))
TriggerServerEvent (‘jsfour-idcard: open’, playerTarget, PED_ID)
server side:
RegisterNetEvent (“jsfour-idcard: open”)
AddEventHandler (“jsfour-idcard: open”, function (PED_ID)
local handle = RegisterPedheadshot (PED_ID)
while not IsPedheadshotReady (handle) do
Wait (100)
end
local headshot = GetPedheadshotTxdString (handle)
while true do
Wait (20)
DrawSprite (headshot, headshot, 0.40, 0.4, 0.09, 0.18, 0.0, 255, 255, 255, 1000)
end
end)
possible ?
im getting an error:
Error running system event handling function for resource jsfour-idcard: citizen:/scripting/lua/scheduler.lua:41: Failed to execute thread: server.lua:8: attempt to index a nil value (upvalue 'ESX')
stack traceback:
server.lua:8: in upvalue 'handler'
citizen:/scripting/lua/scheduler.lua:219: in function <citizen:/scripting/lua/scheduler.lua:218>
stack traceback:
[C]: in function 'error'
citizen:/scripting/lua/scheduler.lua:41: in field 'CreateThreadNow'
citizen:/scripting/lua/scheduler.lua:218: in function <citizen:/scripting/lua/scheduler.lua:182>
i just made a clean install
How do i use the menu from your code?
-- 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
Would probably be possible if you position the sprite correctly
Looks like you don’t have ESX installed
but I do ?
Is there anyway you can add car insurance card too?
Also have it where it will show all at once?
Thanks
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