CardOpen = false gCreatedBadgeProp = nil PData = {} Peds = {} DoScreenFadeIn(0) RegisterNetEvent('0r-idcard-pass-driver', function() local shot = exports['0r_idcard']:GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createCard", shot, "driver") end) -- CreateThread(function() -- local sleep = 1000 -- while true do -- Wait(sleep) -- local shot = GetBase64(PlayerPedId()) -- PData.photo = shot.base64 -- if next(PData) == nil then -- sleep = 1000 -- else -- break -- end -- end -- end) CreateThread(function() local fakeCardPed = createPedOnCoord(Config.FakeCardPed.model, Config.FakeCardPed.coords.x, Config.FakeCardPed.coords.y, Config.FakeCardPed.coords.z, Config.FakeCardPed.coords.w) local GeneralCardPed = createPedOnCoord(Config.GeneralCardPed.model, Config.GeneralCardPed.coords.x, Config.GeneralCardPed.coords.y, Config.GeneralCardPed.coords.z, Config.GeneralCardPed.coords.w) local JobCardPed = createPedOnCoord(Config.JobCardPed.model, Config.JobCardPed.coords.x, Config.JobCardPed.coords.y, Config.JobCardPed.coords.z, Config.JobCardPed.coords.w) table.insert(Peds, fakeCardPed) table.insert(Peds, GeneralCardPed) table.insert(Peds, JobCardPed) if Config.InteractType == 'drawtext' then local sleep = 1000 while true do Wait(sleep) local playerPed = PlayerPedId() local coords = GetEntityCoords(playerPed) local dist2 = #(coords - vector3(Config.FakeCardPed.coords.x, Config.FakeCardPed.coords.y, Config.FakeCardPed.coords.z)) local dist3 = #(coords - vector3(Config.GeneralCardPed.coords.x, Config.GeneralCardPed.coords.y, Config.GeneralCardPed.coords.z)) local dist4 = #(coords - vector3(Config.JobCardPed.coords.x, Config.JobCardPed.coords.y, Config.JobCardPed.coords.z)) if dist2 < 2 then sleep = 0 DrawText3D(_t("IdCard.press_e_fake_card"), Config.FakeCardPed.coords.x, Config.FakeCardPed.coords.y, Config.FakeCardPed.coords.z + 1, 0.03, 0.03) if IsControlJustPressed(0, 38) then lib.showContext('fake_id_card') end elseif dist3 < 2 then sleep = 0 DrawText3D(_t("IdCard.press_e_general_card"), Config.GeneralCardPed.coords.x, Config.GeneralCardPed.coords.y, Config.GeneralCardPed.coords.z + 1, 0.03, 0.03) if IsControlJustPressed(0, 38) then lib.showContext('general_card') end elseif dist4 < 2 then sleep = 0 DrawText3D(_t("IdCard.press_e_job_card"), Config.JobCardPed.coords.x, Config.JobCardPed.coords.y, Config.JobCardPed.coords.z + 1, 0.03, 0.03) if IsControlJustPressed(0, 38) then if isJobAllowed(Config.Jobs) then lib.showContext('job_card') end end else sleep = 1000 end end elseif Config.InteractType == 'qb-target' then exports['qb-target']:AddTargetEntity(fakeCardPed, { options = { { label = _t("IdCard.create_fake_card"), icon = 'fas fa-tasks', action = function() lib.showContext('fake_id_card') end } }, distance = 2.0 }) exports['qb-target']:AddTargetEntity(GeneralCardPed, { options = { { label = _t("IdCard.create_general_cards"), icon = 'fas fa-tasks', action = function() lib.showContext('general_card') end } }, distance = 2.0 }) exports['qb-target']:AddTargetEntity(JobCardPed, { options = { { label = _t("IdCard.create_job_cards"), icon = 'fas fa-tasks', action = function() lib.showContext('job_card') end } }, distance = 2.0 }) elseif Config.InteractType == 'ox_target' then exports.ox_target:addLocalEntity(fakeCardPed, { { name = 'fake_id_card', onSelect = function() lib.showContext('fake_id_card') end, icon = 'fas fa-tasks', label = _t("IdCard.create_fake_card"), distance = 2.0 } }) exports.ox_target:addLocalEntity(GeneralCardPed, { { name = 'general_card', onSelect = function() lib.showContext('general_card') end, icon = 'fas fa-tasks', label = _t("IdCard.create_general_cards"), distance = 2.0 } }) exports.ox_target:addLocalEntity(JobCardPed, { { name = 'job_card', onSelect = function() lib.showContext('job_card') end, icon = 'fas fa-tasks', label = _t("IdCard.create_job_cards"), distance = 2.0 } }) end end) lib.registerContext({ id = 'fake_id_card', title = _t("IdCard.fake_id_card_menu_title"), options = { { title = _t("IdCard.create_id_card"), description = _t("IdCard.create_fake_id_desc"), onSelect = function() local input = lib.inputDialog(_t("IdCard.create_id_card"), { {type = 'input', label = _t("IdCard.name_label"), description = _t("IdCard.name_desc"), required = true, min = 2}, {type = 'input', label = _t("IdCard.surname_label"), description = _t("IdCard.surname_desc"), required = true, min = 2}, {type = 'date', label = _t("IdCard.birthdate_label"), icon = {'far', 'calendar'}, default = true, required = true, format = "DD/MM/YYYY"}, {type = 'checkbox', label = _t("IdCard.male_label")}, {type = 'checkbox', label = _t("IdCard.female_label")}, }) if input then local name = input[1] local surname = input[2] local birthdate = input[3] local male = input[4] local female = input[5] if male and female then Config.Notify(_t("IdCard.gender_both_error"), "error") elseif not male and not female then Config.Notify(_t("IdCard.gender_none_error"), "error") else local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createFakeCard", name, surname, "citizen", birthdate, male, female, shot, "citizen") end end end, }, { title = _t("IdCard.create_job_id_card"), description = _t("IdCard.create_fake_job_desc"), onSelect = function() local jobs = "" for k, v in pairs(Config.CardTypes) do if k ~= "citizen" then jobs = jobs .. k .. ", " end end local input = lib.inputDialog(_t("IdCard.create_job_id_card"), { {type = 'input', label = _t("IdCard.name_label"), description = _t("IdCard.name_desc"), required = true, min = 2}, {type = 'input', label = _t("IdCard.surname_label"), description = _t("IdCard.surname_desc"), required = true, min = 2}, {type = 'input', label = _t("IdCard.job_label"), description = _t("IdCard.job_desc") .. jobs, required = true, min = 2}, {type = 'date', label = _t("IdCard.birthdate_label"), icon = {'far', 'calendar'}, default = true, required = true, format = "DD/MM/YYYY"}, {type = 'checkbox', label = _t("IdCard.male_label")}, {type = 'checkbox', label = _t("IdCard.female_label")}, }) if input then local name = input[1] local surname = input[2] local job = input[3] local birthdate = input[4] local male = input[5] local female = input[6] if not table_includes(Config.CardTypes, job) then Config.Notify(_t("IdCard.invalid_job"), "error") elseif male and female then Config.Notify(_t("IdCard.gender_both_error"), "error") elseif not male and not female then Config.Notify(_t("IdCard.gender_none_error"), "error") else local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createFakeCard", name, surname, job, birthdate, male, female, shot, "job") end end end, } } }) lib.registerContext({ id = 'general_card', title = _t("IdCard.general_cards_menu_title"), options = { { title = _t("IdCard.create_id_card"), description = _t("IdCard.create_id_desc"), onSelect = function() local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createCard", shot, "citizen") end, }, { title = _t("IdCard.create_driver_license"), description = _t("IdCard.create_driver_desc"), onSelect = function() local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createCard", shot, "driver") end, } } }) -- If weapon license is allowed, register a new context with the additional option if Config.GeneralCardPed.weaponlicenseAllow then local options = { { title = _t("IdCard.create_id_card"), description = _t("IdCard.create_id_desc"), onSelect = function() local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createCard", shot, "citizen") end, }, { title = _t("IdCard.create_driver_license"), description = _t("IdCard.create_driver_desc"), onSelect = function() local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createCard", shot, "driver") end, }, { title = _t("IdCard.create_weapon_license"), description = _t("IdCard.create_weapon_desc"), onSelect = function() local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createCard", shot, "weapon") end, } } lib.registerContext({ id = 'general_card', title = _t("IdCard.general_cards_menu_title"), options = options }) end lib.registerContext({ id = 'job_card', title = _t("IdCard.job_cards_menu_title"), options = { { title = _t("IdCard.create_job_card"), description = _t("IdCard.create_job_desc"), onSelect = function() local shot = GetBase64(PlayerPedId()) TriggerServerEvent("0r_idcard:server:createCard", shot, "job") end, } } })