-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathclient.lua
More file actions
27 lines (23 loc) · 709 Bytes
/
client.lua
File metadata and controls
27 lines (23 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
RegisterNetEvent("wp-printer:client:UseDocument", function(itemData)
local itemMetadata = GetItemMetadata(itemData)
local documentUrl = itemMetadata.url ~= nil and itemMetadata.url or false
SendNUIMessage({
action = "open",
url = documentUrl,
})
SetNuiFocus(true, false)
end)
RegisterNetEvent("wp-printer:client:UsePrinter", function()
SendNUIMessage({
action = "start",
})
SetNuiFocus(true, true)
end)
RegisterNUICallback("SaveDocument", function(data)
if data.url ~= nil then
TriggerServerEvent("wp-printer:server:SaveDocument", data.url)
end
end)
RegisterNUICallback("CloseDocument", function()
SetNuiFocus(false, false)
end)