11local QBCore = exports [' qb-core' ]:GetCoreObject ()
2- Config = {
2+
3+ SvConfig = {
34 Inv = " qb" , -- qb(=lj) or ox [Inventory system]
45 webhook = " " , -- Add Discord webhook
6+ FivemerrApiToken = ' ' ,
57}
68local function ConfigInvInvalid ()
7- print (' ^1[Error] Your Config .Inv isnt set.. you probably had a typo\n You have it set as= Config .Inv = "' .. Config .Inv .. ' "' )
9+ print (' ^1[Error] Your SvConfig .Inv isnt set.. you probably had a typo\n You have it set as= SvConfig .Inv = "' .. SvConfig .Inv .. ' "' )
810end
911
1012RegisterNetEvent (" ps-camera:cheatDetect" , function ()
1416RegisterNetEvent (" ps-camera:requestWebhook" , function (Key )
1517 local source = source
1618 local event = (" ps-camera:grabbed%s" ):format (Key )
17- if Config .webhook == ' ' then
18- print (" ^1[Error] A webhook is missing in: Config.webhook" )
19+
20+ if SvConfig .webhook == ' ' then
21+ print (" ^1[Error] A webhook is missing in: SvConfig.webhook" )
1922 else
20- TriggerClientEvent (event , source , Config .webhook )
23+ TriggerClientEvent (event , source , SvConfig .webhook )
2124 end
2225end )
2326
27+ RegisterNetEvent (' ps-camera:requestFivemerrToken' , function (Key )
28+ local source = source
29+ local event = (" ps-camera:grabbed%s" ):format (Key )
30+
31+ if Config .UseFivemerr == false then
32+ return print (" ^1[Error] Requesting Fivemerr token but Config.UseFivemerr set to false." )
33+ end
34+
35+ if SvConfig .FivemerrApiToken == ' ' then
36+ return print (" ^1[Error] Your Fivemerr API Token is missing in: Config.FivemerrApiToken" )
37+ end
38+
39+ TriggerClientEvent (event , source , SvConfig .FivemerrApiToken )
40+ end )
41+
2442RegisterNetEvent (" ps-camera:CreatePhoto" , function (url )
2543 local source = source
2644 local player = QBCore .Functions .GetPlayer (source )
@@ -43,15 +61,15 @@ RegisterNetEvent("ps-camera:savePhoto", function(url, streetName)
4361 ps_image = url ,
4462 location = location
4563 }
46- if not (Config .Inv == " qb" or Config .Inv == " ox" ) then
64+ if not (SvConfig .Inv == " qb" or SvConfig .Inv == " ox" ) then
4765 ConfigInvInvalid ()
4866 return ;
4967 end
5068
51- if Config .Inv == " qb" then
69+ if SvConfig .Inv == " qb" then
5270 player .Functions .AddItem (" photo" , 1 , nil , info )
5371 TriggerClientEvent (' inventory:client:ItemBox' , source , QBCore .Shared .Items [' photo' ], " add" )
54- elseif Config .Inv == " ox" then
72+ elseif SvConfig .Inv == " ox" then
5573 local ox_inventory = exports .ox_inventory
5674
5775 if not ox_inventory :CanCarryItem (source , ' photo' , 1 ) then
6785QBCore .Functions .CreateUseableItem (" camera" , function (source , item )
6886 local source = source
6987 local Player = QBCore .Functions .GetPlayer (source )
70- if not (Config .Inv == " qb" or Config .Inv == " ox" ) then
88+ if not (SvConfig .Inv == " qb" or SvConfig .Inv == " ox" ) then
7189 ConfigInvInvalid ()
7290 return ;
7391 end
7492
75- if not Config .webhook or Config .webhook == nil or Config .webhook == " " then
76- print (" ^1[Error] A webhook is missing in: Config.webhook" )
77- return ;
93+ if Config .UseFivemerr == false then
94+ if not SvConfig .webhook or SvConfig .webhook == nil or SvConfig .webhook == " " then
95+ print (" ^1[Error] A webhook is missing in: SvConfig.webhook" )
96+ return ;
97+ end
98+ else
99+ if not SvConfig .FivemerrApiToken or SvConfig .FivemerrApiToken == ' ' then
100+ return print (" ^1[Error] A webhook is missing in: SvConfig.FivemerrApiToken" )
101+ end
78102 end
79103
80- if Config .Inv == " qb" then
104+ if SvConfig .Inv == " qb" then
81105 if Player .Functions .GetItemByName (item .name ) then
82106 TriggerClientEvent (" ps-camera:useCamera" , source )
83107 end
84- elseif Config .Inv == " ox" then
108+ elseif SvConfig .Inv == " ox" then
85109 local ox_inventory = exports .ox_inventory
86110 if ox_inventory :GetItem (source , item .name , nil , true ) > 0 then
87111 TriggerClientEvent (" ps-camera:useCamera" , source )
@@ -93,16 +117,16 @@ end)
93117QBCore .Functions .CreateUseableItem (" photo" , function (source , item )
94118 local source = source
95119 local Player = QBCore .Functions .GetPlayer (source )
96- if not (Config .Inv == " qb" or Config .Inv == " ox" ) then
120+ if not (SvConfig .Inv == " qb" or SvConfig .Inv == " ox" ) then
97121 ConfigInvInvalid ()
98122 return ;
99123 end
100124
101- if Config .Inv == " qb" then
125+ if SvConfig .Inv == " qb" then
102126 if Player .Functions .GetItemByName (item .name ) then
103127 TriggerClientEvent (" ps-camera:usePhoto" , source , item .info .ps_image , item .info .location )
104128 end
105- elseif Config .Inv == " ox" then
129+ elseif SvConfig .Inv == " ox" then
106130 local ox_inventory = exports .ox_inventory
107131 if ox_inventory :GetItem (source , item .name , nil , true ) > 0 then
108132 TriggerClientEvent (" ps-camera:usePhoto" , source , item .metadata .ps_image , item .metadata .location )
@@ -113,23 +137,23 @@ end)
113137function UseCam (source )
114138 local source = source
115139 local Player = QBCore .Functions .GetPlayer (source )
116- if not (Config .Inv == " qb" or Config .Inv == " ox" ) then
140+ if not (SvConfig .Inv == " qb" or SvConfig .Inv == " ox" ) then
117141 ConfigInvInvalid ()
118142 return ;
119143 end
120144
121- if not Config .webhook or Config .webhook == nil or Config .webhook == " " then
122- print (" ^1[Error] A webhook is missing in: Config .webhook" )
145+ if not SvConfig .webhook or SvConfig .webhook == nil or SvConfig .webhook == " " then
146+ print (" ^1[Error] A webhook is missing in: SvConfig .webhook" )
123147 return ;
124148 end
125149
126- if Config .Inv == " qb" then
150+ if SvConfig .Inv == " qb" then
127151 if Player .Functions .GetItemByName (' dslrcamera' ) then
128152 TriggerClientEvent (" ps-camera:useCamera" , source )
129153 else
130154 TriggerClientEvent (' QBCore:Notify' , source , " U don\' t have a camera" , " error" )
131155 end
132- elseif Config .Inv == " ox" then
156+ elseif SvConfig .Inv == " ox" then
133157 local ox_inventory = exports .ox_inventory
134158 if ox_inventory :GetItem (source , ' dslrcamera' , nil , true ) > 0 then
135159 TriggerClientEvent (" ps-camera:useCamera" , source )
0 commit comments