-
Notifications
You must be signed in to change notification settings - Fork 29
/
sv_main.lua
39 lines (33 loc) · 1.17 KB
/
sv_main.lua
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
28
29
30
31
32
33
34
35
36
37
38
39
local QBCore = exports['qb-core']:GetCoreObject()
-- Add Discord webhook here.
local webhook = ""
RegisterNetEvent("ps-camera:cheatDetect", function()
DropPlayer(source, "Cheater Detected")
end)
RegisterNetEvent("ps-camera:grabHook", function(Key)
local event = ("ps-camera:grabbed%s"):format(Key)
TriggerClientEvent(event, source, webhook)
end)
RegisterNetEvent("ps-camera:CreatePhoto", function(url)
local source = source
local player = QBCore.Functions.GetPlayer(source)
if not player then return end
local info = {
image = url
}
player.Functions.AddItem("photo", 1, nil, info)
end)
QBCore.Functions.CreateUseableItem("camera", function(source, item)
local source = source
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.GetItemByName(item.name) then
TriggerClientEvent("ps-camera:useCamera", source)
end
end)
QBCore.Functions.CreateUseableItem("photo", function(source, item)
local source = source
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.GetItemByName(item.name) then
TriggerClientEvent("ps-camera:usePhoto", source, item.info.image)
end
end)