· 3 years ago · Feb 06, 2022, 11:10 AM
1vRP.prepare('black/create', [[CREATE TABLE IF NOT EXISTS black_tablet(
2 `user_id` int(11) NOT NULL,
3 `type` varchar(255) DEFAULT NULL,
4 `value` varchar(255) DEFAULT NULL,
5 `data` varchar(255) DEFAULT NULL,
6 `info` varchar(255) DEFAULT NULL,
7 `officer` varchar(255) DEFAULT NULL,
8 PRIMARY KEY (`value`)
9)]])
10
11vRP.prepare('black/createimg', [[CREATE TABLE IF NOT EXISTS black_tablet_img(
12 `user_id` int(11) NOT NULL,
13 `img` varchar(255) DEFAULT NULL,
14 PRIMARY KEY (`user_id`)
15)]])
16
17CreateThread(function ()
18 vRP.execute('black/create')
19 vRP.execute('black/createimg')
20end)
21-----------------------------------------------------------------------------------------------------------------------------------------
22-- PREPARE
23-----------------------------------------------------------------------------------------------------------------------------------------
24vRP._prepare("black/get_user_inssues","SELECT * FROM black_tablet WHERE user_id = @user_id")
25vRP._prepare("black/get_user_arrest","SELECT * FROM black_tablet WHERE user_id = @user_id AND type = @type")
26vRP.prepare("black/get_img","SELECT * FROM black_tablet_img WHERE user_id = @user_id")
27vRP.prepare("black/generate_img","INSERT INTO black_tablet_img(user_id,img)VALUES(@user_id,@img)")
28vRP.prepare("black/update_img","UPDATE black_tablet_img SET img = @img WHERE user_id = @user_id")
29vRP._prepare("black/add_user_inssues","INSERT INTO black_tablet(user_id,type,value,data,info,officer) VALUES(@user_id,@type,@value,@data,@info,@officer); SELECT LAST_INSERT_ID() AS slot")
30-----------------------------------------------------------------------------------------------------------------------------------------
31-- WEBHOOK
32-----------------------------------------------------------------------------------------------------------------------------------------
33local webhookprender = config2.prender
34local webhookmultas = config2.multar
35
36function SendWebhookMessage(webhook,message)
37 if webhook ~= nil and webhook ~= "" then
38 PerformHttpRequest(webhook, function(err, text, headers) end, 'POST', json.encode({content = message}), { ['Content-Type'] = 'application/json' })
39 end
40end
41-----------------------------------------------------------------------------------------------------------------------------------------
42-- SEARCH INFO
43-----------------------------------------------------------------------------------------------------------------------------------------
44function src.infoUser(user)
45 local source = source
46 if user then
47 local random = math.random(10,100)
48 local value = vRP.getUData(parseInt(user),"vRP:multas")
49 local multas = json.decode(value) or 0
50 local identity = vRP.getUserIdentity(parseInt(user)) or 0
51 local arrests = vRP.query("black/get_user_arrest",{ user_id = parseInt(user), type = "arrest" })
52 local tickets = vRP.query("black/get_user_arrest",{ user_id = parseInt(user), type = "ticket" })
53 local warnings = vRP.query("black/get_user_arrest",{ user_id = parseInt(user), type = "warning" })
54 local img = src.getUData(parseInt(user))
55 vRP.execute("black/generate_img", {user_id = user, img = ''})
56 if identity then
57 return multas,identity.name,identity.firstname,identity.phone,identity.registration,parseInt(identity.age),#arrests,#warnings,img
58 end
59 end
60end
61
62function src.getUData(user_id)
63 local rows = vRP.query("black/get_img",{ user_id = user_id })
64 if #rows > 0 then
65 return rows[1].img
66 else
67 return ""
68 end
69end
70-----------------------------------------------------------------------------------------------------------------------------------------
71-- SEARCH ARRESTS
72-----------------------------------------------------------------------------------------------------------------------------------------
73function src.arrestsUser(user)
74 local source = source
75 if user then
76 local data = vRP.query("black/get_user_arrest",{ user_id = user, type = "arrest" })
77 local arrest = {}
78 if data then
79 for k,v in pairs(data) do
80 table.insert(arrest,{ data = v.data, value = v.value, info = v.info, officer = v.officer })
81 end
82 return arrest
83 end
84 end
85end
86-----------------------------------------------------------------------------------------------------------------------------------------
87-- SEARCH TICKETS
88-----------------------------------------------------------------------------------------------------------------------------------------
89function src.ticketsUser(user)
90 local source = source
91 if user then
92 local data = vRP.query("black/get_user_arrest",{ user_id = user, type = "ticket" })
93 local arrest = {}
94 if data then
95 for k,v in pairs(data) do
96 table.insert(arrest,{ data = v.data, value = v.value, info = v.info, officer = v.officer })
97 end
98 return arrest
99 end
100 end
101end
102-----------------------------------------------------------------------------------------------------------------------------------------
103-- USER DATA
104-----------------------------------------------------------------------------------------------------------------------------------------
105function src.userData()
106 local source = source
107 local user_id = vRP.getUserId(source)
108 local identity = vRP.getUserIdentity(parseInt(user))
109 if user_id then
110 return user_id, registration
111 end
112end
113-----------------------------------------------------------------------------------------------------------------------------------------
114-- SEARCH WARNINGS
115-----------------------------------------------------------------------------------------------------------------------------------------
116function src.warningsUser(user)
117 local source = source
118 if user then
119 local data = vRP.query("black/get_user_arrest",{ user_id = user, type = "warning" })
120 local arrest = {}
121 if data then
122 for k,v in pairs(data) do
123 table.insert(arrest,{ data = v.data, value = v.value, info = v.info, officer = v.officer })
124 end
125 return arrest
126 end
127 end
128end
129-----------------------------------------------------------------------------------------------------------------------------------------
130-- WARNING
131-----------------------------------------------------------------------------------------------------------------------------------------
132function src.warningUser(user,date,info,officer)
133 local source = source
134 if user then
135 local user_id = vRP.getUserId(source)
136 local nplayer = vRP.getUserSource(parseInt(user))
137 vRP.execute("black/add_user_inssues",{ user_id = user, type = "warning", value = 0, data = date, info = info, officer = user_id })
138 TriggerClientEvent("Notify",source,"sucesso","Aviso aplicado com sucesso.",8000)
139 TriggerClientEvent("Notify",nplayer,"importante","<b>Aviso Policial:</b> "..info.."")
140 vRPclient.playSound(source,"Hack_Success","DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS")
141 end
142end
143-----------------------------------------------------------------------------------------------------------------------------------------
144-- TICKET
145-----------------------------------------------------------------------------------------------------------------------------------------
146function src.ticketUser(user,value,date,info)
147 local source = source
148 local user_id = vRP.getUserId(source)
149 if user then
150 local valor = vRP.getUData(parseInt(user),"vRP:multas")
151 local multas = json.decode(valor) or 0
152 local oficialid = vRP.getUserIdentity(user_id)
153 local identity = vRP.getUserIdentity(parseInt(user))
154 local nplayer = vRP.getUserSource(parseInt(user))
155 randmoney = math.random(90,150)
156 vRP.giveMoney(user_id,parseInt(randmoney))
157 vRP.setUData(parseInt(user),"vRP:multas",json.encode(parseInt(multas)+parseInt(value)))
158
159 PerformHttpRequest(webhookmultas, function(err, text, headers) end, 'POST', json.encode({
160 embeds = {
161 {
162 title = "MULTA",
163 thumbnail = {
164 url = "https://cdn.discordapp.com/attachments/880952283658076180/880955546419724308/arrest.png"
165 },
166 fields = {
167 {
168 name = ":police_officer: Policial",
169 value = "```"..oficialid.name.." "..oficialid.firstname..", ID "..user_id.."```"
170 },
171 {
172 name = ":person_pouting: Preso",
173 value = "```"..identity.name.." "..identity.firstname..", ID "..user.."```"
174 },
175 {
176 name = ":moneybag: Multa",
177 value = "```R$"..vRP.format(parseInt(value)).."```",
178 inline = true
179 },
180 {
181 name = ":person_bald: Indentidade",
182 value = "```"..identity.registration.."```",
183 inline = true
184 }
185 },
186 footer = {
187 text = "Desenvolvido por Felipeex Networking",
188 icon_url = "https://cdn.discordapp.com/attachments/880952234626678844/880959320366415962/1920x1920_BRANCO.png"
189 },
190 color = 3416451,
191 avatar_url = "https://cdn.discordapp.com/attachments/880952234626678844/880959680455794778/image.png"
192 }
193 }
194 }), { ['Content-Type'] = 'application/json' })
195 vRP.execute("black/add_user_inssues",{ user_id = user, type = "ticket", value = parseInt(value), data = date, info = info, officer = user_id.." "..oficialid.name.." "..oficialid.firstname })
196 TriggerClientEvent("Notify",source,"sucesso","Multa aplicada com sucesso.",8000)
197 TriggerClientEvent("Notify",nplayer,"importante","Você recebeu <b>R$"..vRP.format(parseInt(value)).."</b> de multa.",8000)
198 TriggerClientEvent("Notify",source,"importante","Você recebeu <b>R$"..vRP.format(parseInt(randmoney)).." reais</b> de bonificação.")
199 vRPclient.playSound(source,"Hack_Success","DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS")
200 end
201end
202
203function prison_lock(target_id)
204 local player = vRP.getUserSource(parseInt(target_id))
205 if player then
206 SetTimeout(60000,function()
207 local value = vRP.getUData(parseInt(target_id),"vRP:prisao")
208 local tempo = json.decode(value) or 0
209 if parseInt(tempo) >= 1 then
210 TriggerClientEvent("Notify",player,"importante","Ainda vai passar <b>"..parseInt(tempo).." meses</b> preso.")
211 vRP.setUData(parseInt(target_id),"vRP:prisao",json.encode(parseInt(tempo)-1))
212 prison_lock(parseInt(target_id))
213 elseif parseInt(tempo) == 0 then
214 TriggerClientEvent('prisioneiro',player,false)
215 vRPclient.teleport(player,1850.5,2604.0,45.5)
216 vRP.setUData(parseInt(target_id),"vRP:prisao",json.encode(-1))
217 TriggerClientEvent("Notify",player,"importante","Sua sentença terminou, esperamos não ve-lo novamente.")
218 end
219 vRPclient.PrisionGod(player)
220 end)
221 end
222end
223-----------------------------------------------------------------------------------------------------------------------------------------
224-- TICKET
225-----------------------------------------------------------------------------------------------------------------------------------------
226
227function src.GetProfilePicture(user,value,date,info,officer)
228 vRP.execute('black/update_img', { user_id = user, img = value[1]})
229 print(user)
230end
231
232function src.arrestUser(user,value,date,info,officer)
233 local source = source
234 local user_id = vRP.getUserId(source)
235 if user then
236 local player = vRP.getUserSource(parseInt(user))
237 if player then
238 TriggerClientEvent("Notify",player,"importante","Você foi preso por <b>"..value.." meses</b>.")
239 vRP.setUData(user, "vRP:prisao", json.encode(parseInt(value)))
240 vRPclient.setHandcuffed(player,false)
241 TriggerClientEvent('prisioneiro',player,true)
242
243 vRPclient.teleport(player,1680.1,2513.0,45.5)
244 prison_lock(parseInt(user))
245 TriggerClientEvent('removealgemas',player)
246 TriggerClientEvent("vrp_sound:source",player,'jaildoor',0.7)
247 TriggerClientEvent("vrp_sound:source",source,'jaildoor',0.7)
248
249 -- APLICAR ROUPA DE PRISIONEIRO
250 local old_custom = vRPclient.getCustomization(player)
251 local custom = {
252 [1885233650] = {
253 [1] = { 73,0,1 }, -- máscara
254 [3] = { 0,0 }, -- maos
255 [4] = { 5,7 }, -- calça
256 [5] = { -1,0 }, -- mochila
257 [6] = { 34,0,1 }, -- sapato
258 [7] = { -1,0 }, -- acessorios
259 [8] = { -1,0 }, -- blusa
260 [9] = { -1,0 }, -- colete
261 [10] = { -1,0 }, -- adesivo
262 [11] = { 22,0 }, -- jaqueta
263 ["p0"] = { -1,0 }, -- chapeu
264 ["p1"] = { -1,0 },
265 ["p2"] = { -1,0 },
266 ["p6"] = { -1,0 },
267 ["p7"] = { -1,0 }
268 },
269 [-1667301416] = {
270 [1] = { -1,0 },
271 [3] = { 14,0 },
272 [4] = { 66,6 },
273 [5] = { -1,0 },
274 [6] = { 35,0,1 },
275 [7] = { -1,0 },
276 [8] = { 6,0 },
277 [9] = { -1,0 },
278 [10] = { -1,0 },
279 [11] = { 73,0 },
280 ["p0"] = { -1,0 },
281 ["p1"] = { -1,0 },
282 ["p2"] = { -1,0 },
283 ["p6"] = { -1,0 },
284 ["p7"] = { -1,0 }
285 }
286 }
287
288 local idle_copy = {}
289 idle_copy.modelhash = nil
290 for l,w in pairs(custom[old_custom.modelhash]) do
291 idle_copy[l] = w
292 end
293 vRPclient._setCustomization(player, idle_copy)
294
295 local oficialid = vRP.getUserIdentity(user_id)
296 local identity = vRP.getUserIdentity(parseInt(user))
297 local nplayer = vRP.getUserSource(parseInt(user))
298
299 PerformHttpRequest(webhookprender, function(err, text, headers) end, 'POST', json.encode({
300 embeds = {
301 {
302 title = "PRISÃO",
303 thumbnail = {
304 url = "https://cdn.discordapp.com/attachments/880952283658076180/880955546419724308/arrest.png"
305 },
306 fields = {
307 {
308 name = ":police_officer: Policial",
309 value = "```"..oficialid.name.." "..oficialid.firstname..", ID "..user_id.."```"
310 },
311 {
312 name = ":person_pouting: Preso",
313 value = "```"..identity.name.." "..identity.firstname..", ID "..user.."```"
314 },
315 {
316 name = ":stopwatch: Tempo",
317 value = "```"..vRP.format(value).." Meses```",
318 inline = true
319 },
320 {
321 name = ":person_bald: Indentidade",
322 value = "```"..identity.registration.."```",
323 inline = true
324 }
325 },
326 footer = {
327 text = "Desenvolvido por Felipeex Networking",
328 icon_url = "https://cdn.discordapp.com/attachments/880952234626678844/880959320366415962/1920x1920_BRANCO.png"
329 },
330 color = 3416451,
331 avatar_url = "https://cdn.discordapp.com/attachments/880952234626678844/880959680455794778/image.png"
332 }
333 }
334 }), { ['Content-Type'] = 'application/json' })
335
336 randmoney = math.random(parseInt(value), parseInt(value) * 2)
337 vRP.giveMoney(user_id,parseInt(randmoney))
338 vRP.execute("black/add_user_inssues",{ user_id = user, type = "arrest", value = parseInt(value), data = date, info = info, officer = user_id })
339 TriggerClientEvent("Notify",source,"sucesso","Prisão do passaporte <b>"..user.."</b> por <b>"..value.." meses</b> efetuada com sucesso.")
340 TriggerClientEvent("Notify",source,"importante","Você recebeu <b>R$"..vRP.format(parseInt(randmoney)).." reais</b> de bonificação.")
341 vRPclient.playSound(source,"Hack_Success","DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS")
342 vRPclient.playSound(nplayer,"Hack_Success","DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS")
343
344 end
345 end
346end
347-----------------------------------------------------------------------------------------------------------------------------------------
348-- PERMISSION
349-----------------------------------------------------------------------------------------------------------------------------------------
350function src.checkPermission()
351 local source = source
352 local user_id = vRP.getUserId(source)
353 return vRP.hasPermission(user_id,config2.permissao)
354end