neuer printer
This commit is contained in:
parent
a1e9027648
commit
c917371845
33 changed files with 476 additions and 665 deletions
42
resources/[inventory]/omi-printers/server/server.lua
Normal file
42
resources/[inventory]/omi-printers/server/server.lua
Normal file
|
@ -0,0 +1,42 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local ValidExtensions = {
|
||||
[".png"] = true,
|
||||
[".gif"] = true,
|
||||
[".jpg"] = true,
|
||||
["jpeg"] = true
|
||||
}
|
||||
|
||||
local ValidExtensionsText = '.png, .gif, .jpg, .jpeg'
|
||||
|
||||
QBCore.Functions.CreateUseableItem("printerdocument", function(source, item)
|
||||
TriggerClientEvent('moon-printers:client:UsePaperDocument', source, item)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('moon-printers:server:SavePaperDocument', function(url)
|
||||
local src = source
|
||||
local Player = QBCore.Functions.GetPlayer(src)
|
||||
local info = {}
|
||||
local extension = string.sub(url, -4)
|
||||
local cash = Player.PlayerData.money['cash']
|
||||
local validexts = ValidExtensions
|
||||
if url ~= nil then
|
||||
if validexts[extension] then
|
||||
info.url = url
|
||||
if cash >= Config.Amount then
|
||||
if Player.Functions.RemoveItem('tosti', 1) then
|
||||
Player.Functions.AddItem('printerdocument', 1, nil, info)
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['printerdocument'], "add")
|
||||
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['tosti'], "remove")
|
||||
Player.Functions.RemoveMoney('cash', Config.Amount, 'Document-printed')
|
||||
else
|
||||
TriggerClientEvent('QBCore:Notify', source, 'You Dont Have A5 Paper', 'error', 2500)
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('QBCore:Notify', source, 'Paisa Nai Hai Gandu Tere pass '..Config.Amount..' Lagega', 'error', 2500)
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('QBCore:Notify', src, 'Thats not a valid extension, only '..ValidExtensionsText..' extension links are allowed.', "error")
|
||||
end
|
||||
end
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue