Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.97 KB | None | 0 0
  1. local Keys = {
  2. ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  3. ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  4. ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  5. ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  6. ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  7. ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  8. ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  9. ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  10. ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  11. }
  12.  
  13. local closeStock = false
  14. local PlayerData = {}
  15. local playerPed = PlayerPedId()
  16. local HasAlreadyEnteredMarker = false
  17. local isDead = false
  18. local hasAlreadyJoined = false
  19. local CurrentAction = nil
  20. local CurrentActionMsg = ''
  21. local CurrentActionData = {}
  22. local society = 'casino'
  23. local LastStation, LastPart, LastPartNum, LastEntity
  24. local isInShopMenu = {}, false
  25. local isBlackStarted=false
  26. local game = false
  27. local platiniumTicket = false
  28. local goldTicket = false
  29. local classicTicket = false
  30. local blips = {
  31. {title="State Casino", colour=81, id=490, x = 930.17, y = 41.8, z = 37.3}
  32. }
  33.  
  34.  
  35. ESX = nil
  36.  
  37.  
  38. Citizen.CreateThread(function()
  39. while ESX == nil do
  40. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  41. Citizen.Wait(0)
  42. end
  43.  
  44. while ESX.GetPlayerData().job == nil do
  45. Citizen.Wait(10)
  46. end
  47.  
  48. PlayerData = ESX.GetPlayerData()
  49.  
  50. end)
  51.  
  52.  
  53.  
  54.  
  55.  
  56. Citizen.CreateThread(function()
  57. while true do
  58. Citizen.Wait(0)
  59.  
  60. if IsControlJustReleased(0, Keys['F6']) and not isDead and not ESX.UI.Menu.IsOpen('default', GetCurrentResourceName(), 'casino_actions') and PlayerData.job ~= nil and PlayerData.job.name == 'casino' then
  61. closeStock = false
  62. OpenCasinoActionsMenu()
  63. end
  64. if CurrentAction then
  65. ESX.ShowHelpNotification(CurrentActionMsg)
  66. if IsControlJustReleased(0, Keys['E']) and PlayerData.job ~= nil and PlayerData.job.name == 'casino' then
  67. if CurrentAction == 'casino_mgmt' then
  68. closeStock = true
  69. OpenCasinoActionsMenu()
  70. elseif CurrentAction == 'CasinoCloak' then
  71. OpenCasinoCloak()
  72. elseif CurrentAction == 'CasinoBar' and PlayerData.job ~= nil and PlayerData.job.name == 'casino' then
  73. OpenBarMenu()
  74. elseif CurrentAction == 'CasinoBar2' and PlayerData.job ~= nil and PlayerData.job.name == 'casino' then
  75. OpenBarMenu()
  76. elseif CurrentAction == 'CasinoFridge' and PlayerData.job ~= nil and PlayerData.job.name == 'casino' then
  77. OpenGetFridgeStocksMenu()
  78. elseif CurrentAction == 'CasinoFridge2' and PlayerData.job ~= nil and PlayerData.job.name == 'casino' then
  79. OpenGetFridgeStocksMenu()
  80. end
  81. end
  82. end
  83. end
  84. end)
  85.  
  86.  
  87.  
  88. Citizen.CreateThread(function()
  89. Citizen.Wait(1000)
  90. for _, info in pairs(blips) do
  91. info.blip = AddBlipForCoord(info.x, info.y, info.z)
  92. SetBlipSprite(info.blip, info.id)
  93. SetBlipDisplay(info.blip, 4)
  94. SetBlipScale(info.blip, 1.5)
  95. SetBlipColour(info.blip, info.colour)
  96. SetBlipAsShortRange(info.blip, true)
  97. BeginTextCommandSetBlipName("STRING")
  98. AddTextComponentString(info.title)
  99. EndTextCommandSetBlipName(info.blip)
  100. end
  101. end)
  102.  
  103.  
  104. -- Enter / Exit marker events
  105. Citizen.CreateThread(function()
  106. while true do
  107. Citizen.Wait(10)
  108.  
  109. if PlayerData.job and PlayerData.job.name == 'casino' then
  110.  
  111. local coords = GetEntityCoords(PlayerPedId())
  112. local isInMarker = false
  113. local currentZone = nil
  114.  
  115. for k,v in pairs(Config.CasinoSites) do
  116. if(GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < v.Size.x) then
  117. isInMarker = true
  118. currentZone = k
  119. end
  120. end
  121.  
  122. if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then
  123. HasAlreadyEnteredMarker = true
  124. LastZone = currentZone
  125. TriggerEvent('program-casino:hasEnteredMarker', currentZone)
  126. end
  127.  
  128. if not isInMarker and HasAlreadyEnteredMarker then
  129. HasAlreadyEnteredMarker = false
  130. TriggerEvent('program-casino:hasExitedMarker', LastZone)
  131. end
  132.  
  133. end
  134. end
  135. end)
  136.  
  137.  
  138. --Show markers
  139. Citizen.CreateThread(function()
  140. while true do
  141. Citizen.Wait(0)
  142.  
  143. if PlayerData.job and PlayerData.job.name == 'casino' then
  144. local coords, letSleep = GetEntityCoords(PlayerPedId()), true
  145.  
  146. for k,v in pairs(Config.CasinoSites) do
  147. if v.Type ~= -1 and GetDistanceBetweenCoords(coords, v.Pos.x, v.Pos.y, v.Pos.z, true) < Config.DrawDistance then
  148. DrawMarker(v.Type, v.Pos.x, v.Pos.y, v.Pos.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, v.Color.r, v.Color.g, v.Color.b, 100, false, true, 2, false, nil, nil, false)
  149. letSleep = false
  150. end
  151. end
  152.  
  153. if letSleep then
  154. Citizen.Wait(2000)
  155. end
  156. else
  157. Citizen.Wait(2000)
  158. end
  159. end
  160. end)
  161.  
  162.  
  163.  
  164. -------------------------------------------------------Poczatek TP
  165. positions = {
  166. {{927.84, 44.43, 80.00, 0}, {1090.00, 207.00, -49.9, 0}},} --
  167. local player = GetPlayerPed(-1)
  168. Citizen.CreateThread(function ()
  169. while true do
  170. Citizen.Wait(5)
  171. local player = GetPlayerPed(-1)
  172. local playerLoc = GetEntityCoords(player)
  173. for i,location in ipairs(positions) do
  174. teleport_text = location[3]
  175. loc1 = {
  176. x=location[1][1],
  177. y=location[1][2],
  178. z=location[1][3],
  179. heading=location[1][4]
  180. }
  181. loc2 = {
  182. x=location[2][1],
  183. y=location[2][2],
  184. z=location[2][3],
  185. heading=location[2][4]
  186. }
  187.  
  188. DrawMarker(1, loc1.x, loc1.y, loc1.z, 0, 0, 0, 0, 0, 0, 1.501, 1.5001, 0.5001, 36,237,157, 200, 0, 0, 0, 0)
  189. DrawMarker(1, loc2.x, loc2.y, loc2.z, 0, 0, 0, 0, 0, 0, 1.501, 1.5001, 0.5001, 36,237,157, 200, 0, 0, 0, 0)
  190.  
  191. if CheckPos(playerLoc.x, playerLoc.y, playerLoc.z, loc1.x, loc1.y, loc1.z, 2) then
  192. alert("Wejdź do centrum kasyna")
  193.  
  194. if IsControlJustReleased(1, 38) then
  195. if IsPedInAnyVehicle(player, true) then
  196. PlayerData = ESX.GetPlayerData()
  197. local elements = {
  198. {label = "ClassicTicket", value = 'classicTicket'},
  199. {label = "GoldTicket", value = 'goldTicket'},
  200. {label = "PlatiniumTicket", value = "platiniumTicket"},
  201. {label = "Bramka Pracownicza", value = "worker"}
  202. }
  203.  
  204. ESX.UI.Menu.CloseAll()
  205.  
  206. ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'CasinoCloak', {
  207. title = "Casino Bramka",
  208. align = 'center',
  209. elements = elements
  210. }, function(data, menu)
  211. if data.current.value == 'classicTicket' then
  212. menu.close()
  213. SetEntityCoords(GetVehiclePedIsUsing(player), loc2.x, loc2.y, loc2.z)
  214. SetEntityHeading(GetVehiclePedIsUsing(player), loc2.heading)
  215. classicTicket = true
  216. elseif data.current.value == 'goldTicket' then
  217. menu.close()
  218. SetEntityCoords(GetVehiclePedIsUsing(player), loc2.x, loc2.y, loc2.z)
  219. SetEntityHeading(GetVehiclePedIsUsing(player), loc2.heading)
  220. goldTicket = true
  221. elseif data.current.value == 'platiniumTicket' then
  222. menu.close()
  223. SetEntityCoords(GetVehiclePedIsUsing(player), loc2.x, loc2.y, loc2.z)
  224. SetEntityHeading(GetVehiclePedIsUsing(player), loc2.heading)
  225. platiniumTicket = true
  226. elseif data.current.value == 'worker' then
  227. if PlayerData.job.name=='casino' then
  228. menu.close()
  229. SetEntityCoords(player, loc2.x, loc2.y, loc2.z)
  230. SetEntityHeading(player, loc2.heading)
  231. else
  232. menu.close()
  233. ESX.ShowNotification('~r~Nie jesteś pracownikiem Kasyna')
  234. end
  235. end
  236.  
  237. end, function(data, menu)
  238. menu.close()
  239.  
  240. CurrentAction = ''
  241. CurrentActionMsg = ""
  242. CurrentActionData = {}
  243. end)
  244. else
  245. PlayerData = ESX.GetPlayerData()
  246. local elements = {
  247. {label = "Classic Ticket ["..Config.classicPrice.."$]", value = 'classicTicket'},
  248. {label = "Gold Ticket ["..Config.goldenPrice.."$]", value = 'goldTicket'},
  249. {label = "Platinium Ticket ["..Config.platiniumPrice.."$]", value = "platiniumTicket"},
  250. {label = "Bramka Pracownicza", value = "worker"}
  251. }
  252.  
  253. ESX.UI.Menu.CloseAll()
  254.  
  255. ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'CasinoCloak', {
  256. title = "Casino Bramka",
  257. align = 'center',
  258. elements = elements
  259. }, function(data, menu)
  260. if data.current.value == 'classicTicket' then
  261. ESX.TriggerServerCallback('program-casino:checkMoney', function(result)
  262. if result>=Config.classicPrice then
  263. SetEntityCoords(player, loc2.x, loc2.y, loc2.z)
  264. SetEntityHeading(player, loc2.heading)
  265. classicTicket = true
  266. TriggerServerEvent('program-casino:removeMoney',Config.classicPrice)
  267. else
  268. ESX.ShowNotification('~r~Nie masz wysarczająco pieniędzy')
  269. end
  270. end)
  271. menu.close()
  272. wyzeruj()
  273. elseif data.current.value == 'goldTicket' then
  274. menu.close()
  275. ESX.TriggerServerCallback('program-casino:checkMoney', function(result)
  276. if result>=Config.goldenPrice then
  277. SetEntityCoords(player, loc2.x, loc2.y, loc2.z)
  278. SetEntityHeading(player, loc2.heading)
  279. goldTicket = true
  280. TriggerServerEvent('program-casino:removeMoney',Config.goldenPrice)
  281. else
  282. ESX.ShowNotification('~r~Nie masz wysarczająco pieniędzy')
  283. end
  284. end)
  285. wyzeruj()
  286. elseif data.current.value == 'platiniumTicket' then
  287. menu.close()
  288. ESX.TriggerServerCallback('program-casino:checkMoney', function(result)
  289. if result>=Config.platiniumPrice then
  290. SetEntityCoords(player, loc2.x, loc2.y, loc2.z)
  291. SetEntityHeading(player, loc2.heading)
  292. platiniumTicket = true
  293. TriggerServerEvent('program-casino:removeMoney',Config.platiniumPrice)
  294. TriggerServerEvent('program-casino:sendPlatinium')
  295. else
  296. ESX.ShowNotification('~r~Nie masz wysarczająco pieniędzy')
  297. end
  298. end)
  299. wyzeruj()
  300. elseif data.current.value == 'worker' then
  301. if PlayerData.job.name=='casino' then
  302. menu.close()
  303. SetEntityCoords(player, loc2.x, loc2.y, loc2.z)
  304. SetEntityHeading(player, loc2.heading)
  305. else
  306. menu.close()
  307. ESX.ShowNotification('~r~Nie jesteś pracownikiem Kasyna')
  308. end
  309. wyzeruj()
  310. end
  311.  
  312. end, function(data, menu)
  313. menu.close()
  314.  
  315. CurrentAction = ''
  316. CurrentActionMsg = ""
  317. CurrentActionData = {}
  318. end)
  319. end
  320. end
  321.  
  322. elseif CheckPos(playerLoc.x, playerLoc.y, playerLoc.z, loc2.x, loc2.y, loc2.z, 2) then
  323. alert("Wyjdź z centrum kasyna")
  324.  
  325. if IsControlJustReleased(1, 38) then
  326. if IsPedInAnyVehicle(player, true) then
  327. SetEntityCoords(GetVehiclePedIsUsing(player), loc1.x, loc1.y, loc1.z)
  328. SetEntityHeading(GetVehiclePedIsUsing(player), loc1.heading)
  329. platiniumTicket = false
  330. TriggerServerEvent('program-casino:sendOffPlatinium')
  331. goldTicket = false
  332. classicTicket = false
  333. wyzeruj()
  334. else
  335. SetEntityCoords(player, loc1.x, loc1.y, loc1.z)
  336. SetEntityHeading(player, loc1.heading)
  337. platiniumTicket = false
  338. TriggerServerEvent('program-casino:sendOffPlatinium')
  339. goldTicket = false
  340. classicTicket = false
  341. wyzeruj()
  342. end
  343. end
  344. end
  345. end
  346. end
  347. end)
  348.  
  349. function wyzeruj()
  350. CurrentAction = ''
  351. CurrentActionMsg = ""
  352. CurrentActionData = {}
  353. end
  354.  
  355. AddEventHandler('program-casino:hasEnteredMarker', function(zone)
  356. if zone =='CasinoActions' then
  357. CurrentAction = 'casino_mgmt'
  358. CurrentActionMsg = "~r~[E] ~b~Otworz menu zarządzania kasynem"
  359. CurrentActionData = {}
  360. elseif zone == "CasinoCloak" then
  361. CurrentAction = 'CasinoCloak'
  362. CurrentActionMsg = "~r~[E] ~p~Przebieralnia Kasyna"
  363. CurrentActionData = {}
  364. elseif zone == "CasinoFridge" then
  365. CurrentAction = 'CasinoFridge'
  366. CurrentActionMsg = "~r~[E] ~p~Lodówka"
  367. CurrentActionData = {}
  368. elseif zone == "CasinoBar" then
  369. CurrentAction = 'CasinoBar'
  370. CurrentActionMsg = "~r~[E] ~p~Bar"
  371. CurrentActionData = {}
  372. elseif zone == "CasinoBar2" then
  373. CurrentAction = 'CasinoBar2'
  374. CurrentActionMsg = "~r~[E] ~p~Bar"
  375. CurrentActionData = {}
  376. elseif zone == "CasinoFridge2" then
  377. CurrentAction = 'CasinoFridge2'
  378. CurrentActionMsg = "~r~[E] ~p~Bar"
  379. CurrentActionData = {}
  380. end
  381. end)
  382.  
  383. AddEventHandler('program-casino:hasExitedMarker', function(zone)
  384. CurrentAction = nil
  385. ESX.UI.Menu.CloseAll()
  386. end)
  387.  
  388. function CheckPos(x, y, z, cx, cy, cz, radius)
  389. local t1 = x - cx
  390. local t12 = t1^2
  391.  
  392. local t2 = y-cy
  393. local t21 = t2^2
  394.  
  395. local t3 = z - cz
  396. local t31 = t3^2
  397.  
  398. return (t12 + t21 + t31) <= radius^2
  399. end
  400.  
  401. function alert(msg)
  402. SetTextComponentFormat("STRING")
  403. AddTextComponentString(msg)
  404. DisplayHelpTextFromStringLabel(0,0,1,-1)
  405. end
  406.  
  407. -------------------------------------------------------Koniec TP
  408. AddEventHandler('esx:onPlayerDeath', function(data)
  409. isDead = true
  410. end)
  411.  
  412. AddEventHandler('playerSpawned', function(spawn)
  413. isDead = false
  414. end)
  415.  
  416. RegisterNetEvent('program-casino:openTicketMenuClient')
  417. AddEventHandler('program-casino:openTicketMenuClient', function(worker)
  418. print(worker)
  419. local elements = {
  420. {label = "Nie pokazuj", value = 'notShow'}
  421. }
  422. if goldTicket then
  423. table.insert(elements, {label = "Pokaż złoty bilet", value = 'showGolden'})
  424. end
  425. if platiniumTicket then
  426. table.insert(elements, {label = "Pokaż Platynowy bilet", value = 'showPlatinium'})
  427. end
  428. if classicTicket then
  429. table.insert(elements, {label = "Pokaż bilet", value = 'showClassic'})
  430. end
  431.  
  432. ESX.UI.Menu.CloseAll()
  433.  
  434. ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'pokazTicket', {
  435. title = "Casino",
  436. align = 'top-left',
  437. elements = elements
  438. }, function(data, menu)
  439. if data.current.value == 'notShow' then
  440.  
  441. elseif data.current.value == 'showGolden' then
  442. TriggerServerEvent('program-casino:sendTicket', "Klient posiada złoty bilet", worker)
  443. elseif data.current.value == 'showPlatinium' then
  444. TriggerServerEvent('program-casino:sendTicket', "Klient posiada platynowy bilet", worker)
  445. elseif data.current.value == 'showClassic' then
  446. TriggerServerEvent('program-casino:sendTicket', "Klient posiada klasyczny bilet", worker)
  447. end
  448.  
  449. end, function(data, menu)
  450. menu.close()
  451.  
  452. CurrentAction = ''
  453. CurrentActionMsg = ""
  454. CurrentActionData = {}
  455. end)
  456. end)
  457.  
  458.  
  459. function OpenCasinoActionsMenu()
  460. PlayerData = ESX.GetPlayerData()
  461. local elements = {
  462. {label = "Popros o bilet", value = 'ticket'}
  463. }
  464. if closeStock == true then
  465. table.insert(elements, {label = "Szafa Zbrojenia", value = 'weaponArmory'})
  466. end
  467. if PlayerData.job.grade_name == 'boss' then
  468. table.insert(elements, {label = "Akcje szefa", value = 'boss_actions'})
  469. end
  470.  
  471.  
  472. ESX.UI.Menu.CloseAll()
  473.  
  474. ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'casino_mgmt', {
  475. title = "Casino",
  476. align = 'top-left',
  477. elements = elements
  478. }, function(data, menu)
  479. if data.current.value == 'ticket' then
  480. local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
  481. print(GetPlayerServerId(closestPlayer))
  482. if closestPlayer ~= -1 and closestDistance <= 3.0 then
  483. TriggerServerEvent('program-casino:openTicketMenu', GetPlayerServerId(closestPlayer), GetPlayerServerId(playerPed))
  484. else
  485. ESX.ShowNotification('~r~Nie ma nikogo w pobliżu')
  486. end
  487. elseif data.current.value == 'boss_actions' then
  488. TriggerEvent('esx_society:openBossMenu', 'casino', function (data, menu)
  489. menu.close()
  490. end, {wash = true})
  491. elseif data.current.value == 'weaponArmory' then
  492. OpenVaultMenu()
  493. end
  494.  
  495. end, function(data, menu)
  496. menu.close()
  497.  
  498. CurrentAction = ''
  499. CurrentActionMsg = ""
  500. CurrentActionData = {}
  501. end)
  502.  
  503. end
  504.  
  505. function OpenBarMenu()
  506. ESX.UI.Menu.Open(
  507. 'default', GetCurrentResourceName(), 'menu_crafting',
  508. {
  509. title = "Drinki",
  510. align = 'center',
  511. elements = {
  512. {label = 'JagerBomba', value = 'jagerbomb'},
  513. {label = 'Golem', value = 'golem'},
  514. {label = 'Whiskycoca', value = 'whiskycoca'},
  515. {label = 'Vodkaenergy', value = 'vodkaenergy'},
  516. {label = 'Vodkafruit', value = 'vodkafruit'},
  517. {label = 'Rumfruit', value = 'rhumfruit'},
  518. {label = 'Teqpaf', value = 'teqpaf'},
  519. {label = 'Rumcoca', value = 'rhumcoca'},
  520. {label = 'Mojito', value = 'mojito'},
  521. {label = 'Mixapero', value = 'mixapero'},
  522. {label = 'Metreshooter', value = 'metreshooter'},
  523. {label = 'Jagercerbere', value = 'jagercerbere'},
  524. }
  525. },
  526. function(data2, menu2)
  527.  
  528. TriggerServerEvent('program-casino:craftingCoktails', data2.current.value)
  529. animsAction({ lib = "mini@drinking", anim = "shots_barman_b" })
  530.  
  531. end,
  532. function(data2, menu2)
  533. menu2.close()
  534. end
  535. )
  536. end
  537.  
  538.  
  539. function OpenGetFridgeStocksMenu()
  540.  
  541. ESX.TriggerServerCallback('program-casino:getFridgeStockItems', function(items)
  542.  
  543. print(json.encode(items))
  544.  
  545. local elements = {}
  546.  
  547. for i=1, #items, 1 do
  548. table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name})
  549. end
  550.  
  551. ESX.UI.Menu.Open(
  552. 'default', GetCurrentResourceName(), 'fridge_menu',
  553. {
  554. title = "Lodówka",
  555. elements = elements
  556. },
  557. function(data, menu)
  558.  
  559. local itemName = data.current.value
  560.  
  561. ESX.UI.Menu.Open(
  562. 'dialog', GetCurrentResourceName(), 'fridge_menu_get_item_count',
  563. {
  564. title = "Ilość"
  565. },
  566. function(data2, menu2)
  567.  
  568. local count = tonumber(data2.value)
  569.  
  570. if count == nil then
  571. ESX.ShowNotification("Zła ilość")
  572. else
  573. menu2.close()
  574. menu.close()
  575. OpenGetFridgeStocksMenu()
  576.  
  577. TriggerServerEvent('program-casino:getFridgeStockItem', itemName, count)
  578. end
  579.  
  580. end,
  581. function(data2, menu2)
  582. menu2.close()
  583. end
  584. )
  585.  
  586. end,
  587. function(data, menu)
  588. menu.close()
  589. end
  590. )
  591.  
  592. end)
  593.  
  594. end
  595.  
  596.  
  597.  
  598.  
  599.  
  600. function animsAction(animObj)
  601. Citizen.CreateThread(function()
  602. if not playAnim then
  603. local playerPed = GetPlayerPed(-1);
  604. if DoesEntityExist(playerPed) then -- Check if ped exist
  605. dataAnim = animObj
  606.  
  607. -- Play Animation
  608. RequestAnimDict(dataAnim.lib)
  609. while not HasAnimDictLoaded(dataAnim.lib) do
  610. Citizen.Wait(0)
  611. end
  612. if HasAnimDictLoaded(dataAnim.lib) then
  613. local flag = 0
  614. if dataAnim.loop ~= nil and dataAnim.loop then
  615. flag = 1
  616. elseif dataAnim.move ~= nil and dataAnim.move then
  617. flag = 49
  618. end
  619.  
  620. TaskPlayAnim(playerPed, dataAnim.lib, dataAnim.anim, 8.0, -8.0, -1, flag, 0, 0, 0, 0)
  621. playAnimation = true
  622. end
  623.  
  624. -- Wait end animation
  625. while true do
  626. Citizen.Wait(0)
  627. if not IsEntityPlayingAnim(playerPed, dataAnim.lib, dataAnim.anim, 3) then
  628. playAnim = false
  629. TriggerEvent('ft_animation:ClFinish')
  630. break
  631. end
  632. end
  633. end -- end ped exist
  634. end
  635. end)
  636. end
  637.  
  638. RegisterNetEvent('esx:setJob')
  639. AddEventHandler('esx:setJob', function(job)
  640. PlayerData.job = job
  641.  
  642. Citizen.Wait(5000)
  643. end)
  644.  
  645.  
  646.  
  647.  
  648. function OpenGetStocksMenu()
  649.  
  650. ESX.TriggerServerCallback('program-casino:getStockItems', function(items)
  651.  
  652. print(json.encode(items))
  653.  
  654. local elements = {}
  655.  
  656. for i=1, #items, 1 do
  657. table.insert(elements, {label = 'x' .. items[i].count .. ' ' .. items[i].label, value = items[i].name})
  658. end
  659.  
  660. ESX.UI.Menu.Open(
  661. 'default', GetCurrentResourceName(), 'stocks_menu',
  662. {
  663. title = "Szafka",
  664. elements = elements
  665. },
  666. function(data, menu)
  667.  
  668. local itemName = data.current.value
  669.  
  670. ESX.UI.Menu.Open(
  671. 'dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count',
  672. {
  673. title = "Ilosc"
  674. },
  675. function(data2, menu2)
  676.  
  677. local count = tonumber(data2.value)
  678.  
  679. if count == nil then
  680. ESX.ShowNotification("Zla ilosc")
  681. else
  682. menu2.close()
  683. menu.close()
  684. OpenGetStocksMenu()
  685.  
  686. TriggerServerEvent('program-casino:getStockItem', itemName, count)
  687. end
  688.  
  689. end,
  690. function(data2, menu2)
  691. menu2.close()
  692. end
  693. )
  694.  
  695. end,
  696. function(data, menu)
  697. menu.close()
  698. end
  699. )
  700.  
  701. end)
  702.  
  703. end
  704.  
  705.  
  706. function OpenVaultMenu()
  707.  
  708.  
  709.  
  710. local elements = {
  711. {label = "Weź Broń", value = 'get_weapon'},
  712. {label = "Odstaw Broń", value = 'put_weapon'},
  713. {label = "Weź przedmioty", value = 'get_stock'},
  714. {label = "Odstaw przedmioty", value = 'put_stock'}
  715. }
  716.  
  717.  
  718. ESX.UI.Menu.CloseAll()
  719.  
  720. ESX.UI.Menu.Open(
  721. 'default', GetCurrentResourceName(), 'vault',
  722. {
  723. title = "Krypta",
  724. align = 'top-left',
  725. elements = elements,
  726. },
  727. function(data, menu)
  728.  
  729. if data.current.value == 'get_weapon' then
  730. OpenGetWeaponMenu()
  731. end
  732.  
  733. if data.current.value == 'put_weapon' then
  734. OpenPutWeaponMenu()
  735. end
  736.  
  737. if data.current.value == 'put_stock' then
  738. OpenPutStocksMenu()
  739. end
  740.  
  741. if data.current.value == 'get_stock' then
  742. OpenGetStocksMenu()
  743. end
  744.  
  745. end,
  746.  
  747. function(data, menu)
  748.  
  749. menu.close()
  750.  
  751. CurrentAction = 'menu_vault'
  752. CurrentActionMsg = ""
  753. CurrentActionData = {}
  754. end
  755. )
  756.  
  757. end
  758.  
  759. function OpenGetWeaponMenu()
  760.  
  761. ESX.TriggerServerCallback('program-casino:getVaultWeapons', function(weapons)
  762.  
  763. local elements = {}
  764.  
  765. for i=1, #weapons, 1 do
  766. if weapons[i].count > 0 then
  767. table.insert(elements, {label = 'x' .. weapons[i].count .. ' ' .. ESX.GetWeaponLabel(weapons[i].name), value = weapons[i].name})
  768. end
  769. end
  770.  
  771. ESX.UI.Menu.Open(
  772. 'default', GetCurrentResourceName(), 'vault_get_weapon',
  773. {
  774. title = "Weź broń",
  775. align = 'top-left',
  776. elements = elements,
  777. },
  778. function(data, menu)
  779.  
  780. menu.close()
  781.  
  782. ESX.TriggerServerCallback('program-casino:removeVaultWeapon', function()
  783. OpenGetWeaponMenu()
  784. end, data.current.value)
  785.  
  786. end,
  787. function(data, menu)
  788. menu.close()
  789. end
  790. )
  791.  
  792. end)
  793.  
  794. end
  795.  
  796. function OpenPutWeaponMenu()
  797.  
  798. local elements = {}
  799. local playerPed = GetPlayerPed(-1)
  800. local weaponList = ESX.GetWeaponList()
  801.  
  802. for i=1, #weaponList, 1 do
  803.  
  804. local weaponHash = GetHashKey(weaponList[i].name)
  805.  
  806. if HasPedGotWeapon(playerPed, weaponHash, false) and weaponList[i].name ~= 'WEAPON_UNARMED' then
  807. local ammo = GetAmmoInPedWeapon(playerPed, weaponHash)
  808. table.insert(elements, {label = weaponList[i].label, value = weaponList[i].name})
  809. end
  810.  
  811. end
  812.  
  813. ESX.UI.Menu.Open(
  814. 'default', GetCurrentResourceName(), 'vault_put_weapon',
  815. {
  816. title = "Włóż broń",
  817. align = 'top-left',
  818. elements = elements,
  819. },
  820. function(data, menu)
  821.  
  822. menu.close()
  823.  
  824. ESX.TriggerServerCallback('program-casino:addVaultWeapon', function()
  825. OpenPutWeaponMenu()
  826. end, data.current.value)
  827.  
  828. end,
  829. function(data, menu)
  830. menu.close()
  831. end
  832. )
  833.  
  834. end
  835.  
  836.  
  837. function OpenPutStocksMenu()
  838.  
  839. ESX.TriggerServerCallback('program-casino:getPlayerInventory', function(inventory)
  840.  
  841. local elements = {}
  842.  
  843. for i=1, #inventory.items, 1 do
  844.  
  845. local item = inventory.items[i]
  846.  
  847. if item.count > 0 then
  848. table.insert(elements, {label = item.label .. ' x' .. item.count, type = 'item_standard', value = item.name})
  849. end
  850.  
  851. end
  852.  
  853. ESX.UI.Menu.Open(
  854. 'default', GetCurrentResourceName(), 'stocks_menu',
  855. {
  856. title = "Ekwipunek",
  857. elements = elements
  858. },
  859. function(data, menu)
  860.  
  861. local itemName = data.current.value
  862.  
  863. ESX.UI.Menu.Open(
  864. 'dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count',
  865. {
  866. title = "Ilość"
  867. },
  868. function(data2, menu2)
  869.  
  870. local count = tonumber(data2.value)
  871.  
  872. if count == nil then
  873. ESX.ShowNotification("Zła ilość")
  874. else
  875. menu2.close()
  876. menu.close()
  877. OpenPutStocksMenu()
  878.  
  879. TriggerServerEvent('program-casino:putStockItems', itemName, count)
  880. end
  881.  
  882. end,
  883. function(data2, menu2)
  884. menu2.close()
  885. end
  886. )
  887.  
  888. end,
  889. function(data, menu)
  890. menu.close()
  891. end
  892. )
  893.  
  894. end)
  895.  
  896. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement