· 6 years ago · Jan 05, 2020, 08:48 PM
1PASTEBINGO API TOOLS FAQ DEALS
2Search...
3pasteSIGN IN SIGN UP
4Public Pastes
5Untitled
60 sec ago
7Untitled
812 sec ago
9my config.yml
1052 sec ago
11Untitled
1257 sec ago
13Untitled
141 min ago
15Socks4
161 min ago
17Untitled
181 min ago
19Untitled
20Python | 1 min ago
21
22SHARE
23TWEET
24
25Untitled
26 A GUEST JAN 5TH, 2020 0 NEVER
27NOTE: Your guest paste has been posted. If you sign up for a free account, you can edit and delete your pastes!
28rawdownloadcloneembedreportprinttext 8.43 KB
29local Keys = {
30 ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
31 ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
32 ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
33 ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
34 ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
35 ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
36 ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
37 ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
38 ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
39}
40
41ESX = nil
42local HasAlreadyEnteredMarker = false
43local LastZone = nil
44local CurrentAction = nil
45local CurrentActionMsg = ''
46local CurrentActionData = {}
47local ShopOpen = false
48local PlayerData = {}
49
50Citizen.CreateThread(function()
51 while ESX == nil do
52 TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
53 Citizen.Wait(0)
54 end
55
56 --[[
57 ESX.TriggerServerCallback('rid_blackmarket:getShop', function(shopItems)
58 for k,v in pairs(shopItems) do
59 Config.Zones[k].Items = v
60 end
61 end)
62 ]]--
63
64 while ESX.GetPlayerData().job == nil do
65 Citizen.Wait(10)
66 end
67
68 PlayerData = ESX.GetPlayerData()
69end)
70
71RegisterNetEvent('rid_blackmarket:sendShop')
72AddEventHandler('rid_blackmarket:sendShop', function(shopItems)
73 for k,v in pairs(shopItems) do
74 Config.Zones[k].Items = v
75 end
76end)
77
78function OpenShopMenu(zone)
79 local elements = {
80 {label = 'itemLabel', value = 'itemName'}
81 }
82 ShopOpen = true
83
84 Config.Zones["BlackMarket"].Items = nil
85
86 -- Get Current Stock Logic
87 TriggerServerEvent('rid_blackmarket:stockUpdate')
88
89 -- Stop Menu opening before new stock data is loaded
90 while Config.Zones["BlackMarket"].Items == nil do
91 Citizen.Wait(10)
92 end
93
94 for i=1, #Config.Zones[zone].Items, 1 do
95 local item = Config.Zones[zone].Items[i]
96
97 table.insert(elements, {
98 label = ('%s - <span style="color: green;">%s</span> - <span style="color: red;">%s</span>'):format(item.label, _U('shop_menu_item', ESX.Math.GroupDigits(item.price)), item.stock),
99 price = item.price,
100 weaponName = item.item,
101 stock = item.stock
102 })
103 end
104
105 ESX.UI.Menu.CloseAll()
106 PlaySoundFrontend(-1, 'BACK', 'HUD_AMMO_SHOP_SOUNDSET', false)
107
108 ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop', {
109 title = _U('shop_menu_title'),
110 align = 'top-left',
111 elements = elements
112 }, function(data, menu)
113 if data.current.value == 'itemName' then
114 ESX.TriggerServerCallback('rid_blackmarket:buyWeapon', function(bought)
115 if bought then
116 DisplayBoughtScaleform(data.current.value, data.current.price)
117 ESX.UI.Menu.CloseAll()
118 else
119 PlaySoundFrontend(-1, 'ERROR', 'HUD_AMMO_SHOP_SOUNDSET', false)
120 ESX.UI.Menu.CloseAll()
121 end
122 end, data.current.value, zone)
123 else
124 ESX.TriggerServerCallback('rid_blackmarket:buyWeapon', function(bought)
125 if bought then
126 DisplayBoughtScaleform(data.current.weaponName, data.current.price)
127 ESX.UI.Menu.CloseAll()
128 else
129 PlaySoundFrontend(-1, 'ERROR', 'HUD_AMMO_SHOP_SOUNDSET', false)
130 ESX.UI.Menu.CloseAll()
131 end
132 end, data.current.weaponName, zone)
133 end, function(data, menu)
134 PlaySoundFrontend(-1, 'BACK', 'HUD_AMMO_SHOP_SOUNDSET', false)
135 ShopOpen = false
136 menu.close()
137
138 CurrentAction = 'shop_menu'
139 CurrentActionMsg = _U('shop_menu_prompt')
140 CurrentActionData = { zone = zone }
141 end, function(data, menu)
142 PlaySoundFrontend(-1, 'NAV', 'HUD_AMMO_SHOP_SOUNDSET', false)
143 end)
144end
145
146function DisplayBoughtScaleform(weaponName, price)
147 local scaleform = ESX.Scaleform.Utils.RequestScaleformMovie('MP_BIG_MESSAGE_FREEMODE')
148 local sec = 4
149
150 BeginScaleformMovieMethod(scaleform, 'SHOW_WEAPON_PURCHASED')
151
152 PushScaleformMovieMethodParameterString(_U('weapon_bought', ESX.Math.GroupDigits(price)))
153 PushScaleformMovieMethodParameterString(ESX.GetWeaponLabel(weaponName))
154 PushScaleformMovieMethodParameterInt(GetHashKey(weaponName))
155 PushScaleformMovieMethodParameterString('')
156 PushScaleformMovieMethodParameterInt(100)
157
158 EndScaleformMovieMethod()
159
160 PlaySoundFrontend(-1, 'WEAPON_PURCHASE', 'HUD_AMMO_SHOP_SOUNDSET', false)
161
162 Citizen.CreateThread(function()
163 while sec > 0 do
164 Citizen.Wait(0)
165 sec = sec - 0.01
166
167 DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
168 end
169 end)
170end
171
172AddEventHandler('rid_blackmarket:hasEnteredMarker', function(zone)
173 if zone == 'BlackMarket' then
174 CurrentAction = 'shop_menu'
175 CurrentActionMsg = _U('shop_menu_prompt')
176 CurrentActionData = { zone = zone }
177 end
178end)
179
180AddEventHandler('rid_blackmarket:hasExitedMarker', function(zone)
181 CurrentAction = nil
182 ESX.UI.Menu.CloseAll()
183end)
184
185AddEventHandler('onResourceStop', function(resource)
186 if resource == GetCurrentResourceName() then
187 if ShopOpen then
188 ESX.UI.Menu.CloseAll()
189 end
190 end
191end)
192
193--[[ Create Blips
194Citizen.CreateThread(function()
195 for k,v in pairs(Config.Zones) do
196 if v.Legal then
197 for i = 1, #v.Locations, 1 do
198 local blip = AddBlipForCoord(v.Locations[i])
199
200 SetBlipSprite (blip, 110)
201 SetBlipDisplay(blip, 4)
202 SetBlipScale (blip, 1.0)
203 SetBlipColour (blip, 81)
204 SetBlipAsShortRange(blip, true)
205
206 BeginTextCommandSetBlipName("STRING")
207 AddTextComponentSubstringPlayerName(_U('map_blip'))
208 EndTextCommandSetBlipName(blip)
209 end
210 end
211 end
212end)
213]]--
214
215-- Display markers
216Citizen.CreateThread(function()
217 Citizen.Wait(500)
218
219 for k,v in pairs(Config.Zones) do
220 for i = 1, #v.Locations, 1 do
221 location = v.Locations[i]
222 end
223 end
224
225 while true do
226 Citizen.Wait(0)
227 local coords = GetEntityCoords(PlayerPedId())
228
229 if PlayerData.job and PlayerData.job.name ~= 'police' then
230 if (Config.Type ~= -1 and GetDistanceBetweenCoords(coords, location, true) < Config.DrawDistance) then
231 DrawMarker(Config.Type, location, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false)
232 end
233 elseif Config.Police_Visibility then
234 if (Config.Type ~= -1 and GetDistanceBetweenCoords(coords, location, true) < Config.DrawDistance) then
235 DrawMarker(Config.Type, location, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false)
236 end
237 end
238 end
239end)
240
241-- Enter / Exit marker events
242Citizen.CreateThread(function()
243 Citizen.Wait(500)
244 PlayerData = ESX.GetPlayerData()
245
246 while true do
247 Citizen.Wait(0)
248
249 local coords = GetEntityCoords(PlayerPedId())
250 local isInMarker, currentZone = false, nil
251
252 for k,v in pairs(Config.Zones) do
253 for i = 1, #v.Locations, 1 do
254 if GetDistanceBetweenCoords(coords, v.Locations[i], true) < Config.Size.x then
255 isInMarker, ShopItems, currentZone, LastZone = true, v.Items, k, k
256 end
257 end
258 end
259
260 if PlayerData.job.name ~= 'police' then
261 if isInMarker and not HasAlreadyEnteredMarker then
262 HasAlreadyEnteredMarker = true
263 TriggerEvent('rid_blackmarket:hasEnteredMarker', currentZone)
264 end
265 end
266
267 if isInMarker and not HasAlreadyEnteredMarker and Config.Police_Use then
268 HasAlreadyEnteredMarker = true
269 TriggerEvent('rid_blackmarket:hasEnteredMarker', currentZone)
270 end
271
272
273 if not isInMarker and HasAlreadyEnteredMarker then
274 HasAlreadyEnteredMarker = false
275 TriggerEvent('rid_blackmarket:hasExitedMarker', LastZone)
276 end
277 end
278end)
279
280-- Key Controls
281Citizen.CreateThread(function()
282 while true do
283 Citizen.Wait(0)
284
285 if CurrentAction ~= nil then
286 ESX.ShowHelpNotification(CurrentActionMsg)
287
288 if IsControlJustReleased(0, Keys['E']) then
289
290 if CurrentAction == 'shop_menu' then
291
292 OpenShopMenu(CurrentActionData.zone)
293
294 end
295
296 CurrentAction = nil
297 end
298 end
299 end
300end)
301RAW Paste Data
302local Keys = {
303 ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
304 ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
305 ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
306 ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
307 ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
308 ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
309 ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
310 ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
311 ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
312}
313
314ESX = nil
315local HasAlreadyEnteredMarker = false
316local LastZone = nil
317local CurrentAction = nil
318local CurrentActionMsg = ''
319local CurrentActionData = {}
320local ShopOpen = false
321local PlayerData = {}
322
323Citizen.CreateThread(function()
324 while ESX == nil do
325 TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
326 Citizen.Wait(0)
327 end
328
329 --[[
330 ESX.TriggerServerCallback('rid_blackmarket:getShop', function(shopItems)
331 for k,v in pairs(shopItems) do
332 Config.Zones[k].Items = v
333 end
334 end)
335 ]]--
336
337 while ESX.GetPlayerData().job == nil do
338 Citizen.Wait(10)
339 end
340
341 PlayerData = ESX.GetPlayerData()
342end)
343
344RegisterNetEvent('rid_blackmarket:sendShop')
345AddEventHandler('rid_blackmarket:sendShop', function(shopItems)
346 for k,v in pairs(shopItems) do
347 Config.Zones[k].Items = v
348 end
349end)
350
351function OpenShopMenu(zone)
352 local elements = {
353 {label = 'itemLabel', value = 'itemName'}
354 }
355 ShopOpen = true
356
357 Config.Zones["BlackMarket"].Items = nil
358
359 -- Get Current Stock Logic
360 TriggerServerEvent('rid_blackmarket:stockUpdate')
361
362 -- Stop Menu opening before new stock data is loaded
363 while Config.Zones["BlackMarket"].Items == nil do
364 Citizen.Wait(10)
365 end
366
367 for i=1, #Config.Zones[zone].Items, 1 do
368 local item = Config.Zones[zone].Items[i]
369
370 table.insert(elements, {
371 label = ('%s - <span style="color: green;">%s</span> - <span style="color: red;">%s</span>'):format(item.label, _U('shop_menu_item', ESX.Math.GroupDigits(item.price)), item.stock),
372 price = item.price,
373 weaponName = item.item,
374 stock = item.stock
375 })
376 end
377
378 ESX.UI.Menu.CloseAll()
379 PlaySoundFrontend(-1, 'BACK', 'HUD_AMMO_SHOP_SOUNDSET', false)
380
381 ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop', {
382 title = _U('shop_menu_title'),
383 align = 'top-left',
384 elements = elements
385 }, function(data, menu)
386 if data.current.value == 'itemName' then
387 ESX.TriggerServerCallback('rid_blackmarket:buyWeapon', function(bought)
388 if bought then
389 DisplayBoughtScaleform(data.current.value, data.current.price)
390 ESX.UI.Menu.CloseAll()
391 else
392 PlaySoundFrontend(-1, 'ERROR', 'HUD_AMMO_SHOP_SOUNDSET', false)
393 ESX.UI.Menu.CloseAll()
394 end
395 end, data.current.value, zone)
396 else
397 ESX.TriggerServerCallback('rid_blackmarket:buyWeapon', function(bought)
398 if bought then
399 DisplayBoughtScaleform(data.current.weaponName, data.current.price)
400 ESX.UI.Menu.CloseAll()
401 else
402 PlaySoundFrontend(-1, 'ERROR', 'HUD_AMMO_SHOP_SOUNDSET', false)
403 ESX.UI.Menu.CloseAll()
404 end
405 end, data.current.weaponName, zone)
406 end, function(data, menu)
407 PlaySoundFrontend(-1, 'BACK', 'HUD_AMMO_SHOP_SOUNDSET', false)
408 ShopOpen = false
409 menu.close()
410
411 CurrentAction = 'shop_menu'
412 CurrentActionMsg = _U('shop_menu_prompt')
413 CurrentActionData = { zone = zone }
414 end, function(data, menu)
415 PlaySoundFrontend(-1, 'NAV', 'HUD_AMMO_SHOP_SOUNDSET', false)
416 end)
417end
418
419function DisplayBoughtScaleform(weaponName, price)
420 local scaleform = ESX.Scaleform.Utils.RequestScaleformMovie('MP_BIG_MESSAGE_FREEMODE')
421 local sec = 4
422
423 BeginScaleformMovieMethod(scaleform, 'SHOW_WEAPON_PURCHASED')
424
425 PushScaleformMovieMethodParameterString(_U('weapon_bought', ESX.Math.GroupDigits(price)))
426 PushScaleformMovieMethodParameterString(ESX.GetWeaponLabel(weaponName))
427 PushScaleformMovieMethodParameterInt(GetHashKey(weaponName))
428 PushScaleformMovieMethodParameterString('')
429 PushScaleformMovieMethodParameterInt(100)
430
431 EndScaleformMovieMethod()
432
433 PlaySoundFrontend(-1, 'WEAPON_PURCHASE', 'HUD_AMMO_SHOP_SOUNDSET', false)
434
435 Citizen.CreateThread(function()
436 while sec > 0 do
437 Citizen.Wait(0)
438 sec = sec - 0.01
439
440 DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
441 end
442 end)
443end
444
445AddEventHandler('rid_blackmarket:hasEnteredMarker', function(zone)
446 if zone == 'BlackMarket' then
447 CurrentAction = 'shop_menu'
448 CurrentActionMsg = _U('shop_menu_prompt')
449 CurrentActionData = { zone = zone }
450 end
451end)
452
453AddEventHandler('rid_blackmarket:hasExitedMarker', function(zone)
454 CurrentAction = nil
455 ESX.UI.Menu.CloseAll()
456end)
457
458AddEventHandler('onResourceStop', function(resource)
459 if resource == GetCurrentResourceName() then
460 if ShopOpen then
461 ESX.UI.Menu.CloseAll()
462 end
463 end
464end)
465
466--[[ Create Blips
467Citizen.CreateThread(function()
468 for k,v in pairs(Config.Zones) do
469 if v.Legal then
470 for i = 1, #v.Locations, 1 do
471 local blip = AddBlipForCoord(v.Locations[i])
472
473 SetBlipSprite (blip, 110)
474 SetBlipDisplay(blip, 4)
475 SetBlipScale (blip, 1.0)
476 SetBlipColour (blip, 81)
477 SetBlipAsShortRange(blip, true)
478
479 BeginTextCommandSetBlipName("STRING")
480 AddTextComponentSubstringPlayerName(_U('map_blip'))
481 EndTextCommandSetBlipName(blip)
482 end
483 end
484 end
485end)
486]]--
487
488-- Display markers
489Citizen.CreateThread(function()
490 Citizen.Wait(500)
491
492 for k,v in pairs(Config.Zones) do
493 for i = 1, #v.Locations, 1 do
494 location = v.Locations[i]
495 end
496 end
497
498 while true do
499 Citizen.Wait(0)
500 local coords = GetEntityCoords(PlayerPedId())
501
502 if PlayerData.job and PlayerData.job.name ~= 'police' then
503 if (Config.Type ~= -1 and GetDistanceBetweenCoords(coords, location, true) < Config.DrawDistance) then
504 DrawMarker(Config.Type, location, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false)
505 end
506 elseif Config.Police_Visibility then
507 if (Config.Type ~= -1 and GetDistanceBetweenCoords(coords, location, true) < Config.DrawDistance) then
508 DrawMarker(Config.Type, location, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.Size.x, Config.Size.y, Config.Size.z, Config.Color.r, Config.Color.g, Config.Color.b, 100, false, true, 2, false, false, false, false)
509 end
510 end
511 end
512end)
513
514-- Enter / Exit marker events
515Citizen.CreateThread(function()
516 Citizen.Wait(500)
517 PlayerData = ESX.GetPlayerData()
518
519 while true do
520 Citizen.Wait(0)
521
522 local coords = GetEntityCoords(PlayerPedId())
523 local isInMarker, currentZone = false, nil
524
525 for k,v in pairs(Config.Zones) do
526 for i = 1, #v.Locations, 1 do
527 if GetDistanceBetweenCoords(coords, v.Locations[i], true) < Config.Size.x then
528 isInMarker, ShopItems, currentZone, LastZone = true, v.Items, k, k
529 end
530 end
531 end
532
533 if PlayerData.job.name ~= 'police' then
534 if isInMarker and not HasAlreadyEnteredMarker then
535 HasAlreadyEnteredMarker = true
536 TriggerEvent('rid_blackmarket:hasEnteredMarker', currentZone)
537 end
538 end
539
540 if isInMarker and not HasAlreadyEnteredMarker and Config.Police_Use then
541 HasAlreadyEnteredMarker = true
542 TriggerEvent('rid_blackmarket:hasEnteredMarker', currentZone)
543 end
544
545
546 if not isInMarker and HasAlreadyEnteredMarker then
547 HasAlreadyEnteredMarker = false
548 TriggerEvent('rid_blackmarket:hasExitedMarker', LastZone)
549 end
550 end
551end)
552
553-- Key Controls
554Citizen.CreateThread(function()
555 while true do
556 Citizen.Wait(0)
557
558 if CurrentAction ~= nil then
559 ESX.ShowHelpNotification(CurrentActionMsg)
560
561 if IsControlJustReleased(0, Keys['E']) then
562
563 if CurrentAction == 'shop_menu' then
564
565 OpenShopMenu(CurrentActionData.zone)
566
567 end
568
569 CurrentAction = nil
570 end
571 end
572 end
573end)
574
575We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
576Not a member of Pastebin yet?
577Sign Up, it unlocks many cool features!
578
579create new paste / dealsnew! / syntax languages / archive / faq / tools / night mode / api / scraping api
580privacy statement / cookies policy / terms of service / security disclosure / dmca / contact
581
582By using Pastebin.com you agree to our cookies policy to enhance your experience.
583Site design & logo © 2020 Pastebin; user contributions (pastes) licensed under cc by-sa 3.0 -- FavPNG -- Dedicated Server Hosting by Steadfast