From 50b8bcd20e49b42883737dc35e9dc3e98e9416e3 Mon Sep 17 00:00:00 2001 From: bitpredator <67551273+bitpredator@users.noreply.github.com> Date: Sat, 18 May 2024 18:57:43 +0200 Subject: [PATCH] feat: bpt_idcard\client\main.lua --- .../[bpt_addons]/bpt_idcard/client/main.lua | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 server-data/resources/[bpt_addons]/bpt_idcard/client/main.lua diff --git a/server-data/resources/[bpt_addons]/bpt_idcard/client/main.lua b/server-data/resources/[bpt_addons]/bpt_idcard/client/main.lua new file mode 100644 index 000000000..c8c2b95d3 --- /dev/null +++ b/server-data/resources/[bpt_addons]/bpt_idcard/client/main.lua @@ -0,0 +1,25 @@ +local open = false + +-- Open ID card +RegisterNetEvent("bpt_idcard:open") +AddEventHandler("bpt_idcard:open", function(data, type) + open = true + SendNUIMessage({ + action = "open", + array = data, + type = type, + }) +end) + +-- Key events +CreateThread(function() + while true do + Wait(0) + if IsControlJustReleased(0, 322) and open or IsControlJustReleased(0, 177) and open then + SendNUIMessage({ + action = "close", + }) + open = false + end + end +end)