├── version └── version.lua ├── server └── main.lua ├── client ├── point.lua ├── createnpc.lua └── menu.lua ├── README.md ├── fxmanifest.lua └── config.lua /version/version.lua: -------------------------------------------------------------------------------- 1 | lib.versionCheck('alp1x/um-idcard-menu') -------------------------------------------------------------------------------- /server/main.lua: -------------------------------------------------------------------------------- 1 | RegisterNetEvent('um-idcard-npc:server:AddItemtoExport', function(args) 2 | local src = source 3 | exports['um-idcard']:CreateMetaLicense(src, args.itemName) 4 | TriggerClientEvent('um-idcard-npc:client:OxNotify', src, args.itemName) 5 | end) 6 | 7 | lib.callback.register('um-idcard-menu:hasPermission', function(source, meta) 8 | return exports.qbx_core:GetPlayer(source).PlayerData.metadata.licences[meta] 9 | end) 10 | -------------------------------------------------------------------------------- /client/point.lua: -------------------------------------------------------------------------------- 1 | local idCardNpcPoint = lib.points.new(Config.NPC.coords, 2) 2 | 3 | function idCardNpcPoint:onEnter() 4 | lib.showTextUI('[E] - Identity Menu', {position = "left-center",icon = 'id-card'}) 5 | end 6 | 7 | function idCardNpcPoint:onExit() 8 | lib.hideTextUI() 9 | end 10 | 11 | function idCardNpcPoint:nearby() 12 | if self.currentDistance < 1 and IsControlJustReleased(0, 38) then 13 | lib.showContext("identity_menu") 14 | end 15 | end -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # um-idcard-menu 2 | 3 | ![](https://cdn.discordapp.com/attachments/1082006975212163092/1096813844497715231/image.png) 4 | 5 | This is a simple **[um-idcard](https://github.com/alp1x/um-idcard)** menu that allows you to select an identity card. Once you have selected a card, it is provided to you and the option to obtain the same card again is disabled. 6 | 7 | ## Permissions support 8 | Currently supports checking if user has permissions to get the card. But only on Qbox Framework. 9 | -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | game 'gta5' 3 | lua54 'yes' 4 | 5 | name 'um-idcard-menu' 6 | author 'uyuyorum {um}' 7 | version '1.0.0' 8 | license 'GPL-3.0 license' 9 | repository 'https://github.com/alp1x/um-idcard-menu' 10 | description 'UM Identity Card Menu ox_lib' 11 | 12 | shared_scripts { 13 | 'config.lua', 14 | '@ox_lib/init.lua', 15 | } 16 | 17 | client_scripts { 18 | 'client/*.lua' 19 | } 20 | 21 | server_scripts { 22 | 'server/main.lua', 23 | 'version/version.lua' 24 | } 25 | 26 | dependencies { 27 | 'um-idcard', 28 | 'ox_lib' 29 | } 30 | -------------------------------------------------------------------------------- /config.lua: -------------------------------------------------------------------------------- 1 | Config = {} 2 | 3 | Config.NPC = { 4 | coords = vector4(-254.73, -943.24, 31.22, 250.34), 5 | model = 'a_m_m_business_01' 6 | } 7 | 8 | Config.CheckPermissions = true 9 | 10 | Config.MenuCards = { 11 | { 12 | title = 'ID Card', 13 | icon = 'id-card', 14 | metaName = 'id', 15 | args = { 16 | itemName = 'id_card' 17 | } 18 | }, 19 | { 20 | title = 'Driver License', 21 | icon = 'car', 22 | metaName = 'driver', 23 | args = { 24 | itemName = 'driver_license' 25 | } 26 | }, 27 | } 28 | -------------------------------------------------------------------------------- /client/createnpc.lua: -------------------------------------------------------------------------------- 1 | local function ReqModel() 2 | local npcModel = GetHashKey(Config.NPC.model) 3 | RequestModel(npcModel) 4 | while not HasModelLoaded(npcModel) do 5 | Wait(100) 6 | end 7 | return npcModel 8 | end 9 | 10 | CreateThread(function() 11 | local npcPed = CreatePed(4, ReqModel(), Config.NPC.coords.x, Config.NPC.coords.y, Config.NPC.coords.z - 1, Config.NPC.coords.w, false, false) 12 | SetBlockingOfNonTemporaryEvents(npcPed, true) 13 | SetEntityInvincible(npcPed, true) 14 | SetPedFleeAttributes(npcPed, 0, 0) 15 | FreezeEntityPosition(npcPed, true) 16 | TaskStartScenarioInPlace(npcPed, "WORLD_HUMAN_CLIPBOARD", 0, true) 17 | end) 18 | -------------------------------------------------------------------------------- /client/menu.lua: -------------------------------------------------------------------------------- 1 | local identityMenu = { 2 | id = 'identity_menu', 3 | title = 'Select identity', 4 | options = {}, 5 | } 6 | 7 | for i = 1, #Config.MenuCards, 1 do 8 | if not Config.CheckPermissions or lib.callback.await('um-idcard-menu:hasPermission', false, Config.MenuCards[i].metaName) then 9 | identityMenu.options[#identityMenu.options + 1] = { 10 | title = Config.MenuCards[i].title, 11 | icon = Config.MenuCards[i].icon, 12 | serverEvent = 'um-idcard-npc:server:AddItemtoExport', 13 | args = Config.MenuCards[i].args, 14 | disabled = false, 15 | onSelect = function() 16 | identityMenu.options[i].disabled = true 17 | lib.registerContext({identityMenu}) 18 | end, 19 | } 20 | end 21 | end 22 | 23 | lib.registerContext({identityMenu}) 24 | 25 | RegisterNetEvent('um-idcard-npc:client:OxNotify', function(itemName) 26 | lib.notify({title = 'Identity Menu', description = 'Your identity has been approved: ' ..itemName, icon = 'id-card'}) 27 | end) 28 | --------------------------------------------------------------------------------