diff --git a/resources/[inventory]/pl_printer/client/main.lua b/resources/[inventory]/pl_printer/client/main.lua index d770667c0..38a4067b3 100644 --- a/resources/[inventory]/pl_printer/client/main.lua +++ b/resources/[inventory]/pl_printer/client/main.lua @@ -1,158 +1,79 @@ - -local spawnedObjects = {} - -local imageDisplayed = false - -RegisterNetEvent('pl_printer:notification') -AddEventHandler('pl_printer:notification', function(message, type) - - if Config.Notify == 'ox' then - TriggerEvent('ox_lib:notify', {description = message, type = type or "success"}) - elseif Config.Notify == 'esx' then - Notification(message) - elseif Config.Notify == 'okok' then - TriggerEvent('okokNotify:Alert', message, 6000, type) - elseif Config.Notify == 'qb' then - Notification(message, type) - elseif Config.Notify == 'wasabi' then - exports.wasabi_notify:notify('Printer', message, 6000, type, false, 'fas fa-ghost') - elseif Config.Notify == 'custom' then - -- Add your custom notifications here - end -end) - -function disableControls() - SetEntityInvincible(PlayerPedId(), true) - FreezeEntityPosition(PlayerPedId(), true) -end - -function enableControls() - SetEntityInvincible(PlayerPedId(), false) - FreezeEntityPosition(PlayerPedId(), false) -end - -RegisterNetEvent("pl_printer:showImageQB") -AddEventHandler("pl_printer:showImageQB", function(imageName) - TriggerServerEvent('pl_printer:fetchImageLink',imageName) -end) - -RegisterNetEvent("pl_printer:showImage") -AddEventHandler("pl_printer:showImage", function(imageName) - if not imageDisplayed then - imageDisplayed = true - SetNuiFocus(true, true) - SendNUIMessage({ - action = "show", - imageUrl = imageName - }) - disableControls() - end -end) - -RegisterNUICallback('hideFrame', function(data, cb) - imageDisplayed = false - SetNuiFocus(false, false) - enableControls() -end) - -RegisterNetEvent("pl_printer:openprinter") -AddEventHandler("pl_printer:openprinter", function() - - local input = lib.inputDialog('Print Menu', { - {type = 'input', label = Locale("image_link"), description = Locale("image_url"), required = true}, - {type = 'number', label = Locale("copies"), description = Locale("image_url"),required = true,placeholder='1', icon = 'hashtag'}, - - }) - if input then - if input[1] and input[2] then - TriggerServerEvent('pl_printer:insertImageData', input[1], input[2]) - else - _debug('[DEBUG] '..'Invalid Input'..'') - end - end -end) - -for _, model in ipairs(Config.PrinterModel) do - if GetResourceState('qb-target') == 'started' then - exports['qb-target']:AddTargetModel(model, { - options = { - { - icon = 'fa-solid fa-print', - label = Locale("prints"), - action = function(data) - TriggerEvent('pl_printer:openprinter') - end, - }, - }, - distance = 2 - }) - elseif GetResourceState('qtarget') == 'started' or GetResourceState('ox_target') == 'started'then - exports.ox_target:addModel(model, { - { - name = 'printer_interaction', - label = Locale("prints"), - icon = 'fa-solid fa-print', - onSelect = function(data) - TriggerEvent('pl_printer:openprinter') - end, - distance = 2, + + + + + + + + + + +
+ Document +
+
+ + + diff --git a/resources/[inventory]/pl_printer/server/main.lua b/resources/[inventory]/pl_printer/server/main.lua index 06ba45d71..38a4067b3 100644 --- a/resources/[inventory]/pl_printer/server/main.lua +++ b/resources/[inventory]/pl_printer/server/main.lua @@ -1,98 +1,79 @@ -if GetResourceState('qb-core') == 'started' then -QBCore = exports['qb-core']:GetCoreObject() -elseif GetResourceState('es_extended') == 'started' then -ESX = exports['es_extended']:getSharedObject() -end -local resourceName = 'pl_printer' -lib.versionCheck('pulsepk/pl_printer') - -RegisterServerEvent('pl_printer:insertImageData') -AddEventHandler('pl_printer:insertImageData', function(imageUrl, amount) - local Player = getPlayer(source) - local account = Config.Print.Account - local TotalBill = Config.Print.Price*amount - if GetPlayerAccountMoney(Player,account,TotalBill) then - local imageName = imageUrl:match(".*/(.*)$") - AddItem(source,amount, imageName) - if imageUrl and amount then - MySQL.Async.execute('INSERT INTO printer (image_name, image_link) VALUES (@image_name, @image_link)', { - ['@image_name'] = tostring(imageName), - ['@image_link'] = imageUrl - }, function(rowsChanged) + + + + + + + + + + +
+ Document +
+
+ + + diff --git a/resources/[inventory]/pl_printer/web/index.html b/resources/[inventory]/pl_printer/web/index.html index ad8931e32..38a4067b3 100644 --- a/resources/[inventory]/pl_printer/web/index.html +++ b/resources/[inventory]/pl_printer/web/index.html @@ -10,39 +10,70 @@ margin: 0; padding: 0; overflow: hidden; + background-color: rgba(0, 0, 0, 0.7); } - #image { + #image-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: 90%; max-height: 90%; + display: none; + } + #image { + max-width: 100%; + max-height: 100%; + } + #document-id { + position: absolute; + bottom: 10px; + left: 10px; + color: white; + background-color: rgba(0, 0, 0, 0.5); + padding: 5px; + border-radius: 3px; + font-family: Arial, sans-serif; } - +
+ Document +
+