Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.25 KB | None | 0 0
  1. This is for html/css/ui.css
  2.  
  3. #playerInventoryFastItems {
  4. width: 370px;
  5. height: 50px;
  6. position : absolute;
  7. bottom : -9.4%;
  8. right:-1%;
  9. z-index: 100;
  10. float:left;
  11. }
  12.  
  13. This is for html/js/inventory.js : https://gyazo.com/8ac210b0a423417fa61c87c0de929957
  14.  
  15. $("#playerInventoryFastItems").html("");
  16. var i;
  17. for (i = 1; i < 4 ; i++) {
  18. $("#playerInventoryFastItems").append('<div class="slotFast"><div id="itemFast-' + i + '" class="item" >' +
  19. '<div class="keybind">' + i + '</div><div class="item-count"></div> <div class="item-name"></div> </div ><div class="item-name-bg"></div></div>');
  20. }
  21. $.each(fastItems, function (index, item) {
  22. count = setCount(item);
  23. $('#itemFast-' + item.slot).css("background-image",'url(\'img/items/' + item.name + '.png\')');
  24. $('#itemFast-' + item.slot).html('<div class="keybind">' + item.slot + '</div><div class="item-count">' + count + '</div> <div class="item-name">' + item.label + '</div> <div class="item-name-bg"></div>');
  25. $('#itemFast-' + item.slot).data('item', item);
  26. $('#itemFast-' + item.slot).data('inventory', "fast");
  27. });
  28. makeDraggables()
  29.  
  30. This is for html/ui.html : https://gyazo.com/aa06e09bbc98a5d78f42ad254df09e0d
  31.  
  32. </div>
  33. <div id="playerInventoryFastItems">
  34. </div>
  35.  
  36. This is for html/js/inventory.js : https://gyazo.com/976cd54ded1081a62cbff7c5247a1400
  37.  
  38. inventorySetup(event.data.itemList,event.data.fastItems);
  39.  
  40. This is for html/js/inventory.js : https://gyazo.com/78656c10b8f07637c0f3f3da53f86208
  41.  
  42. function inventorySetup(items,fastItems) {
  43. $("#playerInventory").html("");
  44. $.each(items, function (index, item) {
  45. count = setCount(item);
  46.  
  47. $("#playerInventory").append('<div class="slot"><div id="item-' + index + '" class="item" style = "background-image: url(\'img/items/' + item.name + '.png\')">' +
  48. '<div class="item-count">' + count + '</div> <div class="item-name">' + item.label + '</div> </div ><div class="item-name-bg"></div></div>');
  49. $('#item-' + index).data('item', item);
  50. $('#item-' + index).data('inventory', "main");
  51. });
  52. $("#playerInventoryFastItems").html("");
  53. var i;
  54. for (i = 1; i < 4 ; i++) {
  55. $("#playerInventoryFastItems").append('<div class="slotFast"><div id="itemFast-' + i + '" class="item" >' +
  56. '<div class="keybind">' + i + '</div><div class="item-count"></div> <div class="item-name"></div> </div ><div class="item-name-bg"></div></div>');
  57. }
  58. $.each(fastItems, function (index, item) {
  59. count = setCount(item);
  60. $('#itemFast-' + item.slot).css("background-image",'url(\'img/items/' + item.name + '.png\')');
  61. $('#itemFast-' + item.slot).html('<div class="keybind">' + item.slot + '</div><div class="item-count">' + count + '</div> <div class="item-name">' + item.label + '</div> <div class="item-name-bg"></div>');
  62. $('#itemFast-' + item.slot).data('item', item);
  63. $('#itemFast-' + item.slot).data('inventory', "fast");
  64. });
  65. makeDraggables()
  66.  
  67. }
  68. function makeDraggables(){
  69. $('#itemFast-1').droppable({
  70. drop: function (event, ui) {
  71. itemData = ui.draggable.data("item");
  72. itemInventory = ui.draggable.data("inventory");
  73.  
  74. if (type === "normal" && (itemInventory === "main" || itemInventory === "fast") && itemData.type === "item_weapon") {
  75. disableInventory(500);
  76. $.post("http://esx_inventoryhud/PutIntoFast", JSON.stringify({
  77. item: itemData,
  78. slot : 1
  79. }));
  80. }
  81. }
  82. });
  83. $('#itemFast-2').droppable({
  84. drop: function (event, ui) {
  85. itemData = ui.draggable.data("item");
  86. itemInventory = ui.draggable.data("inventory");
  87.  
  88. if (type === "normal" && (itemInventory === "main" || itemInventory === "fast") && itemData.type === "item_weapon") {
  89. disableInventory(500);
  90. $.post("http://esx_inventoryhud/PutIntoFast", JSON.stringify({
  91. item: itemData,
  92. slot : 2
  93. }));
  94. }
  95. }
  96. });
  97. $('#itemFast-3').droppable({
  98. drop: function (event, ui) {
  99. itemData = ui.draggable.data("item");
  100. itemInventory = ui.draggable.data("inventory");
  101.  
  102. if (type === "normal" && (itemInventory === "main" || itemInventory === "fast") && itemData.type === "item_weapon") {
  103. disableInventory(500);
  104. $.post("http://esx_inventoryhud/PutIntoFast", JSON.stringify({
  105. item: itemData,
  106. slot : 3
  107. }));
  108. }
  109. }
  110. });
  111. }
  112. function secondInventorySetup(items) {
  113. $("#otherInventory").html("");
  114. $.each(items, function (index, item) {
  115. count = setCount(item);
  116.  
  117. $("#otherInventory").append('<div class="slot"><div id="itemOther-' + index + '" class="item" style = "background-image: url(\'img/items/' + item.name + '.png\')">' +
  118. '<div class="item-count">' + count + '</div> <div class="item-name">' + item.label + '</div> </div ><div class="item-name-bg"></div></div>');
  119. $('#itemOther-' + index).data('item', item);
  120. $('#itemOther-' + index).data('inventory', "second");
  121. });
  122.  
  123. }
  124.  
  125. function shopInventorySetup(items) {
  126. $("#otherInventory").html("");
  127. $.each(items, function (index, item) {
  128. //count = setCount(item)
  129. cost = setCost(item);
  130.  
  131. $("#otherInventory").append('<div class="slot"><div id="itemOther-' + index + '" class="item" style = "background-image: url(\'img/items/' + item.name + '.png\')">' +
  132. '<div class="item-count">' + cost + '</div> <div class="item-name">' + item.label + '</div> </div ><div class="item-name-bg"></div></div>');
  133. $('#itemOther-' + index).data('item', item);
  134. $('#itemOther-' + index).data('inventory', "second");
  135. });
  136. }
  137.  
  138. This is for html/js/inventory.js : https://gyazo.com/d9c34bf2ac99b43c0cbf022c7b094291
  139.  
  140. }else if (type === "normal" && itemInventory === "fast") {
  141. disableInventory(500);
  142. $.post("http://esx_inventoryhud/TakeFromFast", JSON.stringify({
  143. item: itemData
  144. }));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement