├── README.md
└── ax-inventory
├── images.rar
├── html
├── idcard.png
├── verdana.ttf
├── VerdanaBold.ttf
├── ammo_images
│ ├── smg_ammo.png
│ ├── pistol_ammo.png
│ ├── rifle_ammo.png
│ └── shotgun_ammo.png
├── attachment_images
│ ├── weapon_smg.png
│ ├── weapon_microsmg.png
│ ├── weapon_minismg.png
│ ├── weapon_pistol.png
│ ├── weapon_stungun.png
│ ├── weapon_pistol_mk2.png
│ ├── weapon_snspistol.png
│ ├── weapon_assaultrifle.png
│ ├── weapon_carbinerifle.png
│ ├── weapon_compactrifle.png
│ ├── weapon_pumpshotgun.png
│ └── weapon_vintagepistol.png
├── ui.html
└── css
│ └── main.css
├── __resource.lua
├── config.lua
├── client
└── main.lua
└── server
└── main.lua
/README.md:
--------------------------------------------------------------------------------
1 | # np-inventoryv3-qbus
2 | QB-INVENTORY Modified to look like NP's inventory v3
3 |
--------------------------------------------------------------------------------
/ax-inventory/images.rar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/images.rar
--------------------------------------------------------------------------------
/ax-inventory/html/idcard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/idcard.png
--------------------------------------------------------------------------------
/ax-inventory/html/verdana.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/verdana.ttf
--------------------------------------------------------------------------------
/ax-inventory/html/VerdanaBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/VerdanaBold.ttf
--------------------------------------------------------------------------------
/ax-inventory/html/ammo_images/smg_ammo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/ammo_images/smg_ammo.png
--------------------------------------------------------------------------------
/ax-inventory/html/ammo_images/pistol_ammo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/ammo_images/pistol_ammo.png
--------------------------------------------------------------------------------
/ax-inventory/html/ammo_images/rifle_ammo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/ammo_images/rifle_ammo.png
--------------------------------------------------------------------------------
/ax-inventory/html/ammo_images/shotgun_ammo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/ammo_images/shotgun_ammo.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_smg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_smg.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_microsmg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_microsmg.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_minismg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_minismg.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_pistol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_pistol.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_stungun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_stungun.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_pistol_mk2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_pistol_mk2.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_snspistol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_snspistol.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_assaultrifle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_assaultrifle.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_carbinerifle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_carbinerifle.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_compactrifle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_compactrifle.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_pumpshotgun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_pumpshotgun.png
--------------------------------------------------------------------------------
/ax-inventory/html/attachment_images/weapon_vintagepistol.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/AxisGe0/np-inventoryv3-qbus/HEAD/ax-inventory/html/attachment_images/weapon_vintagepistol.png
--------------------------------------------------------------------------------
/ax-inventory/__resource.lua:
--------------------------------------------------------------------------------
1 | resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"
2 |
3 | description 'Lauda Inventory Made By Axis'--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
4 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
5 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
6 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
7 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
8 |
9 | server_scripts {
10 | "config.lua",
11 | "server/main.lua",
12 | }
13 |
14 | client_scripts {
15 | "config.lua",
16 | "client/main.lua",
17 | }
18 |
19 | ui_page {
20 | 'html/ui.html'
21 | }
22 |
23 | files {
24 | 'html/ui.html',
25 | 'html/css/main.css',
26 | 'html/js/app.js',
27 | 'html/images/*.png',
28 | 'html/images/*.jpg',
29 | 'html/ammo_images/*.png',
30 | 'html/attachment_images/*.png',
31 | 'html/*.ttf',
32 | }
33 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
34 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
35 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
36 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
37 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
38 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
39 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
--------------------------------------------------------------------------------
/ax-inventory/config.lua:
--------------------------------------------------------------------------------
1 | Config = {}
2 |
3 | local StringCharset = {}
4 | local NumberCharset = {}
5 |
6 | for i = 48, 57 do table.insert(NumberCharset, string.char(i)) end
7 | for i = 65, 90 do table.insert(StringCharset, string.char(i)) end
8 | for i = 97, 122 do table.insert(StringCharset, string.char(i)) end
9 |
10 | Config.RandomStr = function(length)
11 | if length > 0 then
12 | return Config.RandomStr(length-1) .. StringCharset[math.random(1, #StringCharset)]
13 | else
14 | return ''
15 | end
16 | end
17 |
18 | Config.RandomInt = function(length)
19 | if length > 0 then
20 | return Config.RandomInt(length-1) .. NumberCharset[math.random(1, #NumberCharset)]
21 | else
22 | return ''
23 | end
24 | end
25 |
26 | Config.VendingObjects = {
27 | "prop_vend_soda_01",
28 | "prop_vend_soda_02",
29 | "prop_vend_water_01"
30 | }
31 |
32 | Config.BinObjects = {
33 | "prop_bin_05a",
34 | }
35 |
36 | Config.VendingItem = {
37 | [1] = {
38 | name = "kurkakola",
39 | price = 4,
40 | amount = 50,
41 | info = {},
42 | type = "item",
43 | slot = 1,
44 | },
45 | [2] = {
46 | name = "water_bottle",
47 | price = 4,
48 | amount = 50,
49 | info = {},
50 | type = "item",
51 | slot = 2,
52 | },
53 | }
54 |
55 | Config.CraftingItems = {
56 | [1] = {
57 | name = "lockpick",
58 | amount = 50,
59 | info = {},
60 | costs = {
61 | ["metalscrap"] = 22,
62 | ["plastic"] = 32,
63 | },
64 | type = "item",
65 | slot = 1,
66 | threshold = 0,
67 | points = 1,
68 | },
69 | [2] = {
70 | name = "screwdriverset",
71 | amount = 50,
72 | info = {},
73 | costs = {
74 | ["metalscrap"] = 30,
75 | ["plastic"] = 42,
76 | },
77 | type = "item",
78 | slot = 2,
79 | threshold = 0,
80 | points = 2,
81 | },
82 | [3] = {
83 | name = "electronickit",
84 | amount = 50,
85 | info = {},
86 | costs = {
87 | ["metalscrap"] = 30,
88 | ["plastic"] = 45,
89 | ["aluminum"] = 28,
90 | },
91 | type = "item",
92 | slot = 3,
93 | threshold = 0,
94 | points = 3,
95 | },
96 | [4] = {
97 | name = "radioscanner",
98 | amount = 50,
99 | info = {},
100 | costs = {
101 | ["electronickit"] = 2,
102 | ["plastic"] = 52,
103 | ["steel"] = 40,
104 | },
105 | type = "item",
106 | slot = 4,
107 | threshold = 0,
108 | points = 4,
109 | },
110 | [5] = {
111 | name = "gatecrack",
112 | amount = 50,
113 | info = {},
114 | costs = {
115 | ["metalscrap"] = 10,
116 | ["plastic"] = 50,
117 | ["aluminum"] = 30,
118 | ["iron"] = 17,
119 | ["electronickit"] = 1,
120 | },
121 | type = "item",
122 | slot = 5,
123 | threshold = 120,
124 | points = 5,
125 | },
126 | [6] = {
127 | name = "handcuffs",
128 | amount = 50,
129 | info = {},
130 | costs = {
131 | ["metalscrap"] = 36,
132 | ["steel"] = 24,
133 | ["aluminum"] = 28,
134 | },
135 | type = "item",
136 | slot = 6,
137 | threshold = 160,
138 | points = 6,
139 | },
140 | [7] = {
141 | name = "repairkit",
142 | amount = 50,
143 | info = {},
144 | costs = {
145 | ["metalscrap"] = 32,
146 | ["steel"] = 43,
147 | ["plastic"] = 61,
148 | },
149 | type = "item",
150 | slot = 7,
151 | threshold = 200,
152 | points = 7,
153 | },
154 | [8] = {
155 | name = "pistol_ammo",
156 | amount = 50,
157 | info = {},
158 | costs = {
159 | ["metalscrap"] = 50,
160 | ["steel"] = 37,
161 | ["copper"] = 26,
162 | },
163 | type = "item",
164 | slot = 8,
165 | threshold = 250,
166 | points = 8,
167 | },
168 | [9] = {
169 | name = "ironoxide",
170 | amount = 50,
171 | info = {},
172 | costs = {
173 | ["iron"] = 60,
174 | ["glass"] = 30,
175 | },
176 | type = "item",
177 | slot = 9,
178 | threshold = 300,
179 | points = 9,
180 | },
181 | [10] = {
182 | name = "aluminumoxide",
183 | amount = 50,
184 | info = {},
185 | costs = {
186 | ["aluminum"] = 60,
187 | ["glass"] = 30,
188 | },
189 | type = "item",
190 | slot = 10,
191 | threshold = 300,
192 | points = 10,
193 | },
194 | [11] = {
195 | name = "armor",
196 | amount = 50,
197 | info = {},
198 | costs = {
199 | ["iron"] = 33,
200 | ["steel"] = 44,
201 | ["plastic"] = 55,
202 | ["aluminum"] = 22,
203 | },
204 | type = "item",
205 | slot = 11,
206 | threshold = 350,
207 | points = 11,
208 | },
209 | [12] = {
210 | name = "drill",
211 | amount = 50,
212 | info = {},
213 | costs = {
214 | ["iron"] = 50,
215 | ["steel"] = 50,
216 | ["screwdriverset"] = 3,
217 | ["advancedlockpick"] = 2,
218 | },
219 | type = "item",
220 | slot = 12,
221 | threshold = 1750,
222 | points = 12,
223 | },
224 | }
225 |
226 | Config.AttachmentCrafting = {
227 | ["location"] = {x = 88.91, y = 3743.88, z = 40.77, h = 66.5, r = 1.0},
228 | ["items"] = {
229 | [1] = {
230 | name = "pistol_extendedclip",
231 | amount = 50,
232 | info = {},
233 | costs = {
234 | ["metalscrap"] = 140,
235 | ["steel"] = 250,
236 | ["rubber"] = 60,
237 | },
238 | type = "item",
239 | slot = 1,
240 | threshold = 0,
241 | points = 1,
242 | },
243 | [2] = {
244 | name = "pistol_suppressor",
245 | amount = 50,
246 | info = {},
247 | costs = {
248 | ["metalscrap"] = 165,
249 | ["steel"] = 285,
250 | ["rubber"] = 75,
251 | },
252 | type = "item",
253 | slot = 2,
254 | threshold = 10,
255 | points = 2,
256 | },
257 | [3] = {
258 | name = "rifle_extendedclip",
259 | amount = 50,
260 | info = {},
261 | costs = {
262 | ["metalscrap"] = 190,
263 | ["steel"] = 305,
264 | ["rubber"] = 85,
265 | ["smg_extendedclip"] = 1,
266 | },
267 | type = "item",
268 | slot = 7,
269 | threshold = 25,
270 | points = 8,
271 | },
272 | [4] = {
273 | name = "rifle_drummag",
274 | amount = 50,
275 | info = {},
276 | costs = {
277 | ["metalscrap"] = 205,
278 | ["steel"] = 340,
279 | ["rubber"] = 110,
280 | ["smg_extendedclip"] = 2,
281 | },
282 | type = "item",
283 | slot = 8,
284 | threshold = 50,
285 | points = 8,
286 | },
287 | [5] = {
288 | name = "smg_flashlight",
289 | amount = 50,
290 | info = {},
291 | costs = {
292 | ["metalscrap"] = 230,
293 | ["steel"] = 365,
294 | ["rubber"] = 130,
295 | },
296 | type = "item",
297 | slot = 3,
298 | threshold = 75,
299 | points = 3,
300 | },
301 | [6] = {
302 | name = "smg_extendedclip",
303 | amount = 50,
304 | info = {},
305 | costs = {
306 | ["metalscrap"] = 255,
307 | ["steel"] = 390,
308 | ["rubber"] = 145,
309 | },
310 | type = "item",
311 | slot = 4,
312 | threshold = 100,
313 | points = 4,
314 | },
315 | [7] = {
316 | name = "smg_suppressor",
317 | amount = 50,
318 | info = {},
319 | costs = {
320 | ["metalscrap"] = 270,
321 | ["steel"] = 435,
322 | ["rubber"] = 155,
323 | },
324 | type = "item",
325 | slot = 5,
326 | threshold = 150,
327 | points = 5,
328 | },
329 | [8] = {
330 | name = "smg_scope",
331 | amount = 50,
332 | info = {},
333 | costs = {
334 | ["metalscrap"] = 300,
335 | ["steel"] = 469,
336 | ["rubber"] = 170,
337 | },
338 | type = "item",
339 | slot = 6,
340 | threshold = 200,
341 | points = 6,
342 | },
343 | }
344 | }
345 |
346 | Keys = {
347 | ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
348 | ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
349 | ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
350 | ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
351 | ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
352 | ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
353 | ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
354 | ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
355 | }
356 |
357 | MaxInventorySlots = 40
358 |
359 | BackEngineVehicles = {
360 | 'ninef',
361 | 'adder',
362 | 'vagner',
363 | 't20',
364 | 'infernus',
365 | 'zentorno',
366 | 'reaper',
367 | 'comet2',
368 | 'comet3',
369 | 'jester',
370 | 'jester2',
371 | 'cheetah',
372 | 'cheetah2',
373 | 'prototipo',
374 | 'turismor',
375 | 'pfister811',
376 | 'ardent',
377 | 'nero',
378 | 'nero2',
379 | 'tempesta',
380 | 'vacca',
381 | 'bullet',
382 | 'osiris',
383 | 'entityxf',
384 | 'turismo2',
385 | 'fmj',
386 | 're7b',
387 | 'tyrus',
388 | 'italigtb',
389 | 'penetrator',
390 | 'monroe',
391 | 'ninef2',
392 | 'stingergt',
393 | 'surfer',
394 | 'surfer2',
395 | 'comet3',
396 | }
397 |
398 | Config.MaximumAmmoValues = {
399 | ["pistol"] = 250,
400 | ["smg"] = 250,
401 | ["shotgun"] = 200,
402 | ["rifle"] = 250,
403 | }
--------------------------------------------------------------------------------
/ax-inventory/html/ui.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
Player
66 |

67 |
68 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |

80 |
81 |
86 |
87 |
88 |
89 |
90 |
91 |
116 |
117 |
118 |
119 |
120 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
167 |
168 |
169 |
170 |
171 |
Pistol | 9mm
172 |
This is a water gun yaay ...
173 |
Serial Number 12345678
Durability
174 |

175 |
176 |
Attachments
177 |
178 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
194 |
195 |
196 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
--------------------------------------------------------------------------------
/ax-inventory/html/css/main.css:
--------------------------------------------------------------------------------
1 | @import url('https://fonts.googleapis.com/css?family=Roboto+Mono&display=swap');
2 | @import url('https://fonts.googleapis.com/css?family=Open+Sans:600&display=swap');
3 | @import url('https://fonts.googleapis.com/css?family=Lato&display=swap');
4 | @import url('https://fonts.googleapis.com/css?family=Balthazar&display=swap');
5 | @import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro&display=swap');
6 | @import url('https://fonts.googleapis.com/css?family=Roboto+Slab&display=swap');
7 |
8 | @font-face {
9 | font-family: 'Verdana';
10 | src: url('../verdana.ttf');
11 | }
12 |
13 | @font-face {
14 | font-family: 'Verdana Bold';
15 | src: url('../VerdanaBold.ttf');
16 | }
17 |
18 |
19 | p {
20 | margin: 0 !important;
21 | }
22 |
23 | :root {
24 | --main-label-color: 20, 10, 20;
25 | }
26 |
27 | /* rgb() */
28 |
29 | input[type=number]::-webkit-inner-spin-button,
30 | input[type=number]::-webkit-outer-spin-button {
31 | -webkit-appearance: none;
32 | margin: 0;
33 | }
34 |
35 | ::-webkit-scrollbar
36 | {
37 | width: 4px;
38 | }
39 |
40 | ::-webkit-scrollbar-thumb
41 | {
42 | background-color:rgb(48,70,93);
43 | }
44 |
45 | body {
46 | overflow-x: hidden;
47 | }
48 |
49 | #qbus-inventory {
50 | position: absolute;
51 | width: 100%;
52 | height: 100%;
53 | left: 0vw;
54 | display: none;
55 | }
56 |
57 | .inv-background {
58 | background-color: rgba(0, 0, 0, 0.5);
59 | width: 100%;
60 | height: 100%;
61 | position: absolute;
62 | top: 0;
63 | left: 0;
64 | z-index: -1;
65 | }
66 | @keyframes axis {
67 | from {
68 | margin-top:100%;
69 | }
70 | to {
71 | margin-top:0%;
72 | }
73 | }
74 | .inv-container {
75 | position: absolute;
76 | width: 100%;
77 | height: 100%;
78 | animation: axis 0.3s;
79 | }
80 |
81 | .player-inventory {
82 | position: absolute;
83 | top: 26%;
84 | left: 10.2%;
85 | width: 31.5%;
86 | max-width: 31.5%;
87 | height: 44.16%;
88 | max-height: 44.16%;
89 | float: left;
90 | overflow-x: hidden;
91 | overflow-y: scroll;
92 | z-index: 100;
93 | }
94 |
95 | .other-inventory {
96 | position: absolute;
97 | top: 26%;
98 | right: 10.2%;
99 | width: 31.5%;
100 | max-width: 31.5%;
101 | height: 44.16%;
102 | max-height: 44.16%;
103 | float: left;
104 | overflow-x: hidden;
105 | overflow-y: scroll;
106 | z-index: 100;
107 | }
108 |
109 | .ply-hotbar-inventory {
110 | position: absolute;
111 | bottom: 10%;
112 | left: 35.5%;
113 | z-index: 105;
114 | }
115 |
116 | .player-inventory > .item-slot > .item-slot-key p {
117 | position: absolute;
118 | background:transparent;
119 | color: white;
120 | padding: .3vh;
121 | padding-left: .5vh;
122 | padding-right: .5vh;
123 | text-align: left;
124 | font-size: 1.1vh;
125 | line-height: 1.8vh;
126 | font-family: 'Verdana Bold'
127 | }
128 |
129 | .inv-options {
130 | margin: 18% auto;
131 | background-color: rgba(24, 26, 30, 0.5);
132 | right: 0;
133 | width: 9%;
134 | left: 3vh;
135 | border-radius:8px;
136 | padding-bottom: 30px;
137 | }
138 |
139 | .combine-option-container {
140 | display: none;
141 | position: absolute;
142 | margin: 0 auto;
143 | left: 0;
144 | right: 0;
145 | width: 9%;
146 | top: 60%;
147 | left: 3vh;
148 | }
149 |
150 | .item-slot {
151 | position: relative;
152 | width: 10.5vh;
153 | height: 13.5vh;
154 | float: left;
155 | margin-left: 2px;
156 | margin-bottom: 2px;
157 | background-color: rgba(255, 255, 255, 0.03);
158 | border: 1px solid rgba(255, 255, 255, 0.1);
159 | border-radius: 0px 0px 8px 8px ;
160 | transition: opacity 0.2s;
161 | opacity: 1.0;
162 | }
163 |
164 | /* .other-inventory > .item-slot {
165 | background-color: rgba(61, 11, 11, 0.075);
166 | } */
167 |
168 | .item-slot-hoverClass {
169 | opacity: .6;
170 | }
171 |
172 | .item-slot:hover {
173 | opacity: .7;
174 | }
175 |
176 | .inv-option-item {
177 | margin-top: 20%;
178 | }
179 |
180 | .btn-inv {
181 | width: 100%!important;
182 | max-width: 100%!important;
183 | padding: 10%!important;
184 | background-color: rgba(235, 235, 235, 0);
185 | }
186 |
187 | #item-amount {
188 | color: white;
189 | text-align: center;
190 | font-size: 1.25vh;
191 | font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif;
192 | outline: none;
193 | }
194 |
195 | .ammo-info-block {
196 | position: absolute;
197 | margin: 0 auto;
198 | left: 0;
199 | right: 0;
200 | width: 22vh;
201 | height: 11vh;
202 | background-color: rgba(235, 235, 235, 0.08);
203 | border: 1px solid rgba(255, 255, 255, 0.01);
204 | top: 2vh;
205 | }
206 | .ammo-info-header {
207 | /* background-color: rgba(5, 5, 5, 0.5); */
208 | width: 100%;
209 | color: white;
210 | font-family: 'Open Sans', sans-serif;
211 | background-color: rgba(0, 0, 0, 0.192);
212 | font-size: 1.2vh;
213 | padding: .4vh;
214 | text-align: center;
215 | }
216 | .ammo-info {
217 | position: relative;
218 | color: white;
219 | font-family: 'Open Sans', sans-serif;
220 | font-weight: 200;
221 | font-size: 1.3vh;
222 | margin-left: .8vh;
223 | margin-top: .4vh;
224 | margin-bottom: .25vh;
225 | top: .6vh;
226 | }
227 | .ammo-info span {
228 | margin-right: 1vh;
229 | float: right;
230 | }
231 |
232 | .inv-option-item > p {
233 | color: white;
234 | text-align: center;
235 | line-height: 48px;
236 | text-transform: uppercase;
237 | font-size: 1.1vh;
238 | font-family: Verdana;
239 | }
240 |
241 | .inv-option-item {
242 | width: 80%;
243 | height: 50px;
244 | /* background-color: rgba(120, 10, 20, 0.3); /* rgba(20, 20, 20, 0.5) */
245 | border: 1px solid rgba(255, 255, 255, .01);
246 | border-radius: 7px;
247 | color: white;
248 | transition: background-color .1s linear;
249 | }
250 |
251 | .inv-option-item:hover {
252 | background-color:transparent; /* rgba(20, 20, 20, 0.5) */
253 | }
254 |
255 | .btn-combine {
256 | position: relative;
257 | margin-top: 20%;
258 | width: 80%;
259 | height: 50px;
260 | background-color: #466887; /* rgba(20, 20, 20, 0.5) */
261 | border: 1px solid rgba(255, 255, 255, 0.01);
262 | color: white;
263 | transition: background-color .1s linear;
264 | border-radius: 7px;
265 | }
266 |
267 | .btn-combine > p {
268 | color: white;
269 | text-align: center;
270 | line-height: 48px;
271 | text-transform: uppercase;
272 | font-size: 1.1vh;
273 | font-family: Verdana;
274 | }
275 |
276 | .btn-combine:hover {
277 | background-color:transparent; /* rgba(20, 20, 20, 0.5) */
278 | }
279 |
280 | .item-slot-amount {
281 | position: absolute;
282 | top:0.3vh;
283 | right: 0.3vw;
284 | }
285 |
286 | .item-slot-amount p {
287 | color: #ffffff;
288 | text-align: right;
289 | font-size: 11px;
290 | }
291 |
292 | @import url('https://fonts.googleapis.com/css?family=Source+Code+Pro&display=swap');
293 |
294 | .item-slot-label {
295 | position: absolute;
296 | bottom: 0;
297 | width: 100%;
298 | background-color: #181E25;
299 | min-height: 2vh;
300 | height: auto;
301 | border-radius: 0px 0px 8px 8px ;
302 | }
303 |
304 | .item-slot-label p {
305 | color: rgb(247, 247, 247);
306 | font-size: .95vh;
307 | line-height: 2.2vh;
308 | text-align: center;
309 | text-transform: uppercase;
310 | font-family: Verdana;
311 | font-variant: small-caps;
312 | }
313 |
314 | .item-slot-quality {
315 | position: absolute;
316 | bottom: 2vh;
317 | width: 100%;
318 | height: 1.2vh;
319 | background-color: rgba(32, 6, 6, 0.15);
320 | }
321 |
322 | .item-slot-quality-bar {
323 | position: absolute;
324 | bottom: 0;
325 | width: 0%;
326 | height: 100%;
327 | background-color: rgba(111, 195, 111, 0.8);
328 | box-shadow: inset 0 0 .25vh 0 rgba(0, 0, 0, 0.2);
329 | /*border-radius: 4px;*/
330 | }
331 |
332 | .item-slot-quality p {
333 | color: rgb(247, 247, 247);
334 | font-size: .8vh;
335 | text-align: center;
336 | text-transform: uppercase;
337 | line-height: 1.3vh;
338 | font-family: 'Verdana Bold';
339 | /* font-variant: small-caps; */
340 | }
341 |
342 | .item-slot-img {
343 | max-width: 100%;
344 | max-height: 100%;
345 | padding: 0.5vw;
346 | }
347 |
348 | .item-slot-img img {
349 | display:block;
350 | position: relative;
351 | margin: 0 auto;
352 | margin-top: 21%;
353 | width: auto;
354 | height: auto;
355 | max-width: 100%;
356 | max-height: 100%;
357 | }
358 |
359 | .ui-draggable-dragging {
360 | background: rgba(20,20,20,0.7);
361 | }
362 |
363 | .player-inv-info {
364 | position: absolute;
365 | left: 10.3%;
366 | top: 19.5%;
367 | width: 28.8%;
368 | }
369 |
370 | #player-inv-label {
371 | position: relative;
372 | color: white;
373 | font-size: 18px;
374 | font-family: 'Lato', monospace;
375 | font-weight: bold;
376 | letter-spacing: 0.1vh;
377 | bottom: 15px;
378 | float: left;
379 | }
380 |
381 | #player-inv-weight {
382 | color: white;
383 | font-size: 11px;
384 | font-family: 'Lato', monospace;
385 | letter-spacing: 0.1vh;
386 | float: left;
387 | }
388 |
389 | #other-inv-label {
390 | position: relative;
391 | color: white;
392 | font-size: 18px;
393 | font-family: 'Lato', monospace;
394 | font-weight: bold;
395 | letter-spacing: 0.1vh;
396 | bottom: 15px;
397 | float: left;
398 | }
399 |
400 | #other-inv-weight {
401 | color: white;
402 | font-size: 11px;
403 | font-family: 'Lato', monospace;
404 | letter-spacing: 0.1vh;
405 | float: left;
406 | }
407 |
408 | .player-inv-weight {
409 | position: absolute;
410 | left: 38%;
411 | top: 12%;
412 | }
413 |
414 | .player-inv-weight p {
415 | color: white;
416 | font-size: 12px;
417 | font-family: 'Roboto Mono', monospace;
418 | }
419 |
420 | .other-inv-info {
421 | position: absolute;
422 | left: 58.3%;
423 | top: 19.5%;
424 | width: 28.8%;
425 | }
426 |
427 | .ply-iteminfo-container {
428 | font-family: 'Open Sans';
429 | display: none;
430 | position: absolute;
431 | bottom: 3%;
432 | margin: 0 auto;
433 | left: 0;
434 | right: 0;
435 | width: 35vh;
436 | height: 23vh;
437 | /* background: rgba(20,20,20,0.5); */
438 | }
439 |
440 | .item-info-title {
441 | font-family: sans-serif;
442 | font-size: 1.8vh;
443 | color: white;
444 | font-family: 'Open Sans';
445 | padding-top: 5px;
446 | padding-left: 5px;
447 | }
448 |
449 | .item-info-line {
450 | position: absolute;
451 | font-family: 'Open Sans';
452 | width: 100%;
453 | background-color: white;
454 | height: .1vh;
455 | top: 4.5vh;
456 | }
457 |
458 | .item-info-description {
459 | font-size: 1.1vh;
460 | font-family: 'Open Sans';
461 | color: white;
462 | padding-top: 3vh;
463 | padding-left: .5vh;
464 | }
465 |
466 | .itemboxes-container {
467 | height: 130px;
468 | min-width: 110px;
469 | max-width: 550px;
470 | width: fit-content;
471 | position: absolute;
472 | left: 47%;
473 | bottom: 20%;
474 | overflow: hidden;
475 | }
476 |
477 | .template {
478 | display: none;
479 | }
480 |
481 | .itembox-container {
482 | display: none;
483 | position: relative;
484 | float: left;
485 | margin: 0 auto;
486 | margin-right: 1vh;
487 | width: 110px;
488 | height: 130px;
489 | background-color: rgba(0, 0, 0, 0.2);
490 | border: 1px solid rgba(255, 255, 255, 0.05);
491 | }
492 |
493 | #itembox-action {
494 | position: absolute;
495 | background-color: white;
496 | padding: 4px;
497 | top: 0;
498 | left: 0;
499 | }
500 |
501 | #itembox-action > p {
502 | font-size: 10px;
503 | font-family: 'Verdana Bold';
504 | }
505 |
506 | #itembox-label {
507 | position: absolute;
508 | bottom: 0;
509 | width: 100%;
510 | background-color: #181E25;
511 | min-height: 2.2vh;
512 | height: fit-content;
513 | border-radius: 0px 0px 8px 8px ;
514 | }
515 |
516 | #itembox-label > p {
517 | color: rgb(247, 247, 247);
518 | font-size: 11.5px;
519 | line-height: 2.1vh;
520 | text-align: center;
521 | text-transform: lowercase;
522 | font-family: Verdana, Geneva, Tahoma, sans-serif;
523 | font-variant: small-caps;
524 | }
525 |
526 | .requiredItem-container {
527 | display: none;
528 | position: absolute;
529 | height: 100vh;
530 | width: 100vw;
531 | }
532 |
533 | .requiredItem-box {
534 | position: relative;
535 | top: 70%;
536 | left: 42%;
537 | width: 110px;
538 | height: 130px;
539 | background-color: rgba(0, 0, 0, 0.2);
540 | border: 1px solid rgba(255, 255, 255, 0.1);
541 | float: left;
542 | margin-left: 20px;
543 | }
544 |
545 | #requiredItem-action {
546 | position: absolute;
547 | left: 0;
548 | top: 0;
549 | background-color: white;
550 | padding: 3px;
551 | font-size: 10px;
552 | font-family: 'Verdana Bold';
553 | }
554 |
555 | #requiredItem-label {
556 | position: absolute;
557 | bottom:0;
558 | width: 100%;
559 | background-color: rgba(24, 0, 0, 0.2);
560 | height: 21px;
561 | }
562 |
563 | #requiredItem-label > p {
564 | color: #ffffff;
565 | font-size: 11px;
566 | text-align: center;
567 | text-transform: uppercase;
568 | line-height: 19px;
569 | }
570 |
571 | .z-hotbar-inventory {
572 | display: none;
573 | position: absolute;
574 | bottom: 0;
575 | margin: 0 auto;
576 | left: 0;
577 | right: 0;
578 | width: fit-content;
579 | z-index: 105;
580 | }
581 |
582 | .z-hotbar-inventory > .z-hotbar-item-slot > .z-hotbar-item-slot-key p {
583 | position: absolute;
584 | background:transparent;
585 | color:white;
586 | padding: .3vh;
587 | padding-left: .5vh;
588 | padding-right: .5vh;
589 | text-align: left;
590 | font-size: 1.1vh;
591 | line-height: 1.8vh;
592 | font-family: 'Verdana Bold'
593 | }
594 |
595 | .z-hotbar-item-slot {
596 | position: relative;
597 | width: 10.5vh;
598 | height: 13.5vh;
599 | float: left;
600 | margin-left: 2px;
601 | margin-bottom: 2px;
602 | background-color: rgba(255, 255, 255, 0.03);
603 | border: 1px solid rgba(255, 255, 255, 0.1);
604 | transition: opacity 0.2s;
605 | opacity: 1.0;
606 | }
607 |
608 | .z-hotbar-item-slot-amount {
609 | position: absolute;
610 | top:0.3vh;
611 | right: 0.3vw;
612 | }
613 |
614 | .z-hotbar-item-slot-amount p {
615 | color: #ffffff;
616 | text-align: right;
617 | font-size: 10px;
618 | }
619 |
620 | .z-hotbar-item-slot-label {
621 | position: absolute;
622 | bottom: 0;
623 | width: 100%;
624 | background-color: #181E25;
625 | min-height: 2.2vh;
626 | height: fit-content;
627 | border-radius: 0px 0px 8px 8px ;
628 | }
629 |
630 | .z-hotbar-item-slot-label p {
631 | color: rgb(247, 247, 247);
632 | font-size: 11.5px;
633 | line-height: 2.1vh;
634 | text-align: center;
635 | text-transform: lowercase;
636 | font-family: Verdana, Geneva, Tahoma, sans-serif;
637 | font-variant: small-caps;
638 | }
639 |
640 | .z-hotbar-item-slot-img {
641 | max-width: 100%;
642 | max-height: 100%;
643 | padding: 0.5vw;
644 | }
645 |
646 | .z-hotbar-item-slot-img img {
647 | margin-top: 21%;
648 | display:block;
649 | width: auto;
650 | height: auto;
651 | max-width: 100%;
652 | max-height: 100%;
653 | }
654 |
655 | .ammo-container {
656 | position: absolute;
657 | background-color: rgba(20, 18, 32, 0.2);
658 | width: 3.25%;
659 | height: 44.16%;
660 | top: 26%;
661 | left: 6%;
662 | }
663 |
664 | .ammo-container-header {
665 | position: absolute;
666 | top: 0;
667 | width: 100%;
668 | height: 5vh;
669 | background-color: rgba(120, 10, 20, 0.5);
670 | text-align: center;
671 | color: rgba(216, 216, 216, 0.897);
672 | }
673 |
674 | .ammo-container-header > i {
675 | line-height: 5vh;
676 | font-size: 1.8vh;
677 | }
678 |
679 | .ammo-box {
680 | position: relative;
681 | width: 100%;
682 | height: 6vh;
683 | top: 5vh;
684 | background-color: rgba(0, 0, 0, .4);
685 | margin-bottom: .5vh;
686 | margin-top: .5vh;
687 | }
688 |
689 | .ammo-box > img {
690 | position: absolute;
691 | top: .15vh;
692 | left: .2vh;
693 | width: 5.25vh;
694 | opacity: .25;
695 | }
696 |
697 | .ammo-box > span {
698 | position: absolute;
699 | color: rgba(255, 255, 255, 0.95);
700 | font-size: .93vh;
701 | bottom: 0;
702 | right: 0;
703 | margin: .3vh;
704 | font-family: 'Source Code Pro', monospace;
705 | }
706 |
707 | .ammo-box-amount {
708 | position: absolute;
709 | width: 100%;
710 | background-color: rgba(36, 36, 36, 0.4);
711 | bottom: 0;
712 | max-height: 100%;
713 | }
714 |
715 | #pistol_ammo > .ammo-box-amount {
716 | height: 0%;
717 | }
718 |
719 | #smg_ammo > .ammo-box-amount {
720 | height: 0%;
721 | }
722 |
723 | #shotgun_ammo > .ammo-box-amount {
724 | height: 0%;
725 | }
726 |
727 | #rifle_ammo > .ammo-box-amount {
728 | height: 0%;
729 | }
730 |
731 | /* Weapon Attachments */
732 |
733 | .weapon-attachments-container {
734 | position: absolute;
735 | left: -100vw;
736 | width: 100%;
737 | height: 100%;
738 | background-color: rgba(0, 0, 0, 0.5);
739 | }
740 |
741 | .weapon-attachments-container-title {
742 | position: absolute;
743 | margin: 5vh;
744 | font-size: 3vh;
745 | color: rgb(255, 255, 255);
746 | font-family: 'Source Sans Pro';
747 | }
748 |
749 | .weapon-attachments-container-description {
750 | position: absolute;
751 | margin: 5vh;
752 | top: 5vh;
753 | font-size: 1.7vh;
754 | color: rgba(255, 255, 255, 0.8);
755 | font-family: 'Source Sans Pro';
756 | }
757 |
758 | .weapon-attachments-container-details {
759 | position: absolute;
760 | margin: 5vh;
761 | top: 9vh;
762 | font-size: 1.4vh;
763 | color: rgba(255, 255, 255, 0.8);
764 | font-family: 'Source Sans Pro';
765 | }
766 |
767 | .weapon-attachments-container-detail-durability {
768 | height: 1.5vh;
769 | width: 10vh;
770 | background-color: rgba(0, 0, 0, 0.3);
771 | border-radius: .2vh;
772 | }
773 |
774 | .weapon-attachments-container-detail-durability-total {
775 | height: 100%;
776 | width: 50%;
777 | background-color: rgb(39, 174, 96);
778 | }
779 |
780 | .weapon-attachments-container-image {
781 | position: absolute;
782 | margin: 0 auto;
783 | left: 0;
784 | right: 0;
785 | top: 32%;
786 | width: 50%;
787 | }
788 |
789 | .weapon-attachments {
790 | position: absolute;
791 | bottom: 0;
792 | left: 0;
793 | margin: 5vh;
794 | width: 50vh;
795 | height: 12.5vh;
796 | }
797 |
798 | .weapon-attachments-title {
799 | position: absolute;
800 | bottom: 14vh;
801 | left: 0;
802 | margin: 5vh;
803 | color: rgba(255, 255, 255, 0.8);
804 | }
805 |
806 | .weapon-attachment {
807 | position: relative;
808 | height: 12.5vh;
809 | width: 10.5vh;
810 | background-color: rgba(0, 0, 0, 0.3);
811 | border: 1px solid rgb(75, 75, 75);
812 | margin-right: 1vh;
813 | float: left;
814 | transition: .05s linear;
815 | }
816 |
817 | .weapon-attachment:hover {
818 | background-color: rgba(0, 0, 0, 0.4);
819 | border: 1px solid rgb(29, 29, 29);
820 | transition: .05s linear;
821 | }
822 |
823 | .weapon-attachment-label {
824 | position: absolute;
825 | bottom: 0;
826 | width: 100%;
827 | background-color: rgba(var(--main-label-color), 0.3);
828 | padding: 2.1%;
829 | }
830 |
831 | .weapon-attachment-label > p {
832 | color: #ffffff;
833 | font-size: 1.1vh;
834 | text-align: center;
835 | text-transform: uppercase;
836 | line-height: 1.9vh;
837 | font-family: 'Source Code Pro', monospace;
838 | font-weight: 100;
839 | }
840 |
841 | .weapon-attachment-img {
842 | max-width: 100%;
843 | max-height: 100%;
844 | padding: 0.5vw;
845 | }
846 |
847 | .weapon-attachment-img > img {
848 | display:block;
849 | position: relative;
850 | margin: 0 auto;
851 | margin-top: 10%;
852 | width: auto;
853 | height: auto;
854 | max-width: 100%;
855 | max-height: 100%;
856 | }
857 |
858 | .weapon-attachments-remove {
859 | position: absolute;
860 | width: 6.5vh;
861 | height: 6.5vh;
862 | background-color: rgb(15, 15, 15);
863 | border-radius: 1vh;
864 | margin: 0 auto;
865 | left: 0;
866 | right: 0;
867 | bottom: 20vh;
868 | text-align: center;
869 | color: white;
870 | font-size: 2vh;
871 | transition: background-color .05s linear;
872 | }
873 |
874 | .weapon-attachments-remove:hover {
875 | background-color: rgb(18, 18, 18);
876 | }
877 |
878 | .weapon-attachments-remove > i {
879 | line-height: 6.5vh;
880 | }
881 |
882 | .weapon-attachments-remove-hover {
883 | background-color: rgb(39, 174, 96);
884 | }
885 |
886 | .weapon-dragging-class {
887 | animation: ShakeEffect .75s;
888 | animation-iteration-count: infinite;
889 | }
890 |
891 | @keyframes ShakeEffect {
892 | 0% { transform: translate(1px, 1px) rotate(0deg); }
893 | 10% { transform: translate(-1px, -2px) rotate(-1deg); }
894 | 20% { transform: translate(-3px, 0px) rotate(1deg); }
895 | 30% { transform: translate(3px, 2px) rotate(0deg); }
896 | 40% { transform: translate(1px, -1px) rotate(1deg); }
897 | 50% { transform: translate(-1px, 2px) rotate(-1deg); }
898 | 60% { transform: translate(-3px, 1px) rotate(0deg); }
899 | 70% { transform: translate(3px, 1px) rotate(-1deg); }
900 | 80% { transform: translate(-1px, -1px) rotate(1deg); }
901 | 90% { transform: translate(1px, 2px) rotate(0deg); }
902 | 100% { transform: translate(1px, -2px) rotate(-1deg); }
903 | }
904 |
905 | .weapon-attachments-back {
906 | position: absolute;
907 | bottom: 0;
908 | right: 0;
909 | width: 10vh;
910 | height: 6vh;
911 | margin: 5vh;
912 | background-color: rgb(15, 15, 15);
913 | border-radius: .2vh;
914 | text-align: center;
915 | line-height: 6vh;
916 | color: white;
917 | font-family: 'Source Code Pro', monospace;
918 | transition: .05s linear;
919 | }
920 |
921 | .weapon-attachments-back:hover {
922 | background-color: rgb(18, 18, 18);
923 | }
--------------------------------------------------------------------------------
/ax-inventory/client/main.lua:
--------------------------------------------------------------------------------
1 | QBCore = nil
2 |
3 | inInventory = false
4 | hotbarOpen = false
5 |
6 | local inventoryTest = {}
7 | local currentWeapon = nil
8 | local CurrentWeaponData = {}
9 | local currentOtherInventory = nil
10 |
11 | local Drops = {}
12 | local CurrentDrop = 0
13 | local DropsNear = {}
14 |
15 | local CurrentVehicle = nil
16 | local CurrentGlovebox = nil
17 | local CurrentStash = nil
18 | local isCrafting = false
19 |
20 | local showTrunkPos = false
21 | Citizen.CreateThread(function ()
22 | Citizen.Wait(2000)
23 | while true do
24 | Citizen.Wait(0)
25 | HideHudComponentThisFrame(19)
26 | HideHudComponentThisFrame(20)
27 | BlockWeaponWheelThisFrame()
28 | DisableControlAction(0, 37,true)
29 | end
30 | end)
31 | Citizen.CreateThread(function()
32 | while true do
33 | Citizen.Wait(10)
34 | if QBCore == nil then
35 | TriggerEvent("QBCore:GetObject", function(obj) QBCore = obj end)
36 | Citizen.Wait(200)
37 | end
38 | end
39 | end)
40 |
41 | RegisterNetEvent('inventory:client:CheckOpenState')
42 | AddEventHandler('inventory:client:CheckOpenState', function(type, id, label)
43 | local name = QBCore.Shared.SplitStr(label, "-")[2]
44 | if type == "stash" then
45 | if name ~= CurrentStash or CurrentStash == nil then
46 | TriggerServerEvent('inventory:server:SetIsOpenState', false, type, id)
47 | end
48 | elseif type == "trunk" then
49 | if name ~= CurrentVehicle or CurrentVehicle == nil then
50 | TriggerServerEvent('inventory:server:SetIsOpenState', false, type, id)
51 | end
52 | elseif type == "glovebox" then
53 | if name ~= CurrentGlovebox or CurrentGlovebox == nil then
54 | TriggerServerEvent('inventory:server:SetIsOpenState', false, type, id)
55 | end
56 | end
57 | end)
58 |
59 | RegisterNetEvent('weapons:client:SetCurrentWeapon')
60 | AddEventHandler('weapons:client:SetCurrentWeapon', function(data, bool)
61 | if data ~= false then
62 | CurrentWeaponData = data
63 | else
64 | CurrentWeaponData = {}
65 | end
66 | end)
67 |
68 | function GetClosestVending()
69 | local ped = GetPlayerPed(-1)
70 | local pos = GetEntityCoords(ped)
71 | local object = nil
72 | for _, machine in pairs(Config.VendingObjects) do
73 | local ClosestObject = GetClosestObjectOfType(pos.x, pos.y, pos.z, 50.0, GetHashKey(machine), 0, 0, 0)
74 | if ClosestObject ~= 0 and ClosestObject ~= nil then
75 | if object == nil then
76 | object = ClosestObject
77 | end
78 | end
79 | end
80 | return object
81 | end
82 | RegisterNetEvent('randPickupAnim')
83 | AddEventHandler('randPickupAnim', function()
84 | while not HasAnimDictLoaded("pickup_object") do RequestAnimDict("pickup_object") Wait(100) end
85 | TaskPlayAnim(PlayerPedId(),'pickup_object', 'putdown_low',5.0, 1.5, 1.0, 48, 0.0, 0, 0, 0)
86 | Wait(1000)
87 | ClearPedSecondaryTask(PlayerPedId())
88 | end)
89 |
90 | function PlayToggleEmote()
91 | print('Lauda Sbaka Chota Hai')
92 | end
93 |
94 |
95 | function DrawText3Ds(x, y, z, text)
96 | SetTextScale(0.35, 0.35)
97 | SetTextFont(4)
98 | SetTextProportional(1)
99 | SetTextColour(255, 255, 255, 215)
100 | SetTextEntry("STRING")
101 | SetTextCentre(true)
102 | AddTextComponentString(text)
103 | SetDrawOrigin(x,y,z, 0)
104 | DrawText(0.0, 0.0)
105 | local factor = (string.len(text)) / 370
106 | DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75)
107 | ClearDrawOrigin()
108 | end
109 |
110 | --[[Citizen.CreateThread(function()
111 | while true do
112 | local ped = GetPlayerPed(-1)
113 | local pos = GetEntityCoords(ped)
114 | local inRange = false
115 | local VendingMachine = GetClosestVending()
116 |
117 | if VendingMachine ~= nil then
118 | local VendingPos = GetEntityCoords(VendingMachine)
119 | local Distance = GetDistanceBetweenCoords(pos, VendingPos.x, VendingPos.y, VendingPos.z, true)
120 | if Distance < 20 then
121 | inRange = true
122 | if Distance < 1.5 then
123 | DrawText3Ds(VendingPos.x, VendingPos.y, VendingPos.z, '~g~E~w~ - Buy drinks')
124 | if IsControlJustPressed(0, Keys["E"]) then
125 | local ShopItems = {}
126 | ShopItems.label = "Drankautomaat"
127 | ShopItems.items = Config.VendingItem
128 | ShopItems.slots = #Config.VendingItem
129 | TriggerServerEvent("inventory:server:OpenInventory", "shop", "Vendingshop_"..math.random(1, 99), ShopItems)
130 | end
131 | end
132 | end
133 | end
134 |
135 | if not inRange then
136 | Citizen.Wait(1000)
137 | end
138 |
139 | Citizen.Wait(1)
140 | end
141 | end)]]
142 |
143 | Citizen.CreateThread(function()
144 | while true do
145 | Citizen.Wait(7)
146 | if showTrunkPos and not inInventory then
147 | local vehicle = QBCore.Functions.GetClosestVehicle()
148 | if vehicle ~= 0 and vehicle ~= nil then
149 | local pos = GetEntityCoords(GetPlayerPed(-1))
150 | local vehpos = GetEntityCoords(vehicle)
151 | if (GetDistanceBetweenCoords(pos.x, pos.y, pos.z, vehpos.x, vehpos.y, vehpos.z, true) < 5.0) and not IsPedInAnyVehicle(GetPlayerPed(-1)) then
152 | local drawpos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -2.5, 0)
153 | if (IsBackEngine(GetEntityModel(vehicle))) then
154 | drawpos = GetOffsetFromEntityInWorldCoords(vehicle, 0, 2.5, 0)
155 | end
156 | QBCore.Functions.DrawText3D(drawpos.x, drawpos.y, drawpos.z, "Trunk")
157 | if (GetDistanceBetweenCoords(pos.x, pos.y, pos.z, drawpos) < 2.0) and not IsPedInAnyVehicle(GetPlayerPed(-1)) then
158 | CurrentVehicle = GetVehicleNumberPlateText(vehicle)
159 | showTrunkPos = false
160 | end
161 | else
162 | showTrunkPos = false
163 | end
164 | end
165 | end
166 | end
167 | end)
168 | RegisterNetEvent('khol:hotbar')
169 | AddEventHandler('khol:hotbar', function(itemData, type)
170 | ToggleHotbar(true)
171 | Wait(1500)
172 | ToggleHotbar(false)
173 | end)
174 | Citizen.CreateThread(function()
175 | while true do
176 | Citizen.Wait(0)
177 | DisableControlAction(0, Keys["K"], true)
178 | DisableControlAction(0, Keys["1"], true)
179 | DisableControlAction(0, Keys["2"], true)
180 | DisableControlAction(0, Keys["3"], true)
181 | DisableControlAction(0, Keys["4"], true)
182 | DisableControlAction(0, Keys["5"], true)
183 | if IsDisabledControlJustPressed(0, Keys["K"]) and not isCrafting then
184 | PlayToggleEmote()
185 | QBCore.Functions.GetPlayerData(function(PlayerData)
186 | if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then
187 | local curVeh = nil
188 | if IsPedInAnyVehicle(GetPlayerPed(-1)) then
189 | local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
190 | CurrentGlovebox = GetVehicleNumberPlateText(vehicle)
191 | curVeh = vehicle
192 | CurrentVehicle = nil
193 | else
194 | local vehicle = QBCore.Functions.GetClosestVehicle()
195 | if vehicle ~= 0 and vehicle ~= nil then
196 | local pos = GetEntityCoords(GetPlayerPed(-1))
197 | local trunkpos = GetOffsetFromEntityInWorldCoords(vehicle, 0, -2.5, 0)
198 | if (IsBackEngine(GetEntityModel(vehicle))) then
199 | trunkpos = GetOffsetFromEntityInWorldCoords(vehicle, 0, 2.5, 0)
200 | end
201 | if (GetDistanceBetweenCoords(pos.x, pos.y, pos.z, trunkpos) < 2.0) and not IsPedInAnyVehicle(GetPlayerPed(-1)) then
202 | if GetVehicleDoorLockStatus(vehicle) < 2 then
203 | CurrentVehicle = GetVehicleNumberPlateText(vehicle)
204 | curVeh = vehicle
205 | CurrentGlovebox = nil
206 | else
207 | QBCore.Functions.Notify("Vehicle is locked..", "error")
208 | return
209 | end
210 | else
211 | CurrentVehicle = nil
212 | end
213 | else
214 | CurrentVehicle = nil
215 | end
216 | end
217 |
218 | if CurrentVehicle ~= nil then
219 | local maxweight = 0
220 | local slots = 0
221 | if GetVehicleClass(curVeh) == 0 then
222 | maxweight = 38000
223 | slots = 30
224 | elseif GetVehicleClass(curVeh) == 1 then
225 | maxweight = 50000
226 | slots = 40
227 | elseif GetVehicleClass(curVeh) == 2 then
228 | maxweight = 75000
229 | slots = 50
230 | elseif GetVehicleClass(curVeh) == 3 then
231 | maxweight = 42000
232 | slots = 35
233 | elseif GetVehicleClass(curVeh) == 4 then
234 | maxweight = 38000
235 | slots = 30
236 | elseif GetVehicleClass(curVeh) == 5 then
237 | maxweight = 30000
238 | slots = 25
239 | elseif GetVehicleClass(curVeh) == 6 then
240 | maxweight = 30000
241 | slots = 25
242 | elseif GetVehicleClass(curVeh) == 7 then
243 | maxweight = 30000
244 | slots = 25
245 | elseif GetVehicleClass(curVeh) == 8 then
246 | maxweight = 15000
247 | slots = 15
248 | elseif GetVehicleClass(curVeh) == 9 then
249 | maxweight = 60000
250 | slots = 35
251 | elseif GetVehicleClass(curVeh) == 12 then
252 | maxweight = 120000
253 | slots = 35
254 | else
255 | maxweight = 60000
256 | slots = 35
257 | end
258 | local other = {
259 | maxweight = maxweight,
260 | slots = slots,
261 | }
262 | TriggerServerEvent("inventory:server:OpenInventory", "trunk", CurrentVehicle, other)
263 | OpenTrunk()
264 | elseif CurrentGlovebox ~= nil then
265 | TriggerServerEvent("inventory:server:OpenInventory", "glovebox", CurrentGlovebox)
266 | elseif CurrentDrop ~= 0 then
267 | TriggerServerEvent("inventory:server:OpenInventory", "drop", CurrentDrop)
268 | else
269 | TriggerServerEvent("inventory:server:OpenInventory")
270 | end
271 | end
272 | end)
273 | end
274 | DisableControlAction(0, 37)
275 | if IsDisabledControlJustReleased(1, 37) then
276 | TriggerEvent('khol:hotbar')
277 | end
278 |
279 | if IsDisabledControlJustReleased(0, Keys["1"]) then
280 | QBCore.Functions.GetPlayerData(function(PlayerData)
281 | if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then
282 | TriggerServerEvent("inventory:server:UseItemSlot", 1)
283 | end
284 | end)
285 | end
286 |
287 | if IsDisabledControlJustReleased(0, Keys["2"]) then
288 | QBCore.Functions.GetPlayerData(function(PlayerData)
289 | if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then
290 | TriggerServerEvent("inventory:server:UseItemSlot", 2)
291 | end
292 | end)
293 | end
294 |
295 | if IsDisabledControlJustReleased(0, Keys["3"]) then
296 | QBCore.Functions.GetPlayerData(function(PlayerData)
297 | if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then
298 | TriggerServerEvent("inventory:server:UseItemSlot", 3)
299 | end
300 | end)
301 | end
302 |
303 | if IsDisabledControlJustReleased(0, Keys["4"]) then
304 | QBCore.Functions.GetPlayerData(function(PlayerData)
305 | if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then
306 | TriggerServerEvent("inventory:server:UseItemSlot", 4)
307 | end
308 | end)
309 | end
310 |
311 | if IsDisabledControlJustReleased(0, Keys["5"]) then
312 | QBCore.Functions.GetPlayerData(function(PlayerData)
313 | if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then
314 | TriggerServerEvent("inventory:server:UseItemSlot", 5)
315 | end
316 | end)
317 | end
318 |
319 | --[[ if IsDisabledControlJustReleased(0, Keys["6"]) then
320 | QBCore.Functions.GetPlayerData(function(PlayerData)
321 | if not PlayerData.metadata["isdead"] and not PlayerData.metadata["inlaststand"] and not PlayerData.metadata["ishandcuffed"] then
322 | TriggerServerEvent("inventory:server:UseItemSlot", 41)
323 | end
324 | end)
325 | end]]--
326 | end
327 | end)
328 |
329 | RegisterNetEvent('inventory:client:ItemBox')
330 | AddEventHandler('inventory:client:ItemBox', function(itemData, type)
331 | SendNUIMessage({
332 | action = "itemBox",
333 | item = itemData,
334 | type = type
335 | })
336 | end)
337 |
338 | RegisterNetEvent('inventory:client:requiredItems')
339 | AddEventHandler('inventory:client:requiredItems', function(items, bool)
340 | local itemTable = {}
341 | if bool then
342 | for k, v in pairs(items) do
343 | table.insert(itemTable, {
344 | item = items[k].name,
345 | label = QBCore.Shared.Items[items[k].name]["label"],
346 | image = items[k].image,
347 | })
348 | end
349 | end
350 |
351 | SendNUIMessage({
352 | action = "requiredItem",
353 | items = itemTable,
354 | toggle = bool
355 | })
356 | end)
357 |
358 | Citizen.CreateThread(function()
359 | while true do
360 | Citizen.Wait(1)
361 | if DropsNear ~= nil then
362 | for k, v in pairs(DropsNear) do
363 | if DropsNear[k] ~= nil then
364 | DrawMarker(2, v.coords.x, v.coords.y, v.coords.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.3, 0.3, 0.15, 120, 10, 20, 155, false, false, false, 1, false, false, false)
365 | end
366 | end
367 | end
368 | end
369 | end)
370 |
371 | Citizen.CreateThread(function()
372 | while true do
373 | if Drops ~= nil and next(Drops) ~= nil then
374 | local pos = GetEntityCoords(GetPlayerPed(-1), true)
375 | for k, v in pairs(Drops) do
376 | if Drops[k] ~= nil then
377 | if GetDistanceBetweenCoords(pos.x, pos.y, pos.z, v.coords.x, v.coords.y, v.coords.z, true) < 7.5 then
378 | DropsNear[k] = v
379 | if GetDistanceBetweenCoords(pos.x, pos.y, pos.z, v.coords.x, v.coords.y, v.coords.z, true) < 2 then
380 | CurrentDrop = k
381 | else
382 | CurrentDrop = nil
383 | end
384 | else
385 | DropsNear[k] = nil
386 | end
387 | end
388 | end
389 | else
390 | DropsNear = {}
391 | end
392 | Citizen.Wait(500)
393 | end
394 | end)
395 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
396 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
397 | RegisterNetEvent("QBCore:Client:OnPlayerLoaded")
398 | AddEventHandler("QBCore:Client:OnPlayerLoaded", function()
399 | --TriggerServerEvent("inventory:server:LoadDrops")
400 | end)
401 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
402 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
403 | RegisterNetEvent('inventory:server:RobPlayer')
404 | AddEventHandler('inventory:server:RobPlayer', function(TargetId)
405 | SendNUIMessage({
406 | action = "RobMoney",
407 | TargetId = TargetId,
408 | })
409 | end)
410 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
411 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
412 | RegisterNUICallback('RobMoney', function(data, cb)
413 | TriggerServerEvent("police:server:RobPlayer", data.TargetId)
414 | end)
415 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
416 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
417 | RegisterNUICallback('Notify', function(data, cb)
418 | QBCore.Functions.Notify(data.message, data.type)
419 | end)
420 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
421 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
422 | RegisterNetEvent("inventory:client:OpenInventory")
423 | AddEventHandler("inventory:client:OpenInventory", function(PlayerAmmo, inventory, other)
424 | if not IsEntityDead(GetPlayerPed(-1)) then
425 | ToggleHotbar(false)
426 | SetNuiFocus(true, true)
427 | if other ~= nil then
428 | currentOtherInventory = other.name
429 | end
430 | SendNUIMessage({
431 | action = "open",
432 | inventory = inventory,
433 | slots = MaxInventorySlots,
434 | other = other,
435 | maxweight = QBCore.Config.Player.MaxWeight,
436 | Ammo = PlayerAmmo,
437 | maxammo = Config.MaximumAmmoValues,
438 | })
439 | inInventory = true
440 | end
441 | end)
442 | RegisterNUICallback("GiveItem", function(data, cb)
443 | local player, distance = GetClosestPlayer()
444 | if player ~= -1 and distance < 2.5 then
445 | local playerPed = GetPlayerPed(player)
446 | local playerId = GetPlayerServerId(player)
447 | local plyCoords = GetEntityCoords(playerPed)
448 | local pos = GetEntityCoords(GetPlayerPed(-1))
449 | local dist = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, plyCoords.x, plyCoords.y, plyCoords.z, true)
450 | if dist < 2.5 then
451 | SetCurrentPedWeapon(PlayerPedId(),'WEAPON_UNARMED',true)
452 | TriggerServerEvent("inventory:server:GiveItem", playerId, data.inventory, data.item, data.amount)
453 | print(data.amount)
454 | else
455 | QBCore.Functions.Notify("No one nearby!", "error")
456 | end
457 | else--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
458 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
459 | QBCore.Functions.Notify("No one nearby!", "error")
460 | end
461 | end)
462 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
463 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
464 | function GetClosestPlayer()
465 | local closestPlayers = QBCore.Functions.GetPlayersFromCoords()
466 | local closestDistance = -1
467 | local closestPlayer = -1
468 | local coords = GetEntityCoords(GetPlayerPed(-1))
469 |
470 | for i=1, #closestPlayers, 1 do
471 | if closestPlayers[i] ~= PlayerId() then
472 | local pos = GetEntityCoords(GetPlayerPed(closestPlayers[i]))
473 | local distance = GetDistanceBetweenCoords(pos.x, pos.y, pos.z, coords.x, coords.y, coords.z, true)
474 |
475 | if closestDistance == -1 or closestDistance > distance then
476 | closestPlayer = closestPlayers[i]
477 | closestDistance = distance
478 | end
479 | end
480 | end
481 |
482 | return closestPlayer, closestDistance
483 | end
484 | RegisterNetEvent("inventory:client:ShowTrunkPos")
485 | AddEventHandler("inventory:client:ShowTrunkPos", function()
486 | showTrunkPos = true
487 | end)
488 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
489 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
490 | RegisterNetEvent("inventory:client:UpdatePlayerInventory")
491 | AddEventHandler("inventory:client:UpdatePlayerInventory", function(isError)
492 | SendNUIMessage({
493 | action = "update",
494 | inventory = QBCore.Functions.GetPlayerData().items,
495 | maxweight = QBCore.Config.Player.MaxWeight,
496 | slots = MaxInventorySlots,
497 | error = isError,
498 | })
499 | end)
500 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
501 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
502 | RegisterNetEvent("inventory:client:CraftItems")
503 | AddEventHandler("inventory:client:CraftItems", function(itemName, itemCosts, amount, toSlot, points)
504 | SendNUIMessage({
505 | action = "close",
506 | })
507 | isCrafting = true
508 | QBCore.Functions.Progressbar("repair_vehicle", "Crafting..", (math.random(2000, 5000) * amount), false, true, {
509 | disableMovement = true,
510 | disableCarMovement = true,
511 | disableMouse = false,
512 | disableCombat = true,
513 | }, {
514 | animDict = "mini@repair",
515 | anim = "fixing_a_player",
516 | flags = 16,
517 | }, {}, {}, function() -- Done
518 | StopAnimTask(GetPlayerPed(-1), "mini@repair", "fixing_a_player", 1.0)
519 | TriggerServerEvent("inventory:server:CraftItems", itemName, itemCosts, amount, toSlot, points)
520 | TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'add')
521 | isCrafting = false
522 | end, function() -- Cancel
523 | StopAnimTask(GetPlayerPed(-1), "mini@repair", "fixing_a_player", 1.0)
524 | QBCore.Functions.Notify("Failed!", "error")
525 | isCrafting = false
526 | end)
527 | end)
528 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
529 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
530 | RegisterNetEvent('inventory:client:CraftAttachment')
531 | AddEventHandler('inventory:client:CraftAttachment', function(itemName, itemCosts, amount, toSlot, points)
532 | SendNUIMessage({
533 | action = "close",
534 | })
535 | isCrafting = true
536 | QBCore.Functions.Progressbar("repair_vehicle", "Crafting..", (math.random(2000, 5000) * amount), false, true, {
537 | disableMovement = true,
538 | disableCarMovement = true,
539 | disableMouse = false,
540 | disableCombat = true,
541 | }, {
542 | animDict = "mini@repair",
543 | anim = "fixing_a_player",
544 | flags = 16,
545 | }, {}, {}, function() -- Done
546 | StopAnimTask(GetPlayerPed(-1), "mini@repair", "fixing_a_player", 1.0)
547 | TriggerServerEvent("inventory:server:CraftAttachment", itemName, itemCosts, amount, toSlot, points)
548 | TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'add')
549 | isCrafting = false
550 | end, function() -- Cancel
551 | StopAnimTask(GetPlayerPed(-1), "mini@repair", "fixing_a_player", 1.0)
552 | QBCore.Functions.Notify("Failed!", "error")
553 | isCrafting = false
554 | end)
555 | end)
556 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
557 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
558 | RegisterNetEvent("inventory:client:PickupSnowballs")
559 | AddEventHandler("inventory:client:PickupSnowballs", function()
560 | LoadAnimDict('anim@mp_snowball')
561 | TaskPlayAnim(GetPlayerPed(-1), 'anim@mp_snowball', 'pickup_snowball', 3.0, 3.0, -1, 0, 1, 0, 0, 0)
562 | QBCore.Functions.Progressbar("pickupsnowball", "Sneeuwballen oprapen..", 1500, false, true, {
563 | disableMovement = true,
564 | disableCarMovement = true,
565 | disableMouse = false,
566 | disableCombat = true,
567 | }, {}, {}, {}, function() -- Done
568 | ClearPedTasks(GetPlayerPed(-1))
569 | TriggerServerEvent('QBCore:Server:AddItem', "snowball", 1)
570 | TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items["snowball"], "add")
571 | end, function() -- Cancel
572 | ClearPedTasks(GetPlayerPed(-1))
573 | QBCore.Functions.Notify("Canceled..", "error")
574 | end)
575 | end)
576 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
577 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
578 | RegisterNetEvent("inventory:client:UseSnowball")
579 | AddEventHandler("inventory:client:UseSnowball", function(amount)
580 | GiveWeaponToPed(GetPlayerPed(-1), GetHashKey("weapon_snowball"), amount, false, false)
581 | SetPedAmmo(GetPlayerPed(-1), GetHashKey("weapon_snowball"), amount)
582 | SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey("weapon_snowball"), true)
583 | end)
584 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
585 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
586 | RegisterNetEvent("inventory:client:UseWeapon")
587 | AddEventHandler("inventory:client:UseWeapon", function(weaponData, shootbool)
588 | local weaponName = tostring(weaponData.name)
589 | if currentWeapon == weaponName then
590 | SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey("WEAPON_UNARMED"), true)
591 | RemoveAllPedWeapons(GetPlayerPed(-1), true)
592 | TriggerEvent('weapons:client:SetCurrentWeapon', nil, shootbool)
593 | currentWeapon = nil
594 | elseif weaponName == "weapon_stickybomb" then
595 | GiveWeaponToPed(GetPlayerPed(-1), GetHashKey(weaponName), ammo, false, false)
596 | SetPedAmmo(GetPlayerPed(-1), GetHashKey(weaponName), 1)
597 | SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey(weaponName), true)
598 | TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
599 | TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
600 | currentWeapon = weaponName
601 | elseif weaponName == "weapon_snowball" then
602 | GiveWeaponToPed(GetPlayerPed(-1), GetHashKey(weaponName), ammo, false, false)
603 | SetPedAmmo(GetPlayerPed(-1), GetHashKey(weaponName), 10)
604 | SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey(weaponName), true)
605 | TriggerServerEvent('QBCore:Server:RemoveItem', weaponName, 1)
606 | TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
607 | currentWeapon = weaponName
608 | else
609 | TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
610 | QBCore.Functions.TriggerCallback("weapon:server:GetWeaponAmmo", function(result)
611 | local ammo = tonumber(result)
612 | if weaponName == "weapon_petrolcan" or weaponName == "weapon_fireextinguisher" then
613 | ammo = 4000
614 | end
615 | GiveWeaponToPed(GetPlayerPed(-1), GetHashKey(weaponName), ammo, false, false)
616 | SetPedAmmo(GetPlayerPed(-1), GetHashKey(weaponName), ammo)
617 | SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey(weaponName), true)
618 | if weaponData.info.attachments ~= nil then
619 | for _, attachment in pairs(weaponData.info.attachments) do
620 | GiveWeaponComponentToPed(GetPlayerPed(-1), GetHashKey(weaponName), GetHashKey(attachment.component))
621 | end
622 | end
623 | currentWeapon = weaponName
624 | end, CurrentWeaponData)
625 | end
626 | end)
627 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
628 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
629 | WeaponAttachments = {
630 | ["WEAPON_SNSPISTOL"] = {
631 | ["extendedclip"] = {
632 | component = "COMPONENT_SNSPISTOL_CLIP_02",
633 | label = "Extended Clip",
634 | item = "pistol_extendedclip",
635 | },
636 | },
637 | ["WEAPON_VINTAGEPISTOL"] = {
638 | ["suppressor"] = {
639 | component = "COMPONENT_AT_PI_SUPP",
640 | label = "Suppressor",
641 | item = "pistol_suppressor",
642 | },
643 | ["extendedclip"] = {
644 | component = "COMPONENT_VINTAGEPISTOL_CLIP_02",
645 | label = "Extended Clip",
646 | item = "pistol_extendedclip",
647 | },
648 | },
649 | ["WEAPON_MICROSMG"] = {
650 | ["suppressor"] = {
651 | component = "COMPONENT_AT_AR_SUPP_02",
652 | label = "Suppressor",
653 | item = "smg_suppressor",
654 | },
655 | ["extendedclip"] = {
656 | component = "COMPONENT_MICROSMG_CLIP_02",
657 | label = "Extended Clip",
658 | item = "smg_extendedclip",
659 | },
660 | ["flashlight"] = {
661 | component = "COMPONENT_AT_PI_FLSH",
662 | label = "Flashlight",
663 | item = "smg_flashlight",
664 | },
665 | ["scope"] = {
666 | component = "COMPONENT_AT_SCOPE_MACRO",
667 | label = "Scope",
668 | item = "smg_scope",
669 | },
670 | },
671 | ["WEAPON_MINISMG"] = {
672 | ["extendedclip"] = {
673 | component = "COMPONENT_MINISMG_CLIP_02",
674 | label = "Extended Clip",
675 | item = "smg_extendedclip",
676 | },
677 | },
678 | ["WEAPON_COMPACTRIFLE"] = {
679 | ["extendedclip"] = {
680 | component = "COMPONENT_COMPACTRIFLE_CLIP_02",
681 | label = "Extended Clip",
682 | item = "rifle_extendedclip",
683 | },
684 | ["drummag"] = {
685 | component = "COMPONENT_COMPACTRIFLE_CLIP_03",
686 | label = "Drum Mag",
687 | item = "rifle_drummag",
688 | },
689 | },
690 | }
691 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
692 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
693 | function FormatWeaponAttachments(itemdata)
694 | local attachments = {}
695 | itemdata.name = itemdata.name:upper()
696 | if itemdata.info.attachments ~= nil and next(itemdata.info.attachments) ~= nil then
697 | for k, v in pairs(itemdata.info.attachments) do
698 | if WeaponAttachments[itemdata.name] ~= nil then
699 | for key, value in pairs(WeaponAttachments[itemdata.name]) do
700 | if value.component == v.component then
701 | table.insert(attachments, {
702 | attachment = key,
703 | label = value.label
704 | })
705 | end
706 | end
707 | end
708 | end
709 | end
710 | return attachments
711 | end
712 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
713 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
714 | RegisterNUICallback('GetWeaponData', function(data, cb)
715 | local data = {
716 | WeaponData = QBCore.Shared.Items[data.weapon],
717 | AttachmentData = FormatWeaponAttachments(data.ItemData)
718 | }
719 | cb(data)
720 | end)
721 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
722 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
723 | RegisterNUICallback('RemoveAttachment', function(data, cb)
724 | local WeaponData = QBCore.Shared.Items[data.WeaponData.name]
725 | local Attachment = WeaponAttachments[WeaponData.name:upper()][data.AttachmentData.attachment]
726 |
727 | QBCore.Functions.TriggerCallback('weapons:server:RemoveAttachment', function(NewAttachments)
728 | if NewAttachments ~= false then
729 | local Attachies = {}
730 | RemoveWeaponComponentFromPed(GetPlayerPed(-1), GetHashKey(data.WeaponData.name), GetHashKey(Attachment.component))
731 | for k, v in pairs(NewAttachments) do
732 | for wep, pew in pairs(WeaponAttachments[WeaponData.name:upper()]) do
733 | if v.component == pew.component then
734 | table.insert(Attachies, {
735 | attachment = pew.item,
736 | label = pew.label,
737 | })
738 | end
739 | end
740 | end
741 | local DJATA = {
742 | Attachments = Attachies,
743 | WeaponData = WeaponData,
744 | }
745 | cb(DJATA)
746 | else
747 | RemoveWeaponComponentFromPed(GetPlayerPed(-1), GetHashKey(data.WeaponData.name), GetHashKey(Attachment.component))
748 | cb({})
749 | end
750 | end, data.AttachmentData, data.WeaponData)
751 | end)
752 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
753 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
754 | RegisterNetEvent("inventory:client:CheckWeapon")
755 | AddEventHandler("inventory:client:CheckWeapon", function(weaponName)
756 | if currentWeapon == weaponName then
757 | TriggerEvent('weapons:ResetHolster')
758 | SetCurrentPedWeapon(GetPlayerPed(-1), GetHashKey("WEAPON_UNARMED"), true)
759 | RemoveAllPedWeapons(GetPlayerPed(-1), true)
760 | currentWeapon = nil
761 | end
762 | end)
763 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
764 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
765 | RegisterNetEvent("inventory:client:AddDropItem")
766 | AddEventHandler("inventory:client:AddDropItem", function(dropId, player)
767 | local coords = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(player)))
768 | local forward = GetEntityForwardVector(GetPlayerPed(GetPlayerFromServerId(player)))
769 | local x, y, z = table.unpack(coords + forward * 0.5)
770 | Drops[dropId] = {
771 | id = dropId,
772 | coords = {
773 | x = x,
774 | y = y,
775 | z = z - 0.3,
776 | },
777 | }
778 | end)
779 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
780 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
781 | RegisterNetEvent("inventory:client:RemoveDropItem")
782 | AddEventHandler("inventory:client:RemoveDropItem", function(dropId)
783 | Drops[dropId] = nil
784 | end)
785 |
786 | RegisterNetEvent("inventory:client:DropItemAnim")
787 | AddEventHandler("inventory:client:DropItemAnim", function()
788 | SendNUIMessage({
789 | action = "close",
790 | })
791 | RequestAnimDict("pickup_object")
792 | while not HasAnimDictLoaded("pickup_object") do
793 | Citizen.Wait(7)
794 | end
795 | TaskPlayAnim(GetPlayerPed(-1), "pickup_object" ,"pickup_low" ,8.0, -8.0, -1, 1, 0, false, false, false )
796 | Citizen.Wait(2000)
797 | ClearPedTasks(GetPlayerPed(-1))
798 | end)
799 |
800 | --[[RegisterNetEvent("inventory:client:ShowId")
801 | AddEventHandler("inventory:client:ShowId", function(sourceId, citizenid, character)
802 | local sourcePos = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(sourceId)), false)
803 | local pos = GetEntityCoords(GetPlayerPed(-1), false)
804 | if (GetDistanceBetweenCoords(pos.x, pos.y, pos.z, sourcePos.x, sourcePos.y, sourcePos.z, true) < 2.0) then
805 | local gender = "Man"
806 | if character.gender == 1 then
807 | gender = "Vrouw"
808 | end
809 | TriggerEvent('chat:addMessage', {
810 | template = '{0}:
CSN: {1}
First Name: {2}
Last Name: {3}
Birth Date: {4}
Sex: {5}
Nationality: {6}
Job: {7}
',
811 | args = {'ID-Card', character.citizenid, character.firstname, character.lastname, character.birthdate, gender, character.nationality,character.job}
812 | })
813 | end
814 | end)
815 |
816 | RegisterNetEvent("inventory:client:ShowDriverLicense")
817 | AddEventHandler("inventory:client:ShowDriverLicense", function(sourceId, citizenid, character)
818 | local sourcePos = GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(sourceId)), false)
819 | local pos = GetEntityCoords(GetPlayerPed(-1), false)
820 | if (GetDistanceBetweenCoords(pos.x, pos.y, pos.z, sourcePos.x, sourcePos.y, sourcePos.z, true) < 2.0) then
821 | TriggerEvent('chat:addMessage', {
822 | template = '{0}:
First Name: {1}
Last Name: {2}
Birth Date: {3}
Licenses: {4}
',
823 | args = {'Drivers license', character.firstname, character.lastname, character.birthdate, character.type}
824 | })
825 | end
826 | end)]]
827 |
828 | RegisterNetEvent("inventory:client:SetCurrentStash")
829 | AddEventHandler("inventory:client:SetCurrentStash", function(stash)
830 | CurrentStash = stash
831 | end)
832 |
833 | RegisterNUICallback('getCombineItem', function(data, cb)
834 | cb(QBCore.Shared.Items[data.item])
835 | end)
836 |
837 | RegisterNUICallback("CloseInventory", function(data, cb)
838 | if currentOtherInventory == "none-inv" then
839 | CurrentDrop = 0
840 | CurrentVehicle = nil
841 | CurrentGlovebox = nil
842 | CurrentStash = nil
843 | SetNuiFocus(false, false)
844 | inInventory = false
845 | ClearPedTasks(GetPlayerPed(-1))
846 | return
847 | end
848 | if CurrentVehicle ~= nil then
849 | CloseTrunk()
850 | TriggerServerEvent("inventory:server:SaveInventory", "trunk", CurrentVehicle)
851 | CurrentVehicle = nil
852 | elseif CurrentGlovebox ~= nil then
853 | TriggerServerEvent("inventory:server:SaveInventory", "glovebox", CurrentGlovebox)
854 | CurrentGlovebox = nil
855 | elseif CurrentStash ~= nil then
856 | TriggerServerEvent("inventory:server:SaveInventory", "stash", CurrentStash)
857 | CurrentStash = nil
858 | else
859 | TriggerServerEvent("inventory:server:SaveInventory", "drop", CurrentDrop)
860 | CurrentDrop = 0
861 | end
862 | SetNuiFocus(false, false)
863 | inInventory = false
864 | TriggerEvent('randPickupAnim')
865 | end)
866 | RegisterNUICallback("UseItem", function(data, cb)
867 | TriggerServerEvent("inventory:server:UseItem", data.inventory, data.item)
868 | end)
869 |
870 | RegisterNUICallback("combineItem", function(data)
871 | Citizen.Wait(150)
872 | TriggerServerEvent('inventory:server:combineItem', data.reward, data.fromItem, data.toItem)
873 | TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[data.reward], 'add')
874 | end)
875 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
876 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
877 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
878 | RegisterNUICallback('combineWithAnim', function(data)
879 | local combineData = data.combineData
880 | local aDict = combineData.anim.dict
881 | local aLib = combineData.anim.lib
882 | local animText = combineData.anim.text
883 | local animTimeout = combineData.anim.timeOut
884 |
885 | QBCore.Functions.Progressbar("combine_anim", animText, animTimeout, false, true, {
886 | disableMovement = false,
887 | disableCarMovement = true,
888 | disableMouse = false,
889 | disableCombat = true,
890 | }, {
891 | animDict = aDict,
892 | anim = aLib,
893 | flags = 16,
894 | }, {}, {}, function() -- Done
895 | StopAnimTask(GetPlayerPed(-1), aDict, aLib, 1.0)
896 | end, function() -- Cancel
897 | StopAnimTask(GetPlayerPed(-1), aDict, aLib, 1.0)
898 | QBCore.Functions.Notify("Mislukt!", "error")
899 | end)
900 | TriggerServerEvent('inventory:server:combineItem', combineData.reward, data.requiredItem, data.usedItem)
901 | TriggerEvent('inventory:client:ItemBox', QBCore.Shared.Items[combineData.reward], 'add')
902 | end)
903 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
904 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
905 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
906 | RegisterNUICallback("SetInventoryData", function(data, cb)
907 | TriggerServerEvent("inventory:server:SetInventoryData", data.fromInventory, data.toInventory, data.fromSlot, data.toSlot, data.fromAmount, data.toAmount)
908 | end)
909 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
910 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
911 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
912 | RegisterNUICallback("PlayDropSound", function(data, cb)
913 | PlaySound(-1, "CLICK_BACK", "WEB_NAVIGATION_SOUNDS_PHONE", 0, 0, 1)
914 | end)
915 |
916 | RegisterNUICallback("PlayDropFail", function(data, cb)
917 | PlaySound(-1, "Place_Prop_Fail", "DLC_Dmod_Prop_Editor_Sounds", 0, 0, 1)
918 | end)
919 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
920 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
921 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
922 | function OpenTrunk()
923 | local vehicle = QBCore.Functions.GetClosestVehicle()
924 | while (not HasAnimDictLoaded("amb@prop_human_bum_bin@idle_b")) do
925 | RequestAnimDict("amb@prop_human_bum_bin@idle_b")
926 | Citizen.Wait(100)
927 | end
928 | TaskPlayAnim(GetPlayerPed(-1), "amb@prop_human_bum_bin@idle_b", "idle_d", 4.0, 4.0, -1, 50, 0, false, false, false)
929 | if (IsBackEngine(GetEntityModel(vehicle))) then
930 | SetVehicleDoorOpen(vehicle, 4, false, false)
931 | else
932 | SetVehicleDoorOpen(vehicle, 5, false, false)
933 | end
934 | end
935 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
936 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
937 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
938 | function CloseTrunk()
939 | local vehicle = QBCore.Functions.GetClosestVehicle()
940 | while (not HasAnimDictLoaded("amb@prop_human_bum_bin@idle_b")) do
941 | RequestAnimDict("amb@prop_human_bum_bin@idle_b")
942 | Citizen.Wait(100)
943 | end
944 | TaskPlayAnim(GetPlayerPed(-1), "amb@prop_human_bum_bin@idle_b", "exit", 4.0, 4.0, -1, 50, 0, false, false, false)
945 | if (IsBackEngine(GetEntityModel(vehicle))) then
946 | SetVehicleDoorShut(vehicle, 4, false)
947 | else
948 | SetVehicleDoorShut(vehicle, 5, false)
949 | end
950 | end
951 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
952 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
953 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
954 | function IsBackEngine(vehModel)
955 | for _, model in pairs(BackEngineVehicles) do
956 | if GetHashKey(model) == vehModel then
957 | return true
958 | end
959 | end
960 | return false
961 | end
962 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
963 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
964 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
965 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
966 | function ToggleHotbar(toggle)
967 | local HotbarItems = {
968 | [1] = QBCore.Functions.GetPlayerData().items[1],
969 | [2] = QBCore.Functions.GetPlayerData().items[2],
970 | [3] = QBCore.Functions.GetPlayerData().items[3],
971 | [4] = QBCore.Functions.GetPlayerData().items[4],
972 | [5] = QBCore.Functions.GetPlayerData().items[5],
973 | [41] = QBCore.Functions.GetPlayerData().items[41],
974 | }
975 |
976 | if toggle then
977 | SendNUIMessage({
978 | action = "toggleHotbar",
979 | open = true,
980 | items = HotbarItems
981 | })
982 | else
983 | SendNUIMessage({
984 | action = "toggleHotbar",
985 | open = false,
986 | })
987 | end
988 | end
989 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
990 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
991 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
992 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
993 | function LoadAnimDict( dict )
994 | while ( not HasAnimDictLoaded( dict ) ) do
995 | RequestAnimDict( dict )
996 | Citizen.Wait( 5 )
997 | end
998 | end
999 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1000 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1001 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1002 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1003 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1004 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1005 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1006 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
1007 | function closeInventory()
1008 | isInInventory = false
1009 | ClearPedSecondaryTask(PlayerPedId())
1010 | SetNuiFocus(false, false)
1011 | SendNUIMessage({
1012 | action = "close",
1013 | })
1014 | TriggerScreenblurFadeOut(0)
1015 | ClearPedTasks(PlayerPedId())
1016 | end
1017 | RegisterCommand('closeinv', function()
1018 | closeInventory()
1019 | end, false)
1020 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
1021 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
--------------------------------------------------------------------------------
/ax-inventory/server/main.lua:
--------------------------------------------------------------------------------
1 | QBCore = nil
2 | TriggerEvent('QBCore:GetObject', function(obj) QBCore = obj end)
3 |
4 | Drops = {}
5 | Trunks = {}
6 | Gloveboxes = {}
7 | Stashes = {}
8 | ShopItems = {}
9 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
10 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
11 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
12 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
13 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
14 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
15 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
16 | RegisterServerEvent("inventory:server:LoadDrops")
17 | AddEventHandler('inventory:server:LoadDrops', function()
18 | local src = source
19 | if next(Drops) ~= nil then
20 | TriggerClientEvent("inventory:client:AddDropItem", -1, dropId, source)
21 | TriggerClientEvent("inventory:client:AddDropItem", src, Drops)
22 | end
23 | end)
24 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
25 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
26 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
27 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
28 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
29 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
30 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
31 | RegisterServerEvent("inventory:server:addTrunkItems")
32 | AddEventHandler('inventory:server:addTrunkItems', function(plate, items)
33 | Trunks[plate] = {}
34 | Trunks[plate].items = items
35 | end)
36 |
37 | RegisterServerEvent("inventory:server:combineItem")
38 | AddEventHandler('inventory:server:combineItem', function(item, fromItem, toItem)
39 | local src = source
40 | local ply = QBCore.Functions.GetPlayer(src)
41 |
42 | ply.Functions.AddItem(item, 1)
43 | ply.Functions.RemoveItem(fromItem, 1)
44 | ply.Functions.RemoveItem(toItem, 1)
45 | end)
46 |
47 | RegisterServerEvent("inventory:server:CraftItems")
48 | AddEventHandler('inventory:server:CraftItems', function(itemName, itemCosts, amount, toSlot, points)
49 | local src = source
50 | local Player = QBCore.Functions.GetPlayer(src)
51 | local amount = tonumber(amount)
52 | if itemName ~= nil and itemCosts ~= nil then
53 | for k, v in pairs(itemCosts) do
54 | Player.Functions.RemoveItem(k, (v*amount))
55 | end
56 | Player.Functions.AddItem(itemName, amount, toSlot)
57 | Player.Functions.SetMetaData("craftingrep", Player.PlayerData.metadata["craftingrep"]+(points*amount))
58 | TriggerClientEvent("inventory:client:UpdatePlayerInventory", src, false)
59 | end
60 | end)
61 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
62 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
63 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
64 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
65 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
66 | RegisterServerEvent('inventory:server:CraftAttachment')
67 | AddEventHandler('inventory:server:CraftAttachment', function(itemName, itemCosts, amount, toSlot, points)
68 | local src = source
69 | local Player = QBCore.Functions.GetPlayer(src)
70 | local amount = tonumber(amount)
71 | if itemName ~= nil and itemCosts ~= nil then
72 | for k, v in pairs(itemCosts) do
73 | Player.Functions.RemoveItem(k, (v*amount))
74 | end
75 | Player.Functions.AddItem(itemName, amount, toSlot)
76 | Player.Functions.SetMetaData("attachmentcraftingrep", Player.PlayerData.metadata["attachmentcraftingrep"]+(points*amount))
77 | TriggerClientEvent("inventory:client:UpdatePlayerInventory", src, false)
78 | end
79 | end)
80 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
81 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
82 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
83 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
84 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
85 | RegisterServerEvent("inventory:server:SetIsOpenState")
86 | AddEventHandler('inventory:server:SetIsOpenState', function(IsOpen, type, id)
87 | if not IsOpen then
88 | if type == "stash" then
89 | Stashes[id].isOpen = false
90 | elseif type == "trunk" then
91 | Trunks[id].isOpen = false
92 | elseif type == "glovebox" then
93 | Gloveboxes[id].isOpen = false
94 | end
95 | end
96 | end)
97 | RegisterServerEvent("inventory:server:GiveItem")
98 | AddEventHandler('inventory:server:GiveItem', function(name, inventory, item, amount)
99 | local src = source
100 | local Player = QBCore.Functions.GetPlayer(src)
101 | local OtherPlayer = QBCore.Functions.GetPlayer(tonumber(name))
102 | local Target = OtherPlayer.PlayerData.charinfo.firstname..' '..OtherPlayer.PlayerData.charinfo.lastname
103 | local YourName = Player.PlayerData.charinfo.firstname..' '..Player.PlayerData.charinfo.lastname
104 | if amount ~= 0 then
105 | if Player.Functions.RemoveItem(item.name, amount,false, item.info) and OtherPlayer.Functions.AddItem(item.name, amount,false, item.info) then
106 | TriggerClientEvent('QBCore:Notify', src, "You Sent "..item.label..' To '..Target)
107 | TriggerClientEvent('inventory:client:ItemBox',src, QBCore.Shared.Items[item.name], "remove")
108 | TriggerClientEvent('QBCore:Notify', name, "You Received "..item.label..' From '..YourName)
109 | TriggerClientEvent('inventory:client:ItemBox',name, QBCore.Shared.Items[item.name], "add")
110 | end
111 | end
112 | end)
113 | --[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
114 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
115 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
116 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
117 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
118 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
119 | RegisterServerEvent("inventory:server:OpenInventory")
120 | AddEventHandler('inventory:server:OpenInventory', function(name, id, other)
121 | local src = source
122 | local Player = QBCore.Functions.GetPlayer(src)
123 | local PlayerAmmo = {}
124 | QBCore.Functions.ExecuteSql(false, "SELECT * FROM `playerammo` WHERE `citizenid` = '"..Player.PlayerData.citizenid.."'", function(ammo)
125 | if ammo[1] ~= nil then
126 | PlayerAmmo = json.decode(ammo[1].ammo)
127 | end
128 |
129 | if name ~= nil and id ~= nil then
130 | local secondInv = {}
131 | if name == "stash" then
132 | if Stashes[id] ~= nil then
133 | if Stashes[id].isOpen then
134 | local Target = QBCore.Functions.GetPlayer(Stashes[id].isOpen)
135 | if Target ~= nil then
136 | TriggerClientEvent('inventory:client:CheckOpenState', Stashes[id].isOpen, name, id, Stashes[id].label)
137 | else
138 | Stashes[id].isOpen = false
139 | end
140 | end
141 | end
142 | local maxweight = 1000000
143 | local slots = 50
144 | if other ~= nil then
145 | maxweight = other.maxweight ~= nil and other.maxweight or 1000000
146 | slots = other.slots ~= nil and other.slots or 50
147 | end
148 | secondInv.name = "stash-"..id
149 | secondInv.label = "Stash-"..id
150 | secondInv.maxweight = maxweight
151 | secondInv.inventory = {}
152 | secondInv.slots = slots
153 | if Stashes[id] ~= nil and Stashes[id].isOpen then
154 | secondInv.name = "none-inv"
155 | secondInv.label = "Stash-None"
156 | secondInv.maxweight = 1000000
157 | secondInv.inventory = {}
158 | secondInv.slots = 0
159 | else
160 | local stashItems = GetStashItems(id)
161 | if next(stashItems) ~= nil then
162 | secondInv.inventory = stashItems
163 | Stashes[id] = {}
164 | Stashes[id].items = stashItems
165 | Stashes[id].isOpen = src
166 | Stashes[id].label = secondInv.label
167 | else
168 | Stashes[id] = {}
169 | Stashes[id].items = {}
170 | Stashes[id].isOpen = src
171 | Stashes[id].label = secondInv.label
172 | end
173 | end
174 | elseif name == "trunk" then
175 | if Trunks[id] ~= nil then
176 | if Trunks[id].isOpen then
177 | local Target = QBCore.Functions.GetPlayer(Trunks[id].isOpen)
178 | if Target ~= nil then
179 | TriggerClientEvent('inventory:client:CheckOpenState', Trunks[id].isOpen, name, id, Trunks[id].label)
180 | else
181 | Trunks[id].isOpen = false
182 | end
183 | end
184 | end
185 | secondInv.name = "trunk-"..id
186 | secondInv.label = "Trunk-"..id
187 | secondInv.maxweight = other.maxweight ~= nil and other.maxweight or 60000
188 | secondInv.inventory = {}
189 | secondInv.slots = other.slots ~= nil and other.slots or 50
190 | if (Trunks[id] ~= nil and Trunks[id].isOpen) or (QBCore.Shared.SplitStr(id, "PLZI")[2] ~= nil and Player.PlayerData.job.name ~= "police") then
191 | secondInv.name = "none-inv"
192 | secondInv.label = "Trunk-None"
193 | secondInv.maxweight = other.maxweight ~= nil and other.maxweight or 60000
194 | secondInv.inventory = {}
195 | secondInv.slots = 0
196 | else
197 | if id ~= nil then
198 | local ownedItems = GetOwnedVehicleItems(id)
199 | if IsVehicleOwned(id) and next(ownedItems) ~= nil then
200 | secondInv.inventory = ownedItems
201 | Trunks[id] = {}
202 | Trunks[id].items = ownedItems
203 | Trunks[id].isOpen = src
204 | Trunks[id].label = secondInv.label
205 | elseif Trunks[id] ~= nil and not Trunks[id].isOpen then
206 | secondInv.inventory = Trunks[id].items
207 | Trunks[id].isOpen = src
208 | Trunks[id].label = secondInv.label
209 | else
210 | Trunks[id] = {}
211 | Trunks[id].items = {}
212 | Trunks[id].isOpen = src
213 | Trunks[id].label = secondInv.label
214 | end
215 | end
216 | end
217 | elseif name == "glovebox" then
218 | if Gloveboxes[id] ~= nil then
219 | if Gloveboxes[id].isOpen then
220 | local Target = QBCore.Functions.GetPlayer(Gloveboxes[id].isOpen)
221 | if Target ~= nil then
222 | TriggerClientEvent('inventory:client:CheckOpenState', Gloveboxes[id].isOpen, name, id, Gloveboxes[id].label)
223 | else
224 | Gloveboxes[id].isOpen = false
225 | end
226 | end
227 | end
228 | secondInv.name = "glovebox-"..id
229 | secondInv.label = "Glovebox-"..id
230 | secondInv.maxweight = 10000
231 | secondInv.inventory = {}
232 | secondInv.slots = 5
233 | if Gloveboxes[id] ~= nil and Gloveboxes[id].isOpen then
234 | secondInv.name = "none-inv"
235 | secondInv.label = "Glovebox-None"
236 | secondInv.maxweight = 10000
237 | secondInv.inventory = {}
238 | secondInv.slots = 0
239 | else
240 | local ownedItems = GetOwnedVehicleGloveboxItems(id)
241 | if Gloveboxes[id] ~= nil and not Gloveboxes[id].isOpen then
242 | secondInv.inventory = Gloveboxes[id].items
243 | Gloveboxes[id].isOpen = src
244 | Gloveboxes[id].label = secondInv.label
245 | elseif IsVehicleOwned(id) and next(ownedItems) ~= nil then
246 | secondInv.inventory = ownedItems
247 | Gloveboxes[id] = {}
248 | Gloveboxes[id].items = ownedItems
249 | Gloveboxes[id].isOpen = src
250 | Gloveboxes[id].label = secondInv.label
251 | else
252 | Gloveboxes[id] = {}
253 | Gloveboxes[id].items = {}
254 | Gloveboxes[id].isOpen = src
255 | Gloveboxes[id].label = secondInv.label
256 | end
257 | end
258 | elseif name == "shop" then
259 | secondInv.name = "itemshop-"..id
260 | secondInv.label = other.label
261 | secondInv.maxweight = 900000
262 | secondInv.inventory = SetupShopItems(id, other.items)
263 | ShopItems[id] = {}
264 | ShopItems[id].items = other.items
265 | secondInv.slots = #other.items
266 | elseif name == "traphouse" then
267 | secondInv.name = "traphouse-"..id
268 | secondInv.label = other.label
269 | secondInv.maxweight = 900000
270 | secondInv.inventory = other.items
271 | secondInv.slots = other.slots
272 | elseif name == "crafting" then
273 | secondInv.name = "crafting"
274 | secondInv.label = other.label
275 | secondInv.maxweight = 900000
276 | secondInv.inventory = other.items
277 | secondInv.slots = #other.items
278 | elseif name == "attachment_crafting" then
279 | secondInv.name = "attachment_crafting"
280 | secondInv.label = other.label
281 | secondInv.maxweight = 900000
282 | secondInv.inventory = other.items
283 | secondInv.slots = #other.items
284 | elseif name == "otherplayer" then
285 | local OtherPlayer = QBCore.Functions.GetPlayer(tonumber(id))
286 | if OtherPlayer ~= nil then
287 | secondInv.name = "otherplayer-"..id
288 | secondInv.label = "Player-"..id
289 | secondInv.maxweight = QBCore.Config.Player.MaxWeight
290 | secondInv.inventory = OtherPlayer.PlayerData.items
291 | if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then
292 | secondInv.slots = QBCore.Config.Player.MaxInvSlots
293 | else
294 | secondInv.slots = QBCore.Config.Player.MaxInvSlots - 1
295 | end
296 | Citizen.Wait(250)
297 | end
298 | else
299 | if Drops[id] ~= nil and not Drops[id].isOpen then
300 | secondInv.name = id
301 | secondInv.label = "Dropped-"..tostring(id)
302 | secondInv.maxweight = 100000
303 | secondInv.inventory = Drops[id].items
304 | secondInv.slots = 30
305 | Drops[id].isOpen = src
306 | Drops[id].label = secondInv.label
307 | else
308 | secondInv.name = "none-inv"
309 | secondInv.label = "Dropped-None"
310 | secondInv.maxweight = 100000
311 | secondInv.inventory = {}
312 | secondInv.slots = 0
313 | --Drops[id].label = secondInv.label
314 | end
315 | end
316 | TriggerClientEvent("inventory:client:OpenInventory", src, PlayerAmmo, Player.PlayerData.items, secondInv)
317 | else
318 | TriggerClientEvent("inventory:client:OpenInventory", src, PlayerAmmo, Player.PlayerData.items)
319 | end
320 | end)
321 | end)
322 |
323 | RegisterServerEvent("inventory:server:SaveInventory")
324 | AddEventHandler('inventory:server:SaveInventory', function(type, id)
325 | if type == "trunk" then
326 | if (IsVehicleOwned(id)) then
327 | SaveOwnedVehicleItems(id, Trunks[id].items)
328 | else
329 | Trunks[id].isOpen = false
330 | end
331 | elseif type == "glovebox" then
332 | if (IsVehicleOwned(id)) then
333 | SaveOwnedGloveboxItems(id, Gloveboxes[id].items)
334 | else
335 | Gloveboxes[id].isOpen = false
336 | end
337 | elseif type == "stash" then
338 | SaveStashItems(id, Stashes[id].items)
339 | elseif type == "drop" then
340 | if Drops[id] ~= nil then
341 | Drops[id].isOpen = false
342 | if Drops[id].items == nil or next(Drops[id].items) == nil then
343 | Drops[id] = nil
344 | TriggerClientEvent("inventory:client:RemoveDropItem", -1, id)
345 | end
346 | end
347 | end
348 | end)
349 |
350 | RegisterServerEvent("inventory:server:UseItemSlot")
351 | AddEventHandler('inventory:server:UseItemSlot', function(slot)
352 | local src = source
353 | local Player = QBCore.Functions.GetPlayer(src)
354 | local itemData = Player.Functions.GetItemBySlot(slot)
355 |
356 | if itemData ~= nil then
357 | local itemInfo = QBCore.Shared.Items[itemData.name]
358 | if itemData.type == "weapon" then
359 | if itemData.info.quality ~= nil then
360 | if itemData.info.quality > 0 then
361 | TriggerClientEvent("inventory:client:UseWeapon", src, itemData, true)
362 | else
363 | TriggerClientEvent("inventory:client:UseWeapon", src, itemData, false)
364 | end
365 | else
366 | TriggerClientEvent("inventory:client:UseWeapon", src, itemData, true)
367 | end
368 | TriggerClientEvent('inventory:client:ItemBox', src, itemInfo, "use")
369 | elseif itemData.useable then
370 | TriggerClientEvent("QBCore:Client:UseItem", src, itemData)
371 | TriggerClientEvent('inventory:client:ItemBox', src, itemInfo, "use")
372 | end
373 | end
374 | end)
375 |
376 | RegisterServerEvent("inventory:server:UseItem")
377 | AddEventHandler('inventory:server:UseItem', function(inventory, item)
378 | local src = source
379 | local Player = QBCore.Functions.GetPlayer(src)
380 | if inventory == "player" or inventory == "hotbar" then
381 | local itemData = Player.Functions.GetItemBySlot(item.slot)
382 | if itemData ~= nil then
383 | TriggerClientEvent("QBCore:Client:UseItem", src, itemData)
384 | end
385 | end
386 | end)
387 |
388 | RegisterServerEvent("inventory:server:SetInventoryData")
389 | AddEventHandler('inventory:server:SetInventoryData', function(fromInventory, toInventory, fromSlot, toSlot, fromAmount, toAmount)
390 | local src = source
391 | local Player = QBCore.Functions.GetPlayer(src)
392 | local fromSlot = tonumber(fromSlot)
393 | local toSlot = tonumber(toSlot)
394 |
395 | if (fromInventory == "player" or fromInventory == "hotbar") and (QBCore.Shared.SplitStr(toInventory, "-")[1] == "itemshop" or toInventory == "crafting") then
396 | return
397 | end
398 |
399 | if fromInventory == "player" or fromInventory == "hotbar" then
400 | local fromItemData = Player.Functions.GetItemBySlot(fromSlot)
401 | local fromAmount = tonumber(fromAmount) ~= nil and tonumber(fromAmount) or fromItemData.amount
402 | if fromItemData ~= nil and fromItemData.amount >= fromAmount then
403 | if toInventory == "player" or toInventory == "hotbar" then
404 | local toItemData = Player.Functions.GetItemBySlot(toSlot)
405 | Player.Functions.RemoveItem(fromItemData.name, fromAmount, fromSlot)
406 | TriggerClientEvent("inventory:client:CheckWeapon", src, fromItemData.name)
407 | --Player.PlayerData.items[toSlot] = fromItemData
408 | if toItemData ~= nil then
409 | --Player.PlayerData.items[fromSlot] = toItemData
410 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
411 | if toItemData.name ~= fromItemData.name then
412 | Player.Functions.RemoveItem(toItemData.name, toAmount, toSlot)
413 | Player.Functions.AddItem(toItemData.name, toAmount, fromSlot, toItemData.info)
414 | end
415 | else
416 | --Player.PlayerData.items[fromSlot] = nil
417 | end
418 | Player.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
419 | elseif QBCore.Shared.SplitStr(toInventory, "-")[1] == "otherplayer" then
420 | local playerId = tonumber(QBCore.Shared.SplitStr(toInventory, "-")[2])
421 | local OtherPlayer = QBCore.Functions.GetPlayer(playerId)
422 | local toItemData = OtherPlayer.PlayerData.items[toSlot]
423 | Player.Functions.RemoveItem(fromItemData.name, fromAmount, fromSlot)
424 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
425 | TriggerClientEvent("inventory:client:CheckWeapon", src, fromItemData.name)
426 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="citizen2", name=itemInfo["name"], amount=fromAmount, target=OtherPlayer.PlayerData.citizenid})
427 | TriggerEvent("qb-log:server:CreateLog", "robbing", "Dropped Item", "red", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | *"..src.."*) dropped new item; name: **"..itemInfo["name"].."**, amount: **" .. fromAmount .. "** to player: **".. GetPlayerName(OtherPlayer.PlayerData.source) .. "** (citizenid: *"..OtherPlayer.PlayerData.citizenid.."* | id: *"..OtherPlayer.PlayerData.source.."*)")
428 | OtherPlayer.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
429 | elseif QBCore.Shared.SplitStr(toInventory, "-")[1] == "trunk" then
430 | local plate = QBCore.Shared.SplitStr(toInventory, "-")[2]
431 | local toItemData = Trunks[plate].items[toSlot]
432 | Player.Functions.RemoveItem(fromItemData.name, fromAmount, fromSlot)
433 | TriggerClientEvent("inventory:client:CheckWeapon", src, fromItemData.name)
434 | --Player.PlayerData.items[toSlot] = fromItemData
435 | if toItemData ~= nil then
436 | --Player.PlayerData.items[fromSlot] = toItemData
437 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
438 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
439 | if toItemData.name ~= fromItemData.name then
440 | RemoveFromTrunk(plate, fromSlot, itemInfo["name"], toAmount)
441 | Player.Functions.AddItem(toItemData.name, toAmount, fromSlot, toItemData.info)
442 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="trunk1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=plate})
443 | TriggerEvent("qb-log:server:CreateLog", "trunk", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** with name: **" .. fromItemData.name .. "**, amount: **" .. fromAmount .. "** - plate: *" .. plate .. "*")
444 | end
445 | else
446 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
447 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="trunk2", name=fromItemData.name, amount=fromAmount, target=plate})
448 | TriggerEvent("qb-log:server:CreateLog", "trunk", "Dropped Item", "red", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) dropped new item; name: **"..itemInfo["name"].."**, amount: **" .. fromAmount .. "** - plate: *" .. plate .. "*")
449 | end
450 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
451 | AddToTrunk(plate, toSlot, fromSlot, itemInfo["name"], fromAmount, fromItemData.info)
452 | elseif QBCore.Shared.SplitStr(toInventory, "-")[1] == "glovebox" then
453 | local plate = QBCore.Shared.SplitStr(toInventory, "-")[2]
454 | local toItemData = Gloveboxes[plate].items[toSlot]
455 | Player.Functions.RemoveItem(fromItemData.name, fromAmount, fromSlot)
456 | TriggerClientEvent("inventory:client:CheckWeapon", src, fromItemData.name)
457 | --Player.PlayerData.items[toSlot] = fromItemData
458 | if toItemData ~= nil then
459 | --Player.PlayerData.items[fromSlot] = toItemData
460 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
461 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
462 | if toItemData.name ~= fromItemData.name then
463 | RemoveFromGlovebox(plate, fromSlot, itemInfo["name"], toAmount)
464 | Player.Functions.AddItem(toItemData.name, toAmount, fromSlot, toItemData.info)
465 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="glovebox1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=plate})
466 | TriggerEvent("qb-log:server:CreateLog", "glovebox", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** with name: **" .. fromItemData.name .. "**, amount: **" .. fromAmount .. "** - plate: *" .. plate .. "*")
467 | end
468 | else
469 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
470 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="glovebox2", name=fromItemData.name, amount=fromAmount, target=plate})
471 | TriggerEvent("qb-log:server:CreateLog", "glovebox", "Dropped Item", "red", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) dropped new item; name: **"..itemInfo["name"].."**, amount: **" .. fromAmount .. "** - plate: *" .. plate .. "*")
472 | end
473 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
474 | AddToGlovebox(plate, toSlot, fromSlot, itemInfo["name"], fromAmount, fromItemData.info)
475 | elseif QBCore.Shared.SplitStr(toInventory, "-")[1] == "stash" then
476 | local stashId = QBCore.Shared.SplitStr(toInventory, "-")[2]
477 | local toItemData = Stashes[stashId].items[toSlot]
478 | Player.Functions.RemoveItem(fromItemData.name, fromAmount, fromSlot)
479 | TriggerClientEvent("inventory:client:CheckWeapon", src, fromItemData.name)
480 | --Player.PlayerData.items[toSlot] = fromItemData
481 | if toItemData ~= nil then
482 | --Player.PlayerData.items[fromSlot] = toItemData
483 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
484 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
485 | if toItemData.name ~= fromItemData.name then
486 | RemoveFromStash(stashId, fromSlot, itemInfo["name"], toAmount)
487 | Player.Functions.AddItem(toItemData.name, toAmount, fromSlot, toItemData.info)
488 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="stash1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=stashId})
489 | TriggerEvent("qb-log:server:CreateLog", "stash", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** with name: **" .. fromItemData.name .. "**, amount: **" .. fromAmount .. "** - stash: *" .. stashId .. "*")
490 | end
491 | else
492 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
493 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="stash2", name=fromItemData.name, amount=fromAmount, target=stashId})
494 | TriggerEvent("qb-log:server:CreateLog", "stash", "Dropped Item", "red", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) dropped new item; name: **"..itemInfo["name"].."**, amount: **" .. fromAmount .. "** - stash: *" .. stashId .. "*")
495 | end
496 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
497 | AddToStash(stashId, toSlot, fromSlot, itemInfo["name"], fromAmount, fromItemData.info)
498 | elseif QBCore.Shared.SplitStr(toInventory, "-")[1] == "traphouse" then
499 | -- Traphouse
500 | local traphouseId = QBCore.Shared.SplitStr(toInventory, "-")[2]
501 | local toItemData = exports['qb-traphouses']:GetInventoryData(traphouseId, toSlot)
502 | local IsItemValid = exports['qb-traphouses']:CanItemBeSaled(fromItemData.name:lower())
503 | if IsItemValid then
504 | Player.Functions.RemoveItem(fromItemData.name, fromAmount, fromSlot)
505 | TriggerClientEvent("inventory:client:CheckWeapon", src, fromItemData.name)
506 | if toItemData ~= nil then
507 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
508 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
509 | if toItemData.name ~= fromItemData.name then
510 | exports['qb-traphouses']:RemoveHouseItem(traphouseId, fromSlot, itemInfo["name"], toAmount)
511 | Player.Functions.AddItem(toItemData.name, toAmount, fromSlot, toItemData.info)
512 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="traphouse1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=traphouseId})
513 | TriggerEvent("qb-log:server:CreateLog", "traphouse", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** with name: **" .. fromItemData.name .. "**, amount: **" .. fromAmount .. "** - traphouse: *" .. traphouseId .. "*")
514 | end
515 | else
516 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
517 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="traphouse2", name=fromItemData.name, amount=fromAmount, target=traphouseId})
518 | TriggerEvent("qb-log:server:CreateLog", "traphouse", "Dropped Item", "red", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) dropped new item; name: **"..itemInfo["name"].."**, amount: **" .. fromAmount .. "** - traphouse: *" .. traphouseId .. "*")
519 | end
520 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
521 | exports['qb-traphouses']:AddHouseItem(traphouseId, toSlot, itemInfo["name"], fromAmount, fromItemData.info, src)
522 | else
523 | TriggerClientEvent('QBCore:Notify', src, "You can\'t sell this item..", 'error')
524 | end
525 | else
526 | -- drop
527 | toInventory = tonumber(toInventory)
528 | if toInventory == nil or toInventory == 0 then
529 | CreateNewDrop(src, fromSlot, toSlot, fromAmount)
530 | else
531 | local toItemData = Drops[toInventory].items[toSlot]
532 | Player.Functions.RemoveItem(fromItemData.name, fromAmount, fromSlot)
533 | TriggerClientEvent("inventory:client:CheckWeapon", src, fromItemData.name)
534 | if toItemData ~= nil then
535 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
536 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
537 | if toItemData.name ~= fromItemData.name then
538 | Player.Functions.AddItem(toItemData.name, toAmount, fromSlot, toItemData.info)
539 | RemoveFromDrop(toInventory, fromSlot, itemInfo["name"], toAmount)
540 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="drop1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=toInventory})
541 | TriggerEvent("qb-log:server:CreateLog", "drop", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** with name: **" .. fromItemData.name .. "**, amount: **" .. fromAmount .. "** - dropid: *" .. toInventory .. "*")
542 | end
543 | else
544 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
545 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="drop2", name=fromItemData.name, amount=fromAmount, target=toInventory})
546 | TriggerEvent("qb-log:server:CreateLog", "drop", "Dropped Item", "red", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) dropped new item; name: **"..itemInfo["name"].."**, amount: **" .. fromAmount .. "** - dropid: *" .. toInventory .. "*")
547 | end
548 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
549 | AddToDrop(toInventory, toSlot, itemInfo["name"], fromAmount, fromItemData.info)
550 | if itemInfo["name"] == "radio" then
551 | TriggerClientEvent('qb-radio:onRadioDrop', src)
552 | end
553 | end
554 | end
555 | else
556 | TriggerClientEvent("QBCore:Notify", src, "You doesn\'t have this item!", "error")
557 | end
558 | elseif QBCore.Shared.SplitStr(fromInventory, "-")[1] == "otherplayer" then
559 | local playerId = tonumber(QBCore.Shared.SplitStr(fromInventory, "-")[2])
560 | local OtherPlayer = QBCore.Functions.GetPlayer(playerId)
561 | local fromItemData = OtherPlayer.PlayerData.items[fromSlot]
562 | local fromAmount = tonumber(fromAmount) ~= nil and tonumber(fromAmount) or fromItemData.amount
563 | if fromItemData ~= nil and fromItemData.amount >= fromAmount then
564 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
565 | if toInventory == "player" or toInventory == "hotbar" then
566 | local toItemData = Player.Functions.GetItemBySlot(toSlot)
567 | OtherPlayer.Functions.RemoveItem(itemInfo["name"], fromAmount, fromSlot)
568 | TriggerClientEvent("inventory:client:CheckWeapon", OtherPlayer.PlayerData.source, fromItemData.name)
569 | if toItemData ~= nil then
570 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
571 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
572 | if toItemData.name ~= fromItemData.name then
573 | Player.Functions.RemoveItem(toItemData.name, toAmount, toSlot)
574 | OtherPlayer.Functions.AddItem(itemInfo["name"], toAmount, fromSlot, toItemData.info)
575 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2citizen1", toName=itemInfo["name"], toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=OtherPlayer.PlayerData.citizenid})
576 | TriggerEvent("qb-log:server:CreateLog", "robbing", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** with item; **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** from player: **".. GetPlayerName(OtherPlayer.PlayerData.source) .. "** (citizenid: *"..OtherPlayer.PlayerData.citizenid.."* | *"..OtherPlayer.PlayerData.source.."*)")
577 | end
578 | else
579 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2citizen2", name=fromItemData.name, amount=fromAmount, target=OtherPlayer.PlayerData.citizenid})
580 | TriggerEvent("qb-log:server:CreateLog", "robbing", "Retrieved Item", "green", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) took item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount .. "** from player: **".. GetPlayerName(OtherPlayer.PlayerData.source) .. "** (citizenid: *"..OtherPlayer.PlayerData.citizenid.."* | *"..OtherPlayer.PlayerData.source.."*)")
581 | end
582 | Player.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
583 | else
584 | local toItemData = OtherPlayer.PlayerData.items[toSlot]
585 | OtherPlayer.Functions.RemoveItem(itemInfo["name"], fromAmount, fromSlot)
586 | --Player.PlayerData.items[toSlot] = fromItemData
587 | if toItemData ~= nil then
588 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
589 | --Player.PlayerData.items[fromSlot] = toItemData
590 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
591 | if toItemData.name ~= fromItemData.name then
592 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
593 | OtherPlayer.Functions.RemoveItem(itemInfo["name"], toAmount, toSlot)
594 | OtherPlayer.Functions.AddItem(itemInfo["name"], toAmount, fromSlot, toItemData.info)
595 | end
596 | else
597 | --Player.PlayerData.items[fromSlot] = nil
598 | end
599 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
600 | OtherPlayer.Functions.AddItem(itemInfo["name"], fromAmount, toSlot, fromItemData.info)
601 | end
602 | else
603 | TriggerClientEvent("QBCore:Notify", src, "Item doesn\'t exist??", "error")
604 | end
605 | elseif QBCore.Shared.SplitStr(fromInventory, "-")[1] == "trunk" then
606 | local plate = QBCore.Shared.SplitStr(fromInventory, "-")[2]
607 | local fromItemData = Trunks[plate].items[fromSlot]
608 | local fromAmount = tonumber(fromAmount) ~= nil and tonumber(fromAmount) or fromItemData.amount
609 | if fromItemData ~= nil and fromItemData.amount >= fromAmount then
610 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
611 | if toInventory == "player" or toInventory == "hotbar" then
612 | local toItemData = Player.Functions.GetItemBySlot(toSlot)
613 | RemoveFromTrunk(plate, fromSlot, itemInfo["name"], fromAmount)
614 | if toItemData ~= nil then
615 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
616 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
617 | if toItemData.name ~= fromItemData.name then
618 | Player.Functions.RemoveItem(toItemData.name, toAmount, toSlot)
619 | AddToTrunk(plate, fromSlot, toSlot, itemInfo["name"], toAmount, toItemData.info)
620 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2trunk1", toName=itemInfo["name"], toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=plate})
621 | TriggerEvent("qb-log:server:CreateLog", "trunk", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** with item; name: **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** plate: *" .. plate .. "*")
622 | else
623 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2trunk3", name=toItemData.name, amount=toAmount, target=plate})
624 | TriggerEvent("qb-log:server:CreateLog", "trunk", "Stacked Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) stacked item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** from plate: *" .. plate .. "*")
625 | end
626 | else
627 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2trunk2", name=fromItemData.name, amount=fromAmount, target=plate})
628 | TriggerEvent("qb-log:server:CreateLog", "trunk", "Received Item", "green", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) reveived item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount.. "** plate: *" .. plate .. "*")
629 | end
630 | SaveOwnedVehicleItems(plate,Trunks[plate].items)
631 | Player.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
632 | else
633 | local toItemData = Trunks[plate].items[toSlot]
634 | RemoveFromTrunk(plate, fromSlot, itemInfo["name"], fromAmount)
635 | --Player.PlayerData.items[toSlot] = fromItemData
636 | if toItemData ~= nil then
637 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
638 | --Player.PlayerData.items[fromSlot] = toItemData
639 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
640 | if toItemData.name ~= fromItemData.name then
641 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
642 | RemoveFromTrunk(plate, toSlot, itemInfo["name"], toAmount)
643 | AddToTrunk(plate, fromSlot, toSlot, itemInfo["name"], toAmount, toItemData.info)
644 | end
645 | else
646 | --Player.PlayerData.items[fromSlot] = nil
647 | end
648 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
649 | AddToTrunk(plate, toSlot, fromSlot, itemInfo["name"], fromAmount, fromItemData.info)
650 | end
651 | else
652 | TriggerClientEvent("QBCore:Notify", src, "Item doesn\'t exist??", "error")
653 | end
654 | elseif QBCore.Shared.SplitStr(fromInventory, "-")[1] == "glovebox" then
655 | local plate = QBCore.Shared.SplitStr(fromInventory, "-")[2]
656 | local fromItemData = Gloveboxes[plate].items[fromSlot]
657 | local fromAmount = tonumber(fromAmount) ~= nil and tonumber(fromAmount) or fromItemData.amount
658 | if fromItemData ~= nil and fromItemData.amount >= fromAmount then
659 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
660 | if toInventory == "player" or toInventory == "hotbar" then
661 | local toItemData = Player.Functions.GetItemBySlot(toSlot)
662 | RemoveFromGlovebox(plate, fromSlot, itemInfo["name"], fromAmount)
663 | if toItemData ~= nil then
664 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
665 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
666 | if toItemData.name ~= fromItemData.name then
667 | Player.Functions.RemoveItem(toItemData.name, toAmount, toSlot)
668 | AddToGlovebox(plate, fromSlot, toSlot, itemInfo["name"], toAmount, toItemData.info)
669 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2glovebox1", toName=itemInfo["name"], toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=plate})
670 | TriggerEvent("qb-log:server:CreateLog", "glovebox", "Swapped", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src..")* swapped item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** with item; name: **"..itemInfo["name"].."**, amount: **" .. toAmount .. "** plate: *" .. plate .. "*")
671 | else
672 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2glovebox3", name=toItemData.name, amount=toAmount, target=plate})
673 | TriggerEvent("qb-log:server:CreateLog", "glovebox", "Stacked Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) stacked item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** from plate: *" .. plate .. "*")
674 | end
675 | else
676 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2glovebox2", name=fromItemData.name, amount=fromAmount, target=plate})
677 | TriggerEvent("qb-log:server:CreateLog", "glovebox", "Received Item", "green", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) reveived item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount.. "** plate: *" .. plate .. "*")
678 | end
679 | SaveOwnedGloveboxItems(plate,Gloveboxes[plate].items)
680 | Player.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
681 | else
682 | local toItemData = Gloveboxes[plate].items[toSlot]
683 | RemoveFromGlovebox(plate, fromSlot, itemInfo["name"], fromAmount)
684 | --Player.PlayerData.items[toSlot] = fromItemData
685 | if toItemData ~= nil then
686 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
687 | --Player.PlayerData.items[fromSlot] = toItemData
688 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
689 | if toItemData.name ~= fromItemData.name then
690 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
691 | RemoveFromGlovebox(plate, toSlot, itemInfo["name"], toAmount)
692 | AddToGlovebox(plate, fromSlot, toSlot, itemInfo["name"], toAmount, toItemData.info)
693 | end
694 | else
695 | --Player.PlayerData.items[fromSlot] = nil
696 | end
697 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
698 | AddToGlovebox(plate, toSlot, fromSlot, itemInfo["name"], fromAmount, fromItemData.info)
699 | end
700 | else
701 | TriggerClientEvent("QBCore:Notify", src, "Item doesn\'t exist??", "error")
702 | end
703 | elseif QBCore.Shared.SplitStr(fromInventory, "-")[1] == "stash" then
704 | local stashId = QBCore.Shared.SplitStr(fromInventory, "-")[2]
705 | local fromItemData = Stashes[stashId].items[fromSlot]
706 | local fromAmount = tonumber(fromAmount) ~= nil and tonumber(fromAmount) or fromItemData.amount
707 | if fromItemData ~= nil and fromItemData.amount >= fromAmount then
708 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
709 | if toInventory == "player" or toInventory == "hotbar" then
710 | local toItemData = Player.Functions.GetItemBySlot(toSlot)
711 | RemoveFromStash(stashId, fromSlot, itemInfo["name"], fromAmount)
712 | if toItemData ~= nil then
713 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
714 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
715 | if toItemData.name ~= fromItemData.name then
716 | Player.Functions.RemoveItem(toItemData.name, toAmount, toSlot)
717 | AddToStash(stashId, fromSlot, toSlot, itemInfo["name"], toAmount, toItemData.info)
718 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2stash1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=stashId})
719 | TriggerEvent("qb-log:server:CreateLog", "stash", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** with item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount .. "** stash: *" .. stashId .. "*")
720 | else
721 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2stash3", name=toItemData.name, amount=toAmount, target=stashId})
722 | TriggerEvent("qb-log:server:CreateLog", "stash", "Stacked Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) stacked item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** from stash: *" .. stashId .. "*")
723 | end
724 | else
725 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2stash2", name=fromItemData.name, amount=fromAmount, target=stashId})
726 | TriggerEvent("qb-log:server:CreateLog", "stash", "Received Item", "green", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) reveived item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount.. "** stash: *" .. stashId .. "*")
727 | end
728 | SaveStashItems(stashId, Stashes[stashId].items)
729 | Player.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
730 | else
731 | local toItemData = Stashes[stashId].items[toSlot]
732 | RemoveFromStash(stashId, fromSlot, itemInfo["name"], fromAmount)
733 | --Player.PlayerData.items[toSlot] = fromItemData
734 | if toItemData ~= nil then--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
735 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
736 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
737 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
738 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
739 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]--[[MADE BY Ax is bro ther made by axis brother dream life roleplay ax is brother Axis#1672
740 | fuck Indian Empire RolePlay Fuk You All Halka gorib you too!]]
741 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
742 | --Player.PlayerData.items[fromSlot] = toItemData
743 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
744 | if toItemData.name ~= fromItemData.name then
745 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
746 | RemoveFromStash(stashId, toSlot, itemInfo["name"], toAmount)
747 | AddToStash(stashId, fromSlot, toSlot, itemInfo["name"], toAmount, toItemData.info)
748 | end
749 | else
750 | --Player.PlayerData.items[fromSlot] = nil
751 | end
752 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
753 | AddToStash(stashId, toSlot, fromSlot, itemInfo["name"], fromAmount, fromItemData.info)
754 | end
755 | else
756 | TriggerClientEvent("QBCore:Notify", src, "Item doesn\'t exist??", "error")
757 | end
758 | elseif QBCore.Shared.SplitStr(fromInventory, "-")[1] == "traphouse" then
759 | local traphouseId = QBCore.Shared.SplitStr(fromInventory, "-")[2]
760 | local fromItemData = exports['qb-traphouses']:GetInventoryData(traphouseId, fromSlot)
761 | local fromAmount = tonumber(fromAmount) ~= nil and tonumber(fromAmount) or fromItemData.amount
762 | if fromItemData ~= nil and fromItemData.amount >= fromAmount then
763 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
764 | if toInventory == "player" or toInventory == "hotbar" then
765 | local toItemData = Player.Functions.GetItemBySlot(toSlot)
766 | exports['qb-traphouses']:RemoveHouseItem(traphouseId, fromSlot, itemInfo["name"], fromAmount)
767 | if toItemData ~= nil then
768 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
769 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
770 | if toItemData.name ~= fromItemData.name then
771 | Player.Functions.RemoveItem(toItemData.name, toAmount, toSlot)
772 | exports['qb-traphouses']:AddHouseItem(traphouseId, fromSlot, itemInfo["name"], toAmount, toItemData.info, src)
773 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2stash1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=traphouseId})
774 | TriggerEvent("qb-log:server:CreateLog", "stash", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** with item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount .. "** stash: *" .. traphouseId .. "*")
775 | else
776 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2stash3", name=toItemData.name, amount=toAmount, target=traphouseId})
777 | TriggerEvent("qb-log:server:CreateLog", "stash", "Stacked Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) stacked item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** from stash: *" .. traphouseId .. "*")
778 | end
779 | else
780 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2stash2", name=fromItemData.name, amount=fromAmount, target=traphouseId})
781 | TriggerEvent("qb-log:server:CreateLog", "stash", "Received Item", "green", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) reveived item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount.. "** stash: *" .. traphouseId .. "*")
782 | end
783 | Player.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
784 | else
785 | local toItemData = exports['qb-traphouses']:GetInventoryData(traphouseId, toSlot)
786 | exports['qb-traphouses']:RemoveHouseItem(traphouseId, fromSlot, itemInfo["name"], fromAmount)
787 | if toItemData ~= nil then
788 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
789 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
790 | if toItemData.name ~= fromItemData.name then
791 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
792 | exports['qb-traphouses']:RemoveHouseItem(traphouseId, toSlot, itemInfo["name"], toAmount)
793 | exports['qb-traphouses']:AddHouseItem(traphouseId, fromSlot, itemInfo["name"], toAmount, toItemData.info, src)
794 | end
795 | end
796 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
797 | exports['qb-traphouses']:AddHouseItem(traphouseId, toSlot, itemInfo["name"], fromAmount, fromItemData.info, src)
798 | end
799 | else
800 | TriggerClientEvent("QBCore:Notify", src, "Item doesn't exist??", "error")
801 | end
802 | elseif QBCore.Shared.SplitStr(fromInventory, "-")[1] == "itemshop" then
803 | local shopType = QBCore.Shared.SplitStr(fromInventory, "-")[2]
804 | local itemData = ShopItems[shopType].items[fromSlot]
805 | local itemInfo = QBCore.Shared.Items[itemData.name:lower()]
806 | local bankBalance = Player.PlayerData.money["bank"]
807 | local price = tonumber((itemData.price*fromAmount))
808 |
809 | if QBCore.Shared.SplitStr(shopType, "_")[1] == "Dealer" then
810 | if QBCore.Shared.SplitStr(itemData.name, "_")[1] == "weapon" then
811 | price = tonumber(itemData.price)
812 | if Player.Functions.RemoveMoney("cash", price, "dealer-item-bought") then
813 | itemData.info.serie = tostring(Config.RandomInt(2) .. Config.RandomStr(3) .. Config.RandomInt(1) .. Config.RandomStr(2) .. Config.RandomInt(3) .. Config.RandomStr(4))
814 | Player.Functions.AddItem(itemData.name, 1, toSlot, itemData.info)
815 | TriggerClientEvent('qb-drugs:client:updateDealerItems', src, itemData, 1)
816 | TriggerClientEvent('QBCore:Notify', src, itemInfo["label"] .. " bought!", "success")
817 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemshop", {type="dealer", name=itemInfo["name"], amount=1, paymentType="cash", price=price})
818 | TriggerEvent("qb-log:server:CreateLog", "dealers", "Dealer item bought", "green", "**"..GetPlayerName(src) .. "** bought a " .. itemInfo["label"] .. " for $"..price)
819 | else
820 | TriggerClientEvent('QBCore:Notify', src, "You don\'t have enough cash..", "error")
821 | end
822 | else
823 | if Player.Functions.RemoveMoney("cash", price, "dealer-item-bought") then
824 | Player.Functions.AddItem(itemData.name, fromAmount, toSlot, itemData.info)
825 | TriggerClientEvent('qb-drugs:client:updateDealerItems', src, itemData, fromAmount)
826 | TriggerClientEvent('QBCore:Notify', src, itemInfo["label"] .. " ingekocht!", "success")
827 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemshop", {type="dealer", name=itemInfo["name"], amount=fromAmount, paymentType="cash", price=price})
828 | TriggerEvent("qb-log:server:CreateLog", "dealers", "Dealer item gekocht", "green", "**"..GetPlayerName(src) .. "** heeft een " .. itemInfo["label"] .. " bought for $"..price)
829 | else
830 | TriggerClientEvent('QBCore:Notify', src, "You don't have enough cash..", "error")
831 | end
832 | end
833 | elseif QBCore.Shared.SplitStr(shopType, "_")[1] == "Itemshop" then
834 | if Player.Functions.RemoveMoney("cash", price, "itemshop-bought-item") then
835 | Player.Functions.AddItem(itemData.name, fromAmount, toSlot, itemData.info)
836 | TriggerClientEvent('qb-shops:client:UpdateShop', src, QBCore.Shared.SplitStr(shopType, "_")[2], itemData, fromAmount)
837 | TriggerClientEvent('QBCore:Notify', src, itemInfo["label"] .. " bought!", "success")
838 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemshop", {type="itemshop", name=itemInfo["name"], amount=fromAmount, paymentType="cash", price=price})
839 | TriggerEvent("qb-log:server:CreateLog", "shops", "Shop item bought", "green", "**"..GetPlayerName(src) .. "** bought a " .. itemInfo["label"] .. " for $"..price)
840 | elseif bankBalance >= price then
841 | Player.Functions.RemoveMoney("bank", price, "itemshop-bought-item")
842 | Player.Functions.AddItem(itemData.name, fromAmount, toSlot, itemData.info)
843 | TriggerClientEvent('qb-shops:client:UpdateShop', src, QBCore.Shared.SplitStr(shopType, "_")[2], itemData, fromAmount)
844 | TriggerClientEvent('QBCore:Notify', src, itemInfo["label"] .. " bought!", "success")
845 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemshop", {type="itemshop", name=itemInfo["name"], amount=fromAmount, paymentType="bank", price=price})
846 | TriggerEvent("qb-log:server:CreateLog", "shops", "Shop item bought", "green", "**"..GetPlayerName(src) .. "** bought a " .. itemInfo["label"] .. " for $"..price)
847 | else
848 | TriggerClientEvent('QBCore:Notify', src, "You don't have enough cash..", "error")
849 | end
850 | else
851 | if Player.Functions.RemoveMoney("cash", price, "unkown-itemshop-bought-item") then
852 | Player.Functions.AddItem(itemData.name, fromAmount, toSlot, itemData.info)
853 | TriggerClientEvent('QBCore:Notify', src, itemInfo["label"] .. " bought!", "success")
854 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemshop", {type="other", name=itemInfo["name"], amount=fromAmount, paymentType="cash", price=price})
855 | TriggerEvent("qb-log:server:CreateLog", "shops", "Shop item bought", "green", "**"..GetPlayerName(src) .. "** bought a " .. itemInfo["label"] .. " for $"..price)
856 | elseif bankBalance >= price then
857 | Player.Functions.RemoveMoney("bank", price, "unkown-itemshop-bought-item")
858 | Player.Functions.AddItem(itemData.name, fromAmount, toSlot, itemData.info)
859 | TriggerClientEvent('QBCore:Notify', src, itemInfo["label"] .. " bought!", "success")
860 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemshop", {type="other", name=itemInfo["name"], amount=fromAmount, paymentType="bank", price=price})
861 | TriggerEvent("qb-log:server:CreateLog", "shops", "Shop item bought", "green", "**"..GetPlayerName(src) .. "** bought a " .. itemInfo["label"] .. " for $"..price)
862 | else
863 | TriggerClientEvent('QBCore:Notify', src, "You don\'t have enough cash..", "error")
864 | end
865 | end
866 | elseif fromInventory == "crafting" then
867 | local itemData = Config.CraftingItems[fromSlot]
868 | if hasCraftItems(src, itemData.costs, fromAmount) then
869 | TriggerClientEvent("inventory:client:CraftItems", src, itemData.name, itemData.costs, fromAmount, toSlot, itemData.points)
870 | else
871 | TriggerClientEvent("inventory:client:UpdatePlayerInventory", src, true)
872 | TriggerClientEvent('QBCore:Notify', src, "You don't have the right items..", "error")
873 | end
874 | elseif fromInventory == "attachment_crafting" then
875 | local itemData = Config.AttachmentCrafting["items"][fromSlot]
876 | if hasCraftItems(src, itemData.costs, fromAmount) then
877 | TriggerClientEvent("inventory:client:CraftAttachment", src, itemData.name, itemData.costs, fromAmount, toSlot, itemData.points)
878 | else
879 | TriggerClientEvent("inventory:client:UpdatePlayerInventory", src, true)
880 | TriggerClientEvent('QBCore:Notify', src, "You don't have the right items..", "error")
881 | end
882 | else
883 | -- drop
884 | fromInventory = tonumber(fromInventory)
885 | local fromItemData = Drops[fromInventory].items[fromSlot]
886 | local fromAmount = tonumber(fromAmount) ~= nil and tonumber(fromAmount) or fromItemData.amount
887 | if fromItemData ~= nil and fromItemData.amount >= fromAmount then
888 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
889 | if toInventory == "player" or toInventory == "hotbar" then
890 | local toItemData = Player.Functions.GetItemBySlot(toSlot)
891 | RemoveFromDrop(fromInventory, fromSlot, itemInfo["name"], fromAmount)
892 | if toItemData ~= nil then
893 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
894 | if toItemData.name ~= fromItemData.name then
895 | Player.Functions.RemoveItem(toItemData.name, toAmount, toSlot)
896 | AddToDrop(fromInventory, toSlot, itemInfo["name"], toAmount, toItemData.info)
897 | if itemInfo["name"] == "radio" then
898 | TriggerClientEvent('qb-radio:onRadioDrop', src)
899 | end
900 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2drop1", toName=toItemData.name, toAmount=toAmount, fromName=fromItemData.name, fromAmount=fromAmount, target=fromInventory})
901 | TriggerEvent("qb-log:server:CreateLog", "drop", "Swapped Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) swapped item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** with item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount .. "** - dropid: *" .. fromInventory .. "*")
902 | else
903 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2drop3", name=toItemData.name, amount=toAmount, target=fromInventory})
904 | TriggerEvent("qb-log:server:CreateLog", "drop", "Stacked Item", "orange", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) stacked item; name: **"..toItemData.name.."**, amount: **" .. toAmount .. "** - from dropid: *" .. fromInventory .. "*")
905 | end
906 | else
907 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="2drop2", name=fromItemData.name, amount=fromAmount, target=fromInventory})
908 | TriggerEvent("qb-log:server:CreateLog", "drop", "Received Item", "green", "**".. GetPlayerName(src) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..src.."*) reveived item; name: **"..fromItemData.name.."**, amount: **" .. fromAmount.. "** - dropid: *" .. fromInventory .. "*")
909 | end
910 | Player.Functions.AddItem(fromItemData.name, fromAmount, toSlot, fromItemData.info)
911 | else
912 | toInventory = tonumber(toInventory)
913 | local toItemData = Drops[toInventory].items[toSlot]
914 | RemoveFromDrop(fromInventory, fromSlot, itemInfo["name"], fromAmount)
915 | --Player.PlayerData.items[toSlot] = fromItemData
916 | if toItemData ~= nil then
917 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
918 | --Player.PlayerData.items[fromSlot] = toItemData
919 | local toAmount = tonumber(toAmount) ~= nil and tonumber(toAmount) or toItemData.amount
920 | if toItemData.name ~= fromItemData.name then
921 | local itemInfo = QBCore.Shared.Items[toItemData.name:lower()]
922 | RemoveFromDrop(toInventory, toSlot, itemInfo["name"], toAmount)
923 | AddToDrop(fromInventory, fromSlot, itemInfo["name"], toAmount, toItemData.info)
924 | if itemInfo["name"] == "radio" then
925 | TriggerClientEvent('qb-radio:onRadioDrop', src)
926 | end
927 | end
928 | else
929 | --Player.PlayerData.items[fromSlot] = nil
930 | end
931 | local itemInfo = QBCore.Shared.Items[fromItemData.name:lower()]
932 | AddToDrop(toInventory, toSlot, itemInfo["name"], fromAmount, fromItemData.info)
933 | if itemInfo["name"] == "radio" then
934 | TriggerClientEvent('qb-radio:onRadioDrop', src)
935 | end
936 | end
937 | else
938 | TriggerClientEvent("QBCore:Notify", src, "Item doesn't exist??", "error")
939 | end
940 | end
941 | end)
942 |
943 | function hasCraftItems(source, CostItems, amount)
944 | local Player = QBCore.Functions.GetPlayer(source)
945 | for k, v in pairs(CostItems) do
946 | if Player.Functions.GetItemByName(k) ~= nil then
947 | if Player.Functions.GetItemByName(k).amount < (v * amount) then
948 | return false
949 | end
950 | else
951 | return false
952 | end
953 | end
954 | return true
955 | end
956 |
957 | function IsVehicleOwned(plate)
958 | local val = false
959 | QBCore.Functions.ExecuteSql(true, "SELECT * FROM `player_vehicles` WHERE `plate` = '"..plate.."'", function(result)
960 | if (result[1] ~= nil) then
961 | val = true
962 | else
963 | val = false
964 | end
965 | end)
966 | return val
967 | end
968 |
969 | local function escape_str(s)
970 | local in_char = {'\\', '"', '/', '\b', '\f', '\n', '\r', '\t'}
971 | local out_char = {'\\', '"', '/', 'b', 'f', 'n', 'r', 't'}
972 | for i, c in ipairs(in_char) do
973 | s = s:gsub(c, '\\' .. out_char[i])
974 | end
975 | return s
976 | end
977 |
978 | -- Shop Items
979 | function SetupShopItems(shop, shopItems)
980 | local items = {}
981 | if shopItems ~= nil and next(shopItems) ~= nil then
982 | for k, item in pairs(shopItems) do
983 | local itemInfo = QBCore.Shared.Items[item.name:lower()]
984 | items[item.slot] = {
985 | name = itemInfo["name"],
986 | amount = tonumber(item.amount),
987 | info = item.info ~= nil and item.info or "",
988 | label = itemInfo["label"],
989 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
990 | weight = itemInfo["weight"],
991 | type = itemInfo["type"],
992 | unique = itemInfo["unique"],
993 | useable = itemInfo["useable"],
994 | price = item.price,
995 | image = itemInfo["image"],
996 | slot = item.slot,
997 | }
998 | end
999 | end
1000 | return items
1001 | end
1002 |
1003 | -- Stash Items
1004 | function GetStashItems(stashId)
1005 | local items = {}
1006 | QBCore.Functions.ExecuteSql(true, "SELECT * FROM `stashitems` WHERE `stash` = '"..stashId.."'", function(result)
1007 | if result[1] ~= nil then
1008 | for k, item in pairs(result) do
1009 | local itemInfo = QBCore.Shared.Items[item.name:lower()]
1010 | items[item.slot] = {
1011 | name = itemInfo["name"],
1012 | amount = tonumber(item.amount),
1013 | info = json.decode(item.info) ~= nil and json.decode(item.info) or "",
1014 | label = itemInfo["label"],
1015 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1016 | weight = itemInfo["weight"],
1017 | type = itemInfo["type"],
1018 | unique = itemInfo["unique"],
1019 | useable = itemInfo["useable"],
1020 | image = itemInfo["image"],
1021 | slot = item.slot,
1022 | }
1023 | end
1024 | QBCore.Functions.ExecuteSql(false, "DELETE FROM `stashitems` WHERE `stash` = '"..stashId.."'")
1025 | else
1026 | QBCore.Functions.ExecuteSql(true, "SELECT * FROM `stashitemsnew` WHERE `stash` = '"..stashId.."'", function(result)
1027 | if result[1] ~= nil then
1028 | if result[1].items ~= nil then
1029 | result[1].items = json.decode(result[1].items)
1030 | if result[1].items ~= nil then
1031 | for k, item in pairs(result[1].items) do
1032 | local itemInfo = QBCore.Shared.Items[item.name:lower()]
1033 | items[item.slot] = {
1034 | name = itemInfo["name"],
1035 | amount = tonumber(item.amount),
1036 | info = item.info ~= nil and item.info or "",
1037 | label = itemInfo["label"],
1038 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1039 | weight = itemInfo["weight"],
1040 | type = itemInfo["type"],
1041 | unique = itemInfo["unique"],
1042 | useable = itemInfo["useable"],
1043 | image = itemInfo["image"],
1044 | slot = item.slot,
1045 | }
1046 | end
1047 | end
1048 | end
1049 | end
1050 | end)
1051 | end
1052 | end)
1053 | return items
1054 | end
1055 |
1056 | QBCore.Functions.CreateCallback('qb-inventory:server:GetStashItems', function(source, cb, stashId)
1057 | cb(GetStashItems(stashId))
1058 | end)
1059 |
1060 | RegisterServerEvent('qb-inventory:server:SaveStashItems')
1061 | AddEventHandler('qb-inventory:server:SaveStashItems', function(stashId, items)
1062 | QBCore.Functions.ExecuteSql(false, "SELECT * FROM `stashitemsnew` WHERE `stash` = '"..stashId.."'", function(result)
1063 | if result[1] ~= nil then
1064 | QBCore.Functions.ExecuteSql(false, "UPDATE `stashitemsnew` SET `items` = '"..json.encode(items).."' WHERE `stash` = '"..stashId.."'")
1065 | else
1066 | QBCore.Functions.ExecuteSql(false, "INSERT INTO `stashitemsnew` (`stash`, `items`) VALUES ('"..stashId.."', '"..json.encode(items).."')")
1067 | end
1068 | end)
1069 | end)
1070 |
1071 | function SaveStashItems(stashId, items)
1072 | if Stashes[stashId].label ~= "Stash-None" then
1073 | if items ~= nil then
1074 | for slot, item in pairs(items) do
1075 | item.description = nil
1076 | end
1077 |
1078 | QBCore.Functions.ExecuteSql(false, "SELECT * FROM `stashitemsnew` WHERE `stash` = '"..stashId.."'", function(result)
1079 | if result[1] ~= nil then
1080 | QBCore.Functions.ExecuteSql(false, "UPDATE `stashitemsnew` SET `items` = '"..json.encode(items).."' WHERE `stash` = '"..stashId.."'")
1081 | Stashes[stashId].isOpen = false
1082 | else
1083 | QBCore.Functions.ExecuteSql(false, "INSERT INTO `stashitemsnew` (`stash`, `items`) VALUES ('"..stashId.."', '"..json.encode(items).."')")
1084 | Stashes[stashId].isOpen = false
1085 | end
1086 | end)
1087 | end
1088 | end
1089 | end
1090 |
1091 | function AddToStash(stashId, slot, otherslot, itemName, amount, info)
1092 | local amount = tonumber(amount)
1093 | local ItemData = QBCore.Shared.Items[itemName]
1094 | if not ItemData.unique then
1095 | if Stashes[stashId].items[slot] ~= nil and Stashes[stashId].items[slot].name == itemName then
1096 | Stashes[stashId].items[slot].amount = Stashes[stashId].items[slot].amount + amount
1097 | else
1098 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1099 | Stashes[stashId].items[slot] = {
1100 | name = itemInfo["name"],
1101 | amount = amount,
1102 | info = info ~= nil and info or "",
1103 | label = itemInfo["label"],
1104 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1105 | weight = itemInfo["weight"],
1106 | type = itemInfo["type"],
1107 | unique = itemInfo["unique"],
1108 | useable = itemInfo["useable"],
1109 | image = itemInfo["image"],
1110 | slot = slot,
1111 | }
1112 | end
1113 | else
1114 | if Stashes[stashId].items[slot] ~= nil and Stashes[stashId].items[slot].name == itemName then
1115 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1116 | Stashes[stashId].items[otherslot] = {
1117 | name = itemInfo["name"],
1118 | amount = amount,
1119 | info = info ~= nil and info or "",
1120 | label = itemInfo["label"],
1121 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1122 | weight = itemInfo["weight"],
1123 | type = itemInfo["type"],
1124 | unique = itemInfo["unique"],
1125 | useable = itemInfo["useable"],
1126 | image = itemInfo["image"],
1127 | slot = otherslot,
1128 | }
1129 | else
1130 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1131 | Stashes[stashId].items[slot] = {
1132 | name = itemInfo["name"],
1133 | amount = amount,
1134 | info = info ~= nil and info or "",
1135 | label = itemInfo["label"],
1136 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1137 | weight = itemInfo["weight"],
1138 | type = itemInfo["type"],
1139 | unique = itemInfo["unique"],
1140 | useable = itemInfo["useable"],
1141 | image = itemInfo["image"],
1142 | slot = slot,
1143 | }
1144 | end
1145 | end
1146 | end
1147 |
1148 | function RemoveFromStash(stashId, slot, itemName, amount)
1149 | local amount = tonumber(amount)
1150 | if Stashes[stashId].items[slot] ~= nil and Stashes[stashId].items[slot].name == itemName then
1151 | if Stashes[stashId].items[slot].amount > amount then
1152 | Stashes[stashId].items[slot].amount = Stashes[stashId].items[slot].amount - amount
1153 | else
1154 | Stashes[stashId].items[slot] = nil
1155 | if next(Stashes[stashId].items) == nil then
1156 | Stashes[stashId].items = {}
1157 | end
1158 | end
1159 | else
1160 | Stashes[stashId].items[slot] = nil
1161 | if Stashes[stashId].items == nil then
1162 | Stashes[stashId].items[slot] = nil
1163 | end
1164 | end
1165 | end
1166 |
1167 | -- Trunk items
1168 | function GetOwnedVehicleItems(plate)
1169 | local items = {}
1170 | QBCore.Functions.ExecuteSql(true, "SELECT * FROM `trunkitems` WHERE `plate` = '"..plate.."'", function(result)
1171 | if result[1] ~= nil then
1172 | for k, item in pairs(result) do
1173 | local itemInfo = QBCore.Shared.Items[item.name:lower()]
1174 | items[item.slot] = {
1175 | name = itemInfo["name"],
1176 | amount = tonumber(item.amount),
1177 | info = json.decode(item.info) ~= nil and json.decode(item.info) or "",
1178 | label = itemInfo["label"],
1179 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1180 | weight = itemInfo["weight"],
1181 | type = itemInfo["type"],
1182 | unique = itemInfo["unique"],
1183 | useable = itemInfo["useable"],
1184 | image = itemInfo["image"],
1185 | slot = item.slot,
1186 | }
1187 | end
1188 | QBCore.Functions.ExecuteSql(false, "DELETE FROM `trunkitems` WHERE `plate` = '"..plate.."'")
1189 | else
1190 | QBCore.Functions.ExecuteSql(true, "SELECT * FROM `trunkitemsnew` WHERE `plate` = '"..plate.."'", function(result)
1191 | if result[1] ~= nil then
1192 | if result[1].items ~= nil then
1193 | result[1].items = json.decode(result[1].items)
1194 | if result[1].items ~= nil then
1195 | for k, item in pairs(result[1].items) do
1196 | local itemInfo = QBCore.Shared.Items[item.name:lower()]
1197 | items[item.slot] = {
1198 | name = itemInfo["name"],
1199 | amount = tonumber(item.amount),
1200 | info = item.info ~= nil and item.info or "",
1201 | label = itemInfo["label"],
1202 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1203 | weight = itemInfo["weight"],
1204 | type = itemInfo["type"],
1205 | unique = itemInfo["unique"],
1206 | useable = itemInfo["useable"],
1207 | image = itemInfo["image"],
1208 | slot = item.slot,
1209 | }
1210 | end
1211 | end
1212 | end
1213 | end
1214 | end)
1215 | end
1216 | end)
1217 | return items
1218 | end
1219 |
1220 | function SaveOwnedVehicleItems(plate, items)
1221 | if Trunks[plate].label ~= "Trunk-None" then
1222 | if items ~= nil then
1223 | for slot, item in pairs(items) do
1224 | item.description = nil
1225 | end
1226 |
1227 | QBCore.Functions.ExecuteSql(false, "SELECT * FROM `trunkitemsnew` WHERE `plate` = '"..plate.."'", function(result)
1228 | if result[1] ~= nil then
1229 | QBCore.Functions.ExecuteSql(false, "UPDATE `trunkitemsnew` SET `items` = '"..json.encode(items).."' WHERE `plate` = '"..plate.."'", function(result)
1230 | Trunks[plate].isOpen = false
1231 | end)
1232 | else
1233 | QBCore.Functions.ExecuteSql(false, "INSERT INTO `trunkitemsnew` (`plate`, `items`) VALUES ('"..plate.."', '"..json.encode(items).."')", function(result)
1234 | Trunks[plate].isOpen = false
1235 | end)
1236 | end
1237 | end)
1238 | end
1239 | end
1240 | end
1241 |
1242 | function AddToTrunk(plate, slot, otherslot, itemName, amount, info)
1243 | local amount = tonumber(amount)
1244 | local ItemData = QBCore.Shared.Items[itemName]
1245 |
1246 | if not ItemData.unique then
1247 | if Trunks[plate].items[slot] ~= nil and Trunks[plate].items[slot].name == itemName then
1248 | Trunks[plate].items[slot].amount = Trunks[plate].items[slot].amount + amount
1249 | else
1250 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1251 | Trunks[plate].items[slot] = {
1252 | name = itemInfo["name"],
1253 | amount = amount,
1254 | info = info ~= nil and info or "",
1255 | label = itemInfo["label"],
1256 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1257 | weight = itemInfo["weight"],
1258 | type = itemInfo["type"],
1259 | unique = itemInfo["unique"],
1260 | useable = itemInfo["useable"],
1261 | image = itemInfo["image"],
1262 | slot = slot,
1263 | }
1264 | end
1265 | else
1266 | if Trunks[plate].items[slot] ~= nil and Trunks[plate].items[slot].name == itemName then
1267 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1268 | Trunks[plate].items[otherslot] = {
1269 | name = itemInfo["name"],
1270 | amount = amount,
1271 | info = info ~= nil and info or "",
1272 | label = itemInfo["label"],
1273 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1274 | weight = itemInfo["weight"],
1275 | type = itemInfo["type"],
1276 | unique = itemInfo["unique"],
1277 | useable = itemInfo["useable"],
1278 | image = itemInfo["image"],
1279 | slot = otherslot,
1280 | }
1281 | else
1282 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1283 | Trunks[plate].items[slot] = {
1284 | name = itemInfo["name"],
1285 | amount = amount,
1286 | info = info ~= nil and info or "",
1287 | label = itemInfo["label"],
1288 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1289 | weight = itemInfo["weight"],
1290 | type = itemInfo["type"],
1291 | unique = itemInfo["unique"],
1292 | useable = itemInfo["useable"],
1293 | image = itemInfo["image"],
1294 | slot = slot,
1295 | }
1296 | end
1297 | end
1298 | end
1299 |
1300 | function RemoveFromTrunk(plate, slot, itemName, amount)
1301 | if Trunks[plate].items[slot] ~= nil and Trunks[plate].items[slot].name == itemName then
1302 | if Trunks[plate].items[slot].amount > amount then
1303 | Trunks[plate].items[slot].amount = Trunks[plate].items[slot].amount - amount
1304 | else
1305 | Trunks[plate].items[slot] = nil
1306 | if next(Trunks[plate].items) == nil then
1307 | Trunks[plate].items = {}
1308 | end
1309 | end
1310 | else
1311 | Trunks[plate].items[slot]= nil
1312 | if Trunks[plate].items == nil then
1313 | Trunks[plate].items[slot] = nil
1314 | end
1315 | end
1316 | end
1317 |
1318 | -- Glovebox items
1319 | function GetOwnedVehicleGloveboxItems(plate)
1320 | local items = {}
1321 | QBCore.Functions.ExecuteSql(true, "SELECT * FROM `gloveboxitems` WHERE `plate` = '"..plate.."'", function(result)
1322 | if result[1] ~= nil then
1323 | for k, item in pairs(result) do
1324 | local itemInfo = QBCore.Shared.Items[item.name:lower()]
1325 | items[item.slot] = {
1326 | name = itemInfo["name"],
1327 | amount = tonumber(item.amount),
1328 | info = json.decode(item.info) ~= nil and json.decode(item.info) or "",
1329 | label = itemInfo["label"],
1330 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1331 | weight = itemInfo["weight"],
1332 | type = itemInfo["type"],
1333 | unique = itemInfo["unique"],
1334 | useable = itemInfo["useable"],
1335 | image = itemInfo["image"],
1336 | slot = item.slot,
1337 | }
1338 | end
1339 | QBCore.Functions.ExecuteSql(false, "DELETE FROM `gloveboxitems` WHERE `plate` = '"..plate.."'")
1340 | else
1341 | QBCore.Functions.ExecuteSql(true, "SELECT * FROM `gloveboxitemsnew` WHERE `plate` = '"..plate.."'", function(result)
1342 | if result[1] ~= nil then
1343 | if result[1].items ~= nil then
1344 | result[1].items = json.decode(result[1].items)
1345 | if result[1].items ~= nil then
1346 | for k, item in pairs(result[1].items) do
1347 | local itemInfo = QBCore.Shared.Items[item.name:lower()]
1348 | items[item.slot] = {
1349 | name = itemInfo["name"],
1350 | amount = tonumber(item.amount),
1351 | info = item.info ~= nil and item.info or "",
1352 | label = itemInfo["label"],
1353 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1354 | weight = itemInfo["weight"],
1355 | type = itemInfo["type"],
1356 | unique = itemInfo["unique"],
1357 | useable = itemInfo["useable"],
1358 | image = itemInfo["image"],
1359 | slot = item.slot,
1360 | }
1361 | end
1362 | end
1363 | end
1364 | end
1365 | end)
1366 | end
1367 | end)
1368 | return items
1369 | end
1370 |
1371 | function SaveOwnedGloveboxItems(plate, items)
1372 | if Gloveboxes[plate].label ~= "Glovebox-None" then
1373 | if items ~= nil then
1374 | for slot, item in pairs(items) do
1375 | item.description = nil
1376 | end
1377 |
1378 | QBCore.Functions.ExecuteSql(false, "SELECT * FROM `gloveboxitemsnew` WHERE `plate` = '"..plate.."'", function(result)
1379 | if result[1] ~= nil then
1380 | QBCore.Functions.ExecuteSql(false, "UPDATE `gloveboxitemsnew` SET `items` = '"..json.encode(items).."' WHERE `plate` = '"..plate.."'", function(result)
1381 | Gloveboxes[plate].isOpen = false
1382 | end)
1383 | else
1384 | QBCore.Functions.ExecuteSql(false, "INSERT INTO `gloveboxitemsnew` (`plate`, `items`) VALUES ('"..plate.."', '"..json.encode(items).."')", function(result)
1385 | Gloveboxes[plate].isOpen = false
1386 | end)
1387 | end
1388 | end)
1389 | end
1390 | end
1391 | end
1392 |
1393 | function AddToGlovebox(plate, slot, otherslot, itemName, amount, info)
1394 | local amount = tonumber(amount)
1395 | local ItemData = QBCore.Shared.Items[itemName]
1396 |
1397 | if not ItemData.unique then
1398 | if Gloveboxes[plate].items[slot] ~= nil and Gloveboxes[plate].items[slot].name == itemName then
1399 | Gloveboxes[plate].items[slot].amount = Gloveboxes[plate].items[slot].amount + amount
1400 | else
1401 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1402 | Gloveboxes[plate].items[slot] = {
1403 | name = itemInfo["name"],
1404 | amount = amount,
1405 | info = info ~= nil and info or "",
1406 | label = itemInfo["label"],
1407 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1408 | weight = itemInfo["weight"],
1409 | type = itemInfo["type"],
1410 | unique = itemInfo["unique"],
1411 | useable = itemInfo["useable"],
1412 | image = itemInfo["image"],
1413 | slot = slot,
1414 | }
1415 | end
1416 | else
1417 | if Gloveboxes[plate].items[slot] ~= nil and Gloveboxes[plate].items[slot].name == itemName then
1418 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1419 | Gloveboxes[plate].items[otherslot] = {
1420 | name = itemInfo["name"],
1421 | amount = amount,
1422 | info = info ~= nil and info or "",
1423 | label = itemInfo["label"],
1424 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1425 | weight = itemInfo["weight"],
1426 | type = itemInfo["type"],
1427 | unique = itemInfo["unique"],
1428 | useable = itemInfo["useable"],
1429 | image = itemInfo["image"],
1430 | slot = otherslot,
1431 | }
1432 | else
1433 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1434 | Gloveboxes[plate].items[slot] = {
1435 | name = itemInfo["name"],
1436 | amount = amount,
1437 | info = info ~= nil and info or "",
1438 | label = itemInfo["label"],
1439 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1440 | weight = itemInfo["weight"],
1441 | type = itemInfo["type"],
1442 | unique = itemInfo["unique"],
1443 | useable = itemInfo["useable"],
1444 | image = itemInfo["image"],
1445 | slot = slot,
1446 | }
1447 | end
1448 | end
1449 | end
1450 |
1451 | function RemoveFromGlovebox(plate, slot, itemName, amount)
1452 | if Gloveboxes[plate].items[slot] ~= nil and Gloveboxes[plate].items[slot].name == itemName then
1453 | if Gloveboxes[plate].items[slot].amount > amount then
1454 | Gloveboxes[plate].items[slot].amount = Gloveboxes[plate].items[slot].amount - amount
1455 | else
1456 | Gloveboxes[plate].items[slot] = nil
1457 | if next(Gloveboxes[plate].items) == nil then
1458 | Gloveboxes[plate].items = {}
1459 | end
1460 | end
1461 | else
1462 | Gloveboxes[plate].items[slot]= nil
1463 | if Gloveboxes[plate].items == nil then
1464 | Gloveboxes[plate].items[slot] = nil
1465 | end
1466 | end
1467 | end
1468 |
1469 | -- Drop items
1470 | function AddToDrop(dropId, slot, itemName, amount, info)
1471 | local amount = tonumber(amount)
1472 | if Drops[dropId].items[slot] ~= nil and Drops[dropId].items[slot].name == itemName then
1473 | Drops[dropId].items[slot].amount = Drops[dropId].items[slot].amount + amount
1474 | else
1475 | local itemInfo = QBCore.Shared.Items[itemName:lower()]
1476 | Drops[dropId].items[slot] = {
1477 | name = itemInfo["name"],
1478 | amount = amount,
1479 | info = info ~= nil and info or "",
1480 | label = itemInfo["label"],
1481 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1482 | weight = itemInfo["weight"],
1483 | type = itemInfo["type"],
1484 | unique = itemInfo["unique"],
1485 | useable = itemInfo["useable"],
1486 | image = itemInfo["image"],
1487 | slot = slot,
1488 | id = dropId,
1489 | }
1490 | end
1491 | end
1492 |
1493 | function RemoveFromDrop(dropId, slot, itemName, amount)
1494 | if Drops[dropId].items[slot] ~= nil and Drops[dropId].items[slot].name == itemName then
1495 | if Drops[dropId].items[slot].amount > amount then
1496 | Drops[dropId].items[slot].amount = Drops[dropId].items[slot].amount - amount
1497 | else
1498 | Drops[dropId].items[slot] = nil
1499 | if next(Drops[dropId].items) == nil then
1500 | Drops[dropId].items = {}
1501 | --TriggerClientEvent("inventory:client:RemoveDropItem", -1, dropId)
1502 | end
1503 | end
1504 | else
1505 | Drops[dropId].items[slot] = nil
1506 | if Drops[dropId].items == nil then
1507 | Drops[dropId].items[slot] = nil
1508 | --TriggerClientEvent("inventory:client:RemoveDropItem", -1, dropId)
1509 | end
1510 | end
1511 | end
1512 |
1513 | function CreateDropId()
1514 | if Drops ~= nil then
1515 | local id = math.random(10000, 99999)
1516 | local dropid = id
1517 | while Drops[dropid] ~= nil do
1518 | id = math.random(10000, 99999)
1519 | dropid = id
1520 | end
1521 | return dropid
1522 | else
1523 | local id = math.random(10000, 99999)
1524 | local dropid = id
1525 | return dropid
1526 | end
1527 | end
1528 |
1529 | function CreateNewDrop(source, fromSlot, toSlot, itemAmount)
1530 | local Player = QBCore.Functions.GetPlayer(source)
1531 | local itemData = Player.Functions.GetItemBySlot(fromSlot)
1532 | if Player.Functions.RemoveItem(itemData.name, itemAmount, itemData.slot) then
1533 | TriggerClientEvent("inventory:client:CheckWeapon", source, itemData.name)
1534 | local itemInfo = QBCore.Shared.Items[itemData.name:lower()]
1535 | local dropId = CreateDropId()
1536 | Drops[dropId] = {}
1537 | Drops[dropId].items = {}
1538 |
1539 | Drops[dropId].items[toSlot] = {
1540 | name = itemInfo["name"],
1541 | amount = itemAmount,
1542 | info = itemData.info ~= nil and itemData.info or "",
1543 | label = itemInfo["label"],
1544 | description = itemInfo["description"] ~= nil and itemInfo["description"] or "",
1545 | weight = itemInfo["weight"],
1546 | type = itemInfo["type"],
1547 | unique = itemInfo["unique"],
1548 | useable = itemInfo["useable"],
1549 | image = itemInfo["image"],
1550 | slot = toSlot,
1551 | id = dropId,
1552 | }
1553 | TriggerEvent("qb-log:server:sendLog", Player.PlayerData.citizenid, "itemswapped", {type="3drop", name=itemData.name, amount=itemAmount})
1554 | TriggerEvent("qb-log:server:CreateLog", "drop", "New Item Drop", "red", "**".. GetPlayerName(source) .. "** (citizenid: *"..Player.PlayerData.citizenid.."* | id: *"..source.."*) dropped new item; name: **"..itemData.name.."**, amount: **" .. itemAmount .. "**")
1555 | TriggerClientEvent("inventory:client:DropItemAnim", source)
1556 | TriggerClientEvent("inventory:client:AddDropItem", -1, dropId, source)
1557 | if itemData.name:lower() == "radio" then
1558 | TriggerClientEvent('qb-radio:onRadioDrop', source)
1559 | end
1560 | else
1561 | TriggerClientEvent("QBCore:Notify", src, "You don't have this item!", "error")
1562 | return
1563 | end
1564 | end
1565 |
1566 | QBCore.Commands.Add("inv", "Open your inventory", {}, false, function(source, args)
1567 | local Player = QBCore.Functions.GetPlayer(source)
1568 | TriggerClientEvent("inventory:client:OpenInventory", source, Player.PlayerData.items)
1569 | end)
1570 |
1571 | QBCore.Commands.Add("resetinv", "Reset inventory (in case of -None)", {{name="type", help="stash/trunk/glovebox"},{name="id/plate", help="ID of stash or license plate"}}, true, function(source, args)
1572 | local invType = args[1]:lower()
1573 | table.remove(args, 1)
1574 | local invId = table.concat(args, " ")
1575 | if invType ~= nil and invId ~= nil then
1576 | if invType == "trunk" then
1577 | if Trunks[invId] ~= nil then
1578 | Trunks[invId].isOpen = false
1579 | end
1580 | elseif invType == "glovebox" then
1581 | if Gloveboxes[invId] ~= nil then
1582 | Gloveboxes[invId].isOpen = false
1583 | end
1584 | elseif invType == "stash" then
1585 | if Stashes[invId] ~= nil then
1586 | Stashes[invId].isOpen = false
1587 | end
1588 | else
1589 | TriggerClientEvent('QBCore:Notify', source, "Not a valid type..", "error")
1590 | end
1591 | else
1592 | TriggerClientEvent('QBCore:Notify', source, "Argumenten not filled out correctly..", "error")
1593 | end
1594 | end, "admin")
1595 |
1596 | -- QBCore.Commands.Add("setnui", "Zet nui aan/ui (0/1)", {}, true, function(source, args)
1597 | -- if tonumber(args[1]) == 1 then
1598 | -- TriggerClientEvent("inventory:client:EnableNui", src)
1599 | -- else
1600 | -- TriggerClientEvent("inventory:client:DisableNui", src)
1601 | -- end
1602 | -- end)
1603 |
1604 | QBCore.Commands.Add("trunkpos", "Shows trunk position", {}, false, function(source, args)
1605 | TriggerClientEvent("inventory:client:ShowTrunkPos", source)
1606 | end)
1607 |
1608 | QBCore.Commands.Add("beroof", "Beroof een speler", {}, false, function(source, args)
1609 | TriggerClientEvent("police:client:RobPlayer", source)
1610 | end)
1611 |
1612 | QBCore.Commands.Add("giveitem", "Give item to a player", {{name="id", help="Plaer ID"},{name="item", help="Name of the item (not a label)"}, {name="amount", help="Amount of items"}}, true, function(source, args)
1613 | local Player = QBCore.Functions.GetPlayer(tonumber(args[1]))
1614 | local amount = tonumber(args[3])
1615 | local itemData = QBCore.Shared.Items[tostring(args[2]):lower()]
1616 | if Player ~= nil then
1617 | if amount > 0 then
1618 | if itemData ~= nil then
1619 | -- check iteminfo
1620 | local info = {}
1621 | if itemData["name"] == "id_card" then
1622 | info.citizenid = Player.PlayerData.citizenid
1623 | info.firstname = Player.PlayerData.charinfo.firstname
1624 | info.lastname = Player.PlayerData.charinfo.lastname
1625 | info.birthdate = Player.PlayerData.charinfo.birthdate
1626 | info.gender = Player.PlayerData.charinfo.gender
1627 | info.nationality = Player.PlayerData.charinfo.nationality
1628 | info.job = Player.PlayerData.job.label
1629 | elseif itemData["type"] == "weapon" then
1630 | amount = 1
1631 | info.serie = tostring(Config.RandomInt(2) .. Config.RandomStr(3) .. Config.RandomInt(1) .. Config.RandomStr(2) .. Config.RandomInt(3) .. Config.RandomStr(4))
1632 | elseif itemData["name"] == "harness" then
1633 | info.uses = 20
1634 | elseif itemData["name"] == "markedbills" then
1635 | info.worth = math.random(5000, 10000)
1636 | elseif itemData["name"] == "labkey" then
1637 | info.lab = exports["qb-methlab"]:GenerateRandomLab()
1638 | elseif itemData["name"] == "printerdocument" then
1639 | info.url = "https://cdn.discordapp.com/attachments/645995539208470549/707609551733522482/image0.png"
1640 | end
1641 |
1642 | if Player.Functions.AddItem(itemData["name"], amount, false, info) then
1643 | TriggerClientEvent('QBCore:Notify', source, "You have givwen " ..GetPlayerName(tonumber(args[1])).." " .. itemData["name"] .. " ("..amount.. ")", "success")
1644 | else
1645 | TriggerClientEvent('QBCore:Notify', source, "Can't give item!", "error")
1646 | end
1647 | else
1648 | TriggerClientEvent('chatMessage', source, "SYSTEM", "error", "Item doesn't exist!")
1649 | end
1650 | else
1651 | TriggerClientEvent('chatMessage', source, "SYSTEM", "error", "Amount must be higher than 0!")
1652 | end
1653 | else
1654 | TriggerClientEvent('chatMessage', source, "SYSTEM", "error", "Player is not online!")
1655 | end
1656 | end, "admin")
1657 |
1658 | QBCore.Commands.Add("randomitems", "Krijg wat random items (voor testen)", {}, false, function(source, args)
1659 | local Player = QBCore.Functions.GetPlayer(source)
1660 | local filteredItems = {}
1661 | for k, v in pairs(QBCore.Shared.Items) do
1662 | if QBCore.Shared.Items[k]["type"] ~= "weapon" then
1663 | table.insert(filteredItems, v)
1664 | end
1665 | end
1666 | for i = 1, 10, 1 do
1667 | local randitem = filteredItems[math.random(1, #filteredItems)]
1668 | local amount = math.random(1, 10)
1669 | if randitem["unique"] then
1670 | amount = 1
1671 | end
1672 | if Player.Functions.AddItem(randitem["name"], amount) then
1673 | TriggerClientEvent('inventory:client:ItemBox', source, QBCore.Shared.Items[randitem["name"]], 'add')
1674 | Citizen.Wait(500)
1675 | end
1676 | end
1677 | end, "god")
1678 | QBCore.Functions.CreateUseableItem("id_card", function(source, item)
1679 | local Player = QBCore.Functions.GetPlayer(source)
1680 | if (Player.PlayerData.job.name == "police" or
1681 | Player.PlayerData.job.name == "police1" or
1682 | Player.PlayerData.job.name == "police2" or
1683 | Player.PlayerData.job.name == "police3" or
1684 | Player.PlayerData.job.name == "police4" or
1685 | Player.PlayerData.job.name == "police5" or
1686 | Player.PlayerData.job.name == "police6" or
1687 | Player.PlayerData.job.name == "police7" or
1688 | Player.PlayerData.job.name == "police8") then
1689 | if Player.Functions.GetItemBySlot(item.slot) ~= nil then
1690 | TriggerClientEvent("inventory:client:ShowId", -1, source, Player.PlayerData.citizenid, item.info)
1691 | TriggerClientEvent('usebadge:gc',source)
1692 | end
1693 | else
1694 | if Player.Functions.GetItemBySlot(item.slot) ~= nil then
1695 | TriggerClientEvent("inventory:client:ShowId", -1, source, Player.PlayerData.citizenid, item.info)
1696 | end
1697 | end
1698 | end)
1699 |
1700 | --[[QBCore.Functions.CreateUseableItem("id_card", function(source, item)
1701 | local Player = QBCore.Functions.GetPlayer(source)
1702 | if Player.Functions.GetItemBySlot(item.slot) ~= nil then
1703 | TriggerClientEvent("inventory:client:ShowId", -1, source, Player.PlayerData.citizenid, item.info)
1704 | end
1705 | end)]]
1706 |
1707 | QBCore.Functions.CreateUseableItem("snowball", function(source, item)
1708 | local Player = QBCore.Functions.GetPlayer(source)
1709 | local itemData = Player.Functions.GetItemBySlot(item.slot)
1710 | if Player.Functions.GetItemBySlot(item.slot) ~= nil then
1711 | TriggerClientEvent("inventory:client:UseSnowball", source, itemData.amount)
1712 | end
1713 | end)
1714 |
1715 | QBCore.Functions.CreateUseableItem("driver_license", function(source, item)
1716 | local Player = QBCore.Functions.GetPlayer(source)
1717 | if Player.Functions.GetItemBySlot(item.slot) ~= nil then
1718 | TriggerClientEvent("inventory:client:ShowDriverLicense", -1, source, Player.PlayerData.citizenid, item.info)
1719 | end
1720 | end)
--------------------------------------------------------------------------------