Nelsonnn

Untitled

Oct 21st, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.95 KB | None | 0 0
  1. spawnLocations = {
  2. {1882.5,-2537.1001,13.2},
  3. {2566.6001,-644.29999,136.39999},
  4. {1119.89941,-2142.39941,70},
  5. {1941.90002,-533,18.8},
  6. {810.90002,-772,79.9},
  7. {208.2,-1545.5,30.9},
  8. {-447.29999,-2494.30005,117.1},
  9. {354.7998,-2072.69922,10.4},
  10. {-1826.90002,-2641.3999,54.9},
  11. {-1234.5,-2323.19922,18.6},
  12. {-2600.30005,-2756.6001,2.7},
  13. {-2242,-1739,479.60001},
  14. {-1970.90002,-539.40002,35},
  15. {-1480.40002,145.5,18.4},
  16. {-1422.40002,1492.69995,6.8},
  17. {-802.5,2442.69995,159.60001},
  18. {788.20001,890,19.1},
  19. {350.59961,2436.7998,17.1},
  20. {1716,1619.30005,13.2},
  21. {2333.80005,1261.19995,67.1},
  22. {2619.30005,2721.5,36.2},
  23. {2871.2998,134.39941,9.8},
  24. {1342,2138.1001,10.7},
  25. {169.7,-324.70001,9.2},
  26. {542.59961,242.09961,15.1},
  27. {-1083.19995,-1090.40002,128.89999},
  28. {-2215.8999,2315.1001,7.2},
  29. {-969.90002,1347,35.8},
  30. {-2046.09998,2941.69995,60.2},
  31. {186,651.5,1.7},
  32. {2311.80005,-8,32.2},
  33. }
  34.  
  35. lootItems = {
  36. {"M4",50},
  37. {"CZ 550",50},
  38. {"Winchester 1866",50},
  39. {"SPAZ-12 Combat Shotgun",50},
  40. {"Sawn-Off Shotgun",50},
  41. {"AK-47",50},
  42. {"Lee Enfield",50},
  43. {"M1911",50},
  44. {"M9 SD",50},
  45. {"PDW",50},
  46. {"MP5A5",50},
  47. {"Desert Eagle",50},
  48. {"Hunting Knife",50},
  49. {"Hatchet",50},
  50. {"Baseball Bat",50},
  51. {"Shovel",50},
  52. {"Golf Club",50},
  53. {"Parachute",50},
  54. {"Tear Gas",50},
  55. {"Grenade",50},
  56. {"Binoculars",50},
  57. {"Water Bottle",50},
  58. {"Pasta Can",50},
  59. {"Beans Can",50},
  60. {"Burger",50},
  61. {"Pizza",50},
  62. {"Soda Bottle",50},
  63. {"Milk",50},
  64. {"Cooked Meat",50},
  65. {"Wood Pile",50},
  66. {"Bandage",50},
  67. {"Roadflare",50},
  68. {"Empty Gas Canister",50},
  69. {"Full Gas Canister",50},
  70. {"Medic Kit",50},
  71. {"Heat Pack",50},
  72. {"Painkiller",50},
  73. {"Morphine",50},
  74. {"Blood Bag",50},
  75. {"Wire Fence",50},
  76. {"Raw Meat",50},
  77. {"Tire",50},
  78. {"Engine",50},
  79. {"Tank Parts",50},
  80. {"Tent",50},
  81. {"Camouflage Clothing",50},
  82. {"Civilian Clothing",50},
  83. {"Survivor Clothing",50},
  84. {"Ghillie Suit",50},
  85. {"Empty Water Bottle",50},
  86. {"Empty Soda Cans",50},
  87. {"Scruffy Burgers",50},
  88. {"Assault Pack (ACU)",50},
  89. {"Alice Pack",50},
  90. {"Czech Backpack",50},
  91. {"Coyote Backpack",50},
  92. {"Night Vision Goggles",50},
  93. {"Infrared Goggles",50},
  94. {"Map",50},
  95. {"Box of Matches",50},
  96. {"Watch",50},
  97. {"GPS",50},
  98. {"Toolbox",50},
  99. {"Radio Device",50},
  100. }
  101.  
  102. function math.percentChance(percent,repeatTime)
  103.   local hits = 0
  104.   for i = 1,repeatTime do
  105.     local number = math.random(1,1000)/10
  106.     if number <= percent then
  107.       hits = hits+1
  108.     end
  109.   end
  110.   return hits
  111. end
  112.  
  113. respawnAirdropTimer = false
  114. function spawnAirdrop(player)
  115.   if isElement(player) and not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then
  116.     return
  117.   end
  118.   if isElement(productq) then
  119.     destroyElement(productq)
  120.   end
  121.   if isElement(avialColq) then
  122.     destroyElement(avialColq)
  123.   end
  124.   if isElement(blipq) then
  125.     destroyElement(blipq)
  126.   end
  127.   if isTimer(respawnAirdropTimer)then
  128.     killTimer(respawnAirdropTimer)
  129.   end
  130.   respawnAirdropTimer = setTimer(spawnAirdrop,1800000,1)
  131.   local item_id = math.random(1,#spawnLocations)
  132.   xq,yq,zq = spawnLocations[item_id][1],spawnLocations[item_id][2],spawnLocations[item_id][3]-0.16
  133.   xpsq,ypsq,zpsq = xq,yq,zq+7,3
  134.   xpvq,ypvq,zpvq = xq-48,yq-16,zq+37
  135.   xsbq,ysbq,zsbq = xq-48,yq-16,zq+41
  136.   xssq,yssq,zssq = xq-528,yq+2,zq+141
  137.   xsdq,ysdq,zsdq = xq+528,yq+2,zq+141
  138.   blipq = createBlip(xq,yq,zq,5)
  139.   aviaNavaq = createObject(1683,xssq,yssq,zssq,0,0,0)
  140.   moveObject(aviaNavaq,8000,xsbq,ysbq,zsbq)
  141.   setTimer(function()
  142.     parasProdq = createObject(2903,xpvq,ypvq,zpvq,0,0,0)
  143.     moveObject(aviaNavaq,8000,xsdq,ysdq,zsdq)
  144.     moveObject(parasProdq,15000,xpsq,ypsq,zpsq)
  145.     triggerClientEvent("playAirdropSound",getRootElement())
  146.   end,8000,1)
  147.   setTimer(destroyElement,16100,1,aviaNavaq)
  148.   setTimer(function()
  149.     destroyElement(parasProdq)
  150.     productq = createObject(2919,xq,yq,zq,0,0,0)
  151.     setElementFrozen(productq,true)
  152.     avialColq = createColSphere(xq,yq,zq,2)
  153.     attachElements(avialColq,productq,0,0,0)
  154.     setElementData(avialColq,"parent",object)
  155.     setElementData(avialColq,"hospitalbox",true)
  156.     setElementData(avialColq,"MAX_Slots",0)
  157.     for i,item in pairs(lootItems)do
  158.       local value =  math.percentChance(item[2],1)
  159.       if value >= 1 then
  160.         setElementData(avialColq,item[1],value)
  161.         local ammoData,weapID = getWeaponAmmoType(item[1],true)
  162.         if ammoData then
  163.           local minBullets,maxBullets = math.floor(getAmmoPlus(ammoData)/3),getAmmoPlus(ammoData)*2
  164.           local ammoQuantity = math.random(minBullets,maxBullets)
  165.           setElementData(avialColq,ammoData,ammoQuantity)
  166.         end
  167.       end
  168.     end
  169.   end,23100,1)
  170. end
  171. spawnAirdrop()
  172. addCommandHandler("spawnairdrop",spawnAirdrop)
  173.  
  174. addCommandHandler("removeairdrop",function(player)
  175.   if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then
  176.     return
  177.   end
  178.   if isElement(productq) then
  179.     destroyElement(productq)
  180.   end
  181.   if isElement(avialColq) then
  182.     destroyElement(avialColq)
  183.   end
  184.   if isElement(blipq) then
  185.     destroyElement(blipq)
  186.   end
  187.   if isTimer(respawnAirdropTimer)then
  188.     killTimer(respawnAirdropTimer)
  189.   end
  190. end)
Advertisement
Add Comment
Please, Sign In to add comment