neuer printer
This commit is contained in:
		
							parent
							
								
									a1e9027648
								
							
						
					
					
						commit
						c917371845
					
				
					 33 changed files with 476 additions and 665 deletions
				
			
		|  | @ -1,6 +0,0 @@ | |||
| github: # | ||||
| patreon: # | ||||
| open_collective: # | ||||
| ko_fi: # | ||||
| buy_me_a_coffee: pulsepk | ||||
| custom: ["https://pulsescripts.tebex.io/"] | ||||
|  | @ -1,37 +0,0 @@ | |||
| name: Release | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     tags: | ||||
|       - 'v*' | ||||
|  | ||||
| permissions: | ||||
|   contents: write | ||||
|  | ||||
| jobs: | ||||
|   create-release: | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
|     steps: | ||||
|       - name: Checkout code | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: Zip repository with folder | ||||
|         run: | | ||||
|           mkdir temp | ||||
|           repo_name=$(basename $GITHUB_REPOSITORY) | ||||
|           mkdir temp/$repo_name | ||||
|           shopt -s extglob | ||||
|           cp -r !(temp|.git) temp/$repo_name/ | ||||
|           cd temp | ||||
|           zip -r ../$repo_name.zip $repo_name | ||||
|           cd .. | ||||
|  | ||||
|       - name: Create GitHub release | ||||
|         uses: softprops/action-gh-release@v1 | ||||
|         with: | ||||
|           name: Release ${{ github.ref_name }} | ||||
|           tag_name: ${{ github.ref_name }} | ||||
|           files: ${{ github.event.repository.name }}.zip | ||||
|         env: | ||||
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|  | @ -1,35 +0,0 @@ | |||
| # Pulse Printer | ESX, QBCore, QBox | ||||
|  | ||||
| ## | ||||
|  | ||||
|  | ||||
| ## | ||||
| ![Video Preview] (https://youtu.be/4yrAf1gWQps) | ||||
|  | ||||
| Check the below documentation link for installation | ||||
| ## Documentation | ||||
| https://docs.pulsescripts.dev/ | ||||
| ## | ||||
|  | ||||
| ## Features | ||||
| ###### | ||||
| - Support ESX, QBCore, QBox Frameworks | ||||
| - Print Any Document You Want | ||||
| - Spawns Printer at any location | ||||
| - qb-target, qtarget, ox_target | ||||
| - Deduct Money For Prints | ||||
|  | ||||
| ###### | ||||
|  | ||||
| ## | ||||
| Only Fivemanage Links will work cause others are blocked by FiveM | ||||
| ## | ||||
| ## Support, Scripts & More | ||||
| - [Script Store](https://pulsescripts.tebex.io/) | ||||
| - [Join the Discord For Support](https://discord.gg/c6gXmtEf3H) | ||||
| ###### | ||||
|  | ||||
| ## Dependencies | ||||
| - [ox_lib](https://github.com/overextended/ox_lib/releases) | ||||
| - [qtarget](https://github.com/overextended/qtarget.git), [ox_target](https://github.com/overextended/ox_target/releases), [qb-target](https://github.com/qbcore-framework/qb-target) | ||||
| ## | ||||
|  | @ -1,12 +0,0 @@ | |||
| local ESX = GetResourceState('es_extended'):find('start') and exports['es_extended']:getSharedObject() or nil | ||||
|  | ||||
| if not ESX then return end | ||||
|  | ||||
| function Notification(msg) | ||||
|     ESX.ShowNotification(msg) | ||||
| end | ||||
|  | ||||
| RegisterNetEvent('esx:playerLoaded') | ||||
| AddEventHandler('esx:playerLoaded', function() | ||||
|     onPlayerLoaded() | ||||
| end) | ||||
|  | @ -1,11 +0,0 @@ | |||
| local QBCore = GetResourceState('qb-core'):find('start') and exports['qb-core']:GetCoreObject() or nil | ||||
|  | ||||
| if not QBCore then return end | ||||
|  | ||||
| function Notification(message, type) | ||||
|     QBCore.Functions.Notify(message, type) | ||||
| end | ||||
|  | ||||
| RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() | ||||
|     onPlayerLoaded() | ||||
| end) | ||||
|  | @ -1,158 +0,0 @@ | |||
|  | ||||
| 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, | ||||
|             } | ||||
|         }) | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
| local function spawnObject(object, coords, heading) | ||||
|     lib.requestModel(object) | ||||
|  | ||||
|     if not HasModelLoaded(object) then | ||||
|         _debug('[DEBUG] '..object..' failed to load.'..'') | ||||
|         return | ||||
|     end | ||||
|     local entity = CreateObject(object, coords.x, coords.y, coords.z, true, true, true) | ||||
|  | ||||
|     if DoesEntityExist(entity) then | ||||
|         SetEntityHeading(entity, heading) | ||||
|         FreezeEntityPosition(entity, true) | ||||
|         table.insert(spawnedObjects, entity) | ||||
|     else | ||||
|         _debug('[DEBUG] '..' Failed to spawn object: '..object..'') | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | ||||
| local function deleteSpawnedObjects() | ||||
|     for _, obj in ipairs(spawnedObjects) do | ||||
|         if DoesEntityExist(obj) then | ||||
|             DeleteObject(obj) | ||||
|         end | ||||
|     end | ||||
|     spawnedObjects = {} | ||||
| end | ||||
|  | ||||
|  | ||||
| AddEventHandler('onResourceStart', function(resourceName) | ||||
|     if GetCurrentResourceName() ~= resourceName then return end | ||||
|     for _, location in ipairs(Config.Locations) do | ||||
|         spawnObject(location.object, location.coords, location.heading) | ||||
|     end | ||||
| end) | ||||
|  | ||||
|  | ||||
| AddEventHandler('onResourceStop', function(resourceName) | ||||
|     if GetCurrentResourceName() ~= resourceName then return end | ||||
|     deleteSpawnedObjects() | ||||
| end) | ||||
|  | ||||
| function onPlayerLoaded() | ||||
|     Wait(3000) | ||||
|     for _, location in ipairs(Config.Locations) do | ||||
|         spawnObject(location.object, location.coords, location.heading) | ||||
|     end | ||||
| end | ||||
|  | ||||
| function _debug(...) | ||||
|     if Config.Debug then | ||||
|         print(...) | ||||
|     end | ||||
| end | ||||
|  | @ -1,28 +0,0 @@ | |||
|  | ||||
|  | ||||
| Config = {} | ||||
|  | ||||
| Config.Locale = 'de' -- 'en', 'fr', 'de', 'es', 'it', 'pt', 'tr' -- Language | ||||
|  | ||||
| Config.Debug = true | ||||
|  | ||||
| Config.Notify = 'okok' --ox, esx, okok,qb,wasabi,custom | ||||
|  | ||||
| Config.CheckItem = false --If you want player to have item before opening | ||||
|  | ||||
| Config.PrinterModel = {`prop_printer_02`,`prop_printer_01`,`v_res_printer`} | ||||
|  | ||||
| Config.ItemName = 'paper' | ||||
|  | ||||
| Config.Print = { | ||||
|     Price = 0, --Price | ||||
|     Account = 'bank' --This is the account your money will be deducted | ||||
| } | ||||
|  | ||||
| Config.EnableLocation = false | ||||
|  | ||||
| Config.Locations = { | ||||
|     {coords = vector3(451.53, -923.32, 28.44), heading = 190.0, object = "prop_printer_02"}, | ||||
|     -- Add more locations with coords and heading | ||||
| } | ||||
|  | ||||
|  | @ -1,34 +0,0 @@ | |||
| fx_version 'cerulean' | ||||
| games { 'gta5' } | ||||
| lua54 'yes' | ||||
|  | ||||
| name 'Printer Script' | ||||
| author 'PulseScripts' | ||||
| version '1.0.4' | ||||
|  | ||||
| ui_page 'web/index.html' | ||||
|  | ||||
| shared_scripts { | ||||
|     '@ox_lib/init.lua', | ||||
|     'config.lua', | ||||
|     'locales/locale.lua' | ||||
| } | ||||
|  | ||||
| client_scripts { | ||||
|     'client/main.lua', | ||||
|     'client/bridge/*' | ||||
| } | ||||
| server_scripts { | ||||
|     '@oxmysql/lib/MySQL.lua', | ||||
|     'server/main.lua', | ||||
|     'server/bridge/*' | ||||
| } | ||||
|  | ||||
| dependencies { | ||||
|     'ox_lib', | ||||
| } | ||||
|  | ||||
| files { | ||||
|     'web/index.html', | ||||
|     'locales/*.json' | ||||
| } | ||||
|  | @ -1,6 +0,0 @@ | |||
| CREATE TABLE printer ( | ||||
|     id INT AUTO_INCREMENT PRIMARY KEY, | ||||
|     image_name VARCHAR(255) NOT NULL, | ||||
|     image_link VARCHAR(255) NOT NULL | ||||
| ); | ||||
|  | ||||
|  | @ -1,12 +0,0 @@ | |||
|  | ||||
|  | ||||
| ["paper"] = { | ||||
| 	label = "Paper", | ||||
| 	weight = 1, | ||||
| 	stack = false, | ||||
| 	close = true, | ||||
| 	consume = 0, | ||||
| 	server = { | ||||
| 		export = 'pl_printer.paper' | ||||
| 	} | ||||
| }, | ||||
|  | @ -1 +0,0 @@ | |||
| ['paper'] = {['name'] = 'paper', ['label'] = 'Paper', ['weight'] = 10, ['type'] = 'item', ['image'] = 'paper.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = 'A Photo Copy Print'}, | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 5 KiB | 
|  | @ -1,9 +0,0 @@ | |||
| { | ||||
|     "image_link": "Bildlink", | ||||
|     "copies": "Kopien", | ||||
|     "image_url": "Bild-URL eingeben", | ||||
|     "enter_copies": "Anzahl der Kopien eingeben", | ||||
|     "prints": "Drucken", | ||||
|     "Money_Removed": "Geld vom Bankkonto entfernt: $", | ||||
|     "not_enough": "Nicht genug Geld" | ||||
|   } | ||||
|  | @ -1,10 +0,0 @@ | |||
| { | ||||
|     "image_link": "Image Link", | ||||
|     "copies": "Copies", | ||||
|     "image_url": "Enter the Image URL", | ||||
|     "enter_copies": "Enter the number of copies", | ||||
|     "prints": "Prints", | ||||
|     "Money_Removed": "Money removed from bank: $", | ||||
|     "not_enough": "Not enough money" | ||||
|  | ||||
| } | ||||
|  | @ -1,9 +0,0 @@ | |||
| { | ||||
|     "image_link": "Enlace de imagen", | ||||
|     "copies": "Copias", | ||||
|     "image_url": "Introduce la URL de la imagen", | ||||
|     "enter_copies": "Introduce el número de copias", | ||||
|     "prints": "Impresiones", | ||||
|     "Money_Removed": "Dinero retirado del banco: $", | ||||
|     "not_enough": "No hay suficiente dinero" | ||||
|   } | ||||
|  | @ -1,9 +0,0 @@ | |||
| { | ||||
|     "image_link": "Lien de l'image", | ||||
|     "copies": "Copies", | ||||
|     "image_url": "Entrez l'URL de l'image", | ||||
|     "enter_copies": "Entrez le nombre de copies", | ||||
|     "prints": "Impressions", | ||||
|     "Money_Removed": "Argent retiré de la banque : $", | ||||
|     "not_enough": "Pas assez d'argent" | ||||
|   } | ||||
|  | @ -1,9 +0,0 @@ | |||
| { | ||||
|     "image_link": "Link immagine", | ||||
|     "copies": "Copie", | ||||
|     "image_url": "Inserisci l'URL dell'immagine", | ||||
|     "enter_copies": "Inserisci il numero di copie", | ||||
|     "prints": "Stampe", | ||||
|     "Money_Removed": "Denaro rimosso dalla banca: $", | ||||
|     "not_enough": "Non abbastanza denaro" | ||||
|   } | ||||
|  | @ -1,18 +0,0 @@ | |||
| Locales = {} | ||||
| LocalLang = {} | ||||
|  | ||||
| function LoadLocale(lang) | ||||
|     local file = LoadResourceFile(GetCurrentResourceName(), 'locales/' .. lang .. '.json') | ||||
|     if file then | ||||
|         LocalLang = json.decode(file) | ||||
|     else | ||||
|         print('[Locale] Translation file not found for language: ' .. lang) | ||||
|     end | ||||
| end | ||||
|  | ||||
| function Locale(key) | ||||
|     return LocalLang[key] or key | ||||
| end | ||||
|  | ||||
| -- Load language | ||||
| LoadLocale(Config.Locale) | ||||
|  | @ -1,9 +0,0 @@ | |||
| { | ||||
|     "image_link": "Link da imagem", | ||||
|     "copies": "Cópias", | ||||
|     "image_url": "Digite a URL da imagem", | ||||
|     "enter_copies": "Digite o número de cópias", | ||||
|     "prints": "Impressões", | ||||
|     "Money_Removed": "Dinheiro removido do banco: $", | ||||
|     "not_enough": "Dinheiro insuficiente" | ||||
|   } | ||||
|  | @ -1,9 +0,0 @@ | |||
| { | ||||
|     "image_link": "Görsel Bağlantısı", | ||||
|     "copies": "Kopya", | ||||
|     "image_url": "Görsel URL'sini girin", | ||||
|     "enter_copies": "Kopya sayısını girin", | ||||
|     "prints": "Baskılar", | ||||
|     "Money_Removed": "Bankadan para çekildi: $", | ||||
|     "not_enough": "Yetersiz bakiye" | ||||
|   } | ||||
|  | @ -1,50 +0,0 @@ | |||
| local ESX = GetResourceState('es_extended'):find('start') and exports['es_extended']:getSharedObject() or nil | ||||
|  | ||||
| if not ESX then return end | ||||
|  | ||||
| function getPlayer(target) | ||||
|     local xPlayer = ESX.GetPlayerFromId(target) | ||||
|     return xPlayer | ||||
| end | ||||
|  | ||||
| function RemovePlayerMoney(Player,account,TotalBill) | ||||
|     if account == 'bank' then | ||||
|         Player.removeAccountMoney('bank', TotalBill) | ||||
|     elseif account == 'money' then | ||||
|         Player.removeAccountMoney('money', TotalBill) | ||||
|     end | ||||
| end | ||||
|  | ||||
| function GetPlayerAccountMoney(Player,account,TotalBill) | ||||
|     if account == 'bank' then | ||||
|         if Player.getAccount('bank').money >= TotalBill then | ||||
|             return true | ||||
|         else | ||||
|             return false | ||||
|         end | ||||
|     elseif account == 'money' then | ||||
|         if Player.getAccount('money').money >= TotalBill then | ||||
|             return true | ||||
|         else | ||||
|             return false | ||||
|         end | ||||
|     end | ||||
|     return false | ||||
| end | ||||
|  | ||||
| function HasItem(playerSource) | ||||
|     if Config.CheckItem then | ||||
|         local xPlayer = ESX.GetPlayerFromId(playerSource) | ||||
|         if not xPlayer then return false end | ||||
|  | ||||
|         local item = xPlayer.getInventoryItem(Config.ItemName) | ||||
|         if item and item.count >= 1 then | ||||
|             return true | ||||
|         else | ||||
|             return false | ||||
|         end | ||||
|     else | ||||
|         return true | ||||
|     end | ||||
| end | ||||
|  | ||||
|  | @ -1,47 +0,0 @@ | |||
| local QBCore = GetResourceState('qb-core'):find('start') and exports['qb-core']:GetCoreObject() or nil | ||||
|  | ||||
| if not QBCore then return end | ||||
|  | ||||
| function getPlayer(target) | ||||
|     local Player = QBCore.Functions.GetPlayer(target) | ||||
|     return Player | ||||
| end | ||||
|  | ||||
| function RemovePlayerMoney(Player,account,TotalBill) | ||||
|     if account == 'money' then | ||||
|         Player.Functions.RemoveMoney('cash', TotalBill) | ||||
|     elseif account == 'bank' then | ||||
|         Player.Functions.RemoveMoney('bank', TotalBill) | ||||
|     end | ||||
| end | ||||
|  | ||||
| function GetPlayerAccountMoney(Player,account,TotalBill) | ||||
|     if account == 'bank' then | ||||
|         if Player.PlayerData.money.bank >= TotalBill then | ||||
|             return true | ||||
|         else | ||||
|             return false | ||||
|         end | ||||
|     elseif account == 'money' then | ||||
|         if Player.PlayerData.money.cash >= TotalBill then | ||||
|             return true | ||||
|         else | ||||
|             return false | ||||
|         end | ||||
|     end | ||||
|     return false | ||||
| end | ||||
|  | ||||
| function HasItem(playerSource) | ||||
|     if Config.CheckItem then | ||||
|         return exports['qb-inventory']:HasItem(playerSource,Config.ItemName,1) | ||||
|     else | ||||
|         return true | ||||
|     end | ||||
| end | ||||
|  | ||||
| QBCore.Functions.CreateUseableItem(Config.ItemName, function(source) | ||||
|     local Player = QBCore.Functions.GetPlayer(source) | ||||
|     local item = Player.Functions.GetItemByName(Config.ItemName) | ||||
|     TriggerEvent('pl_printer:fetchImageLink',item.info.id,Player.PlayerData.source) | ||||
| end) | ||||
|  | @ -1,98 +0,0 @@ | |||
| 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) | ||||
|                  | ||||
|             end) | ||||
|             RemovePlayerMoney(Player,account,TotalBill) | ||||
|             TriggerClientEvent('pl_printer:notification',source,Locale("Money_Removed") .. TotalBill,'success') | ||||
|         else | ||||
|             _debug('[DEBUG] '..' Invalid data received for image. '..'') | ||||
|         end | ||||
|     else | ||||
|         TriggerClientEvent('pl_printer:notification',source,Locale("not_enough"),'error') | ||||
|     end | ||||
| end) | ||||
|  | ||||
|  | ||||
| RegisterServerEvent('pl_printer:fetchImageLink') | ||||
| AddEventHandler('pl_printer:fetchImageLink', function(imageName,playerSource) | ||||
|     local hasItem = HasItem(playerSource) | ||||
|     if not hasItem then return end | ||||
|     MySQL.Async.fetchScalar('SELECT image_link FROM printer WHERE image_name = @imageName', { | ||||
|         ['@imageName'] = imageName | ||||
|     }, function(imageLink) | ||||
|         if imageLink then | ||||
|             TriggerClientEvent('pl_printer:showImage',playerSource,imageLink) | ||||
|         else | ||||
|             _debug('[DEBUG] '..' No Image Link Found for '..imageName..'') | ||||
|         end | ||||
|     end) | ||||
| end) | ||||
|  | ||||
| function AddItem(source, amount, imageName) | ||||
|     local src = source | ||||
|     local info = { | ||||
|         id = imageName | ||||
|     } | ||||
|     if GetResourceState('qb-inventory') == 'started' then | ||||
|         if lib.checkDependency('qb-inventory', '2.0.0') then | ||||
|             exports['qb-inventory']:AddItem(src,Config.ItemName,amount,false,info) | ||||
|             TriggerClientEvent('qb-inventory:client:ItemBox', src, QBCore.Shared.Items[Config.ItemName], 'add', amount) | ||||
|         else | ||||
|             local Player = getPlayer(src) | ||||
|             Player.Functions.AddItem(Config.ItemName, amount,false, info) | ||||
|             TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items[Config.ItemName], "add") | ||||
|         end | ||||
|     elseif GetResourceState('ox_inventory') == 'started' then | ||||
|         exports.ox_inventory:AddItem(src,Config.ItemName,amount,imageName,false) | ||||
|     elseif GetResourceState('qs-inventory') == 'started' then | ||||
|         local itemMetadata ={ id = imageName } | ||||
|         exports['qs-inventory']:AddItem(src,Config.ItemName,amount,false,itemMetadata) | ||||
|     end | ||||
| end | ||||
|  | ||||
| AddEventHandler('onServerResourceStart', function() | ||||
|     if GetResourceState('ox_inventory') == 'started' then | ||||
|         exports(Config.ItemName,function (event,item,inventory,slot,data) | ||||
|             if event == 'usingItem' then | ||||
|                 local item_metadata = exports.ox_inventory:GetSlot(inventory.id, slot) | ||||
|                 TriggerEvent('pl_printer:fetchImageLink', item_metadata.metadata.type, inventory.id) | ||||
|             end | ||||
|         end) | ||||
|     end | ||||
| end) | ||||
|  | ||||
| local WaterMark = function() | ||||
|     SetTimeout(1500, function() | ||||
|         print('^1['..resourceName..'] ^2Thank you for Downloading the Script^0') | ||||
|         print('^1['..resourceName..'] ^2If you encounter any issues please Join the discord https://discord.gg/c6gXmtEf3H to get support..^0') | ||||
|         print('^1['..resourceName..'] ^2Enjoy a secret 20% OFF any script of your choice on https://pulsescripts.tebex.io/freescript^0') | ||||
|         print('^1['..resourceName..'] ^2Using the coupon code: SPECIAL20 (one-time use coupon, choose wisely)^0') | ||||
|      | ||||
|     end) | ||||
| end | ||||
|  | ||||
| WaterMark() | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|  | @ -1,48 +0,0 @@ | |||
| <!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||
|     <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script> | ||||
|     <title></title> | ||||
|     <style> | ||||
|         body { | ||||
|             margin: 0; | ||||
|             padding: 0; | ||||
|             overflow: hidden; | ||||
|         } | ||||
|         #image { | ||||
|             position: absolute; | ||||
|             top: 50%; | ||||
|             left: 50%; | ||||
|             transform: translate(-50%, -50%); | ||||
|             max-width: 90%; | ||||
|             max-height: 90%; | ||||
|         } | ||||
|     </style> | ||||
| </head> | ||||
| <body> | ||||
|     <img id="image" src="" alt="Image" style="display:none;"> | ||||
|     <script> | ||||
|         window.addEventListener('message', function(event) { | ||||
|             if (event.data.action === 'show') { | ||||
|                 document.getElementById('image').src = event.data.imageUrl; | ||||
|                 document.getElementById('image').style.display = 'block'; | ||||
|             } else if (event.data.action === 'hide') { | ||||
|                 document.getElementById('image').style.display = 'none'; | ||||
|             } | ||||
|         }); | ||||
|  | ||||
|         document.addEventListener("keydown", function(event) { | ||||
|         if (event.key === "Escape") { | ||||
|             document.getElementById('image').style.display = 'none'; | ||||
|             axios.post(`https://${GetParentResourceName()}/hideFrame`, {}) | ||||
|             .then(function (response) {  | ||||
|             }) | ||||
|             .catch(function (error) { | ||||
|             }); | ||||
|         } | ||||
| }); | ||||
|     </script> | ||||
| </body> | ||||
| </html> | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Nordi98
						Nordi98