Files
red-valley/resources/[framework]/[addons]/0r_idcard/client/main.lua

164 lines
6.5 KiB
Lua
Raw Normal View History

2026-03-29 21:41:17 +03:00
CardOpen = false
gCreatedBadgeProp = nil
PData = {}
Peds = {}
DoScreenFadeIn(0)
CreateThread(function()
local sleep = 1000
while true do
Wait(sleep)
local shot = GetBase64(PlayerPedId())
TriggerServerEvent("0r_idcard:server:loadCard", shot.base64)
if next(PData) == nil then
sleep = 1000
else
sleep = 10000
end
end
end)
CreateThread(function()
local ped = createPedOnCoord(Config.HeadshotPed.model, Config.HeadshotPed.coords.x, Config.HeadshotPed.coords.y, Config.HeadshotPed.coords.z, Config.HeadshotPed.coords.w)
local fakeCardPed = createPedOnCoord(Config.FakeCardPed.model, Config.FakeCardPed.coords.x, Config.FakeCardPed.coords.y, Config.FakeCardPed.coords.z, Config.FakeCardPed.coords.w)
table.insert(Peds, ped)
table.insert(Peds, fakeCardPed)
-- qb-target pe NPC-ul de poza buletin
exports['qb-target']:AddTargetEntity(ped, {
options = {
{
icon = "fas fa-camera",
label = "Poza pentru buletin/ID",
action = function()
local ped = PlayerPedId()
2026-03-29 21:41:17 +03:00
-- Bubble text pt alte playeri
LocalPlayer.state:set("bubbleText", "Isi face poza pentru buletin...", true)
LocalPlayer.state:set("bubbleIcon", "📸", true)
LocalPlayer.state:set("browsingJobs", true, true)
2026-03-29 21:41:17 +03:00
-- Animatie de pozare (sta drept, mainile pe langa corp)
local dict = "mp_facial"
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do Wait(10) end
TaskPlayAnim(ped, dict, "mic_chatter_camera3", 2.0, -2.0, -1, 49, 0, false, false, false)
2026-03-29 21:41:17 +03:00
startMugshotAnimation()
Wait(250)
local result = GetBase64(PlayerPedId())
local shot = "assets/default.png"
2026-03-29 21:41:17 +03:00
if result.success then
shot = result.base64
end
-- Opreste animatia + bubble
ClearPedTasks(PlayerPedId())
LocalPlayer.state:set("browsingJobs", false, true)
Config.Notify(_t("headshot_taken"), "success")
TriggerServerEvent("0r_idcard:server:saveHeadshot", shot)
end,
},
},
distance = 2.0
})
-- qb-target pe NPC-ul de fake card
exports['qb-target']:AddTargetEntity(fakeCardPed, {
options = {
{
icon = "fas fa-id-card",
label = "Creeaza act fals",
action = function()
lib.showContext('fake_id_card')
end,
},
},
distance = 2.0
})
2026-03-29 21:41:17 +03:00
end)
2026-03-29 21:41:17 +03:00
lib.registerContext({
id = 'fake_id_card',
title = 'Create Fake ID Card',
options = {
{
title = 'Create ID Card',
description = 'Create a fake ID Card',
onSelect = function()
local input = lib.inputDialog('Create ID Card', {
{type = 'input', label = 'Name', description = 'Enter the name that will shown on the card', required = true, min = 2},
{type = 'input', label = 'Surname', description = 'Enter the surname that will shown on the card', required = true, min = 2},
{type = 'date', label = 'Birthdate', icon = {'far', 'calendar'}, default = true, required = true, format = "DD/MM/YYYY"},
{type = 'checkbox', label = 'Male'},
{type = 'checkbox', label = 'Female'},
})
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("You can only select one gender", "error")
elseif not male and not female then
Config.Notify("You must select a gender", "error")
else
local shot = GetBase64(PlayerPedId())
TriggerServerEvent("0r_idcard:server:createFakeCard", name, surname, "citizen", birthdate, male, female, shot.base64, "citizen")
end
end
end,
},
{
title = 'Create Job ID Card',
description = 'Create a fake job ID Card',
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('Create Job ID Card', {
{type = 'input', label = 'Name', description = 'Enter the name that will shown on the card', required = true, min = 2},
{type = 'input', label = 'Surname', description = 'Enter the surname that will shown on the card', required = true, min = 2},
{type = 'input', label = 'Job', description = 'Jobs are ' .. jobs, required = true, min = 2},
{type = 'date', label = 'Birthdate', icon = {'far', 'calendar'}, default = true, required = true, format = "DD/MM/YYYY"},
{type = 'checkbox', label = 'Male'},
{type = 'checkbox', label = 'Female'},
})
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("This job is not available", "error")
elseif male and female then
Config.Notify("You can only select one gender", "error")
elseif not male and not female then
Config.Notify("You must select a gender", "error")
else
local shot = GetBase64(PlayerPedId())
TriggerServerEvent("0r_idcard:server:createFakeCard", name, surname, job, birthdate, male, female, shot.base64, "job")
end
end
end,
}
}
})