Advertisement
Guest User

Untitled

a guest
Aug 21st, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.06 KB | None | 0 0
  1. local newPickups = {}
  2. newPickups.version = "1.0"
  3. newPickups.blipsToggle = true -- Enable/disable blips function
  4. newPickups.replenishInterval = 1200000 -- Replenish collected pickups in 20 real time mins
  5. newPickups.spawnDistance = 50 -- Distance in which player needs to be to spawn point for spawn to occur
  6. newPickups.addBlipsKey = 79 -- "O" Key
  7. newPickups.removeBlipsKey = 76 -- "L" Key
  8. newPickups.log = false
  9. newPickups.armorLocations = {
  10. {1969.2553, 3814.6850, 33.4287}, -- Trevor trailer bedroom armor
  11. {-1150.5280, -1513.1900, 10.6327}, -- Trevor house bedroom armor
  12. {-811.5554, 175.1262, 76.7453}, -- Micheal house wardrobe armor
  13. {-18.3880, -1438.5963, 31.1015}, -- Franklin house bedroom armor
  14. {9.5294, 528.9376, 170.6172}, -- Franklin house 2 wardrobe armor
  15. {2140.8054, 4788.7373, 40.9702}, -- Mckenzie airfield hangar
  16. {1721.7912, 3300.5766, 41.2235}, -- Sandy shores hangar
  17. {246.7264, -50.9556, 69.9411}, -- AMMU Nation Free Pickup
  18. {-1311.0726, -395.7873, 36.6957}, -- AMMU Nation Free Pickup
  19. {-659.4631, -940.2515, 21.8292}, -- AMMU Nation Free Pickup
  20. {839.5900, -1029.0749, 28.1948}, -- AMMU Nation Free Pickup
  21. {2565.1220, 299.0618, 108.7348}, -- AMMU Nation Free Pickup
  22. {1699.1580, 3758.4548, 34.7053}, -- AMMU Nation Free Pickup
  23. {-324.9904, 6082.3271, 31.4547}, -- AMMU Nation Free Pickup
  24. {-1112.5435, 2696.7958, 18.5541}, -- AMMU Nation Free Pickup
  25. {-3166.3840, 1088.3576, 20.8387}, -- AMMU Nation Free Pickup
  26. {-634.1383, -110.2914, 38.0439}, -- Fire Station
  27. {-2180.3073, 4270.0561, 49.1073}, -- Back of hookies
  28. {-1599.8572, 5189.6821, 4.3100}, -- Sonar collections dock
  29. {900.6378, -171.4047, 74.0755}, --- Downtown cab co
  30. {-218.0942, -1161.9342, 23.0247}, -- Pillbox hill garage
  31. {-820.85052, -1363.4362, 5.15026664}, -- Puerto del sol marina
  32. {-1172.5003, -1571.4528, 4.6636}, -- Smoke on the water
  33. {92.5403, -1292.0668, 29.2687}, -- Trevor office
  34. {1995.0430, 3777.7578, 32.1808}, -- Sandys gas station
  35. {1391.1147, 3605.8562, 34.9809}, -- Liquor ace
  36. {1587.5664, 6449.6806, 25.3171}, -- Up n atom diner
  37. {718.4716, -964.3821, 30.3787}, -- Lester factory
  38. {-60.6906, -1098.2280, 26.4236}, -- Simeon car dealer
  39. }
  40. newPickups.healthPackLocations = {
  41. {1961.7957, 3740.7541, 32.3437}, -- Store
  42. {1697.5661, 4924.8930, 42.0636}, -- Store
  43. {-3241.7653, 1001.21679, 12.8307}, -- Store
  44. {-3039.0793, 586.010192, 7.9089}, -- Store
  45. {-2968.2336, 389.095123, 15.0433}, -- Store
  46. {-1820.3914, 792.485961, 138.1104}, -- Store
  47. {-1486.3477, -379.91302, 40.1962}, -- Store
  48. {-1223.8875, -907.93908, 12.3400}, -- Store
  49. {-707.47973, -915.19909, 19.2155}, --Store
  50. {1163.63024, -324.36721, 69.2051467}, -- Store
  51. {1135.50488, -981.34228, 46.4158058}, -- Store
  52. {-48.490131, -1757.9393, 29.4209995}, -- Store
  53. {373.6997, 325.4822, 103.5663}, -- Store
  54. {102.725982, -4.1181473, 67.6766662}, -- pop's pills
  55. {1587.5664, 6649.6806, 25.3171}, -- Up n atom diner
  56.  
  57. }
  58.  
  59. newPickups.armorObjects = {}
  60. newPickups.armorReplenishTime = {}
  61. newPickups.armorBlip = {}
  62. newPickups.healthPackObjects = {}
  63. newPickups.healthReplenishTime = {}
  64. newPickups.healthBlip = {}
  65.  
  66. function newPickups.unload()
  67. end
  68.  
  69. function newPickups.init()
  70. print("-----------------------")
  71. print("New Pickups " .. newPickups.version .. " by darren111")
  72. print("-----------------------")
  73. math.randomseed(os.time())
  74. newPickups.runTime = GAMEPLAY.GET_GAME_TIMER()
  75. newPickups.armorBlipsSet = false
  76. newPickups.healthBlipsSet = false
  77. end
  78.  
  79. function newPickups.tick()
  80. newPickups.currentTime = GAMEPLAY.GET_GAME_TIMER()
  81.  
  82. -- Add blips
  83. if ( newPickups.blipsToggle == true and get_key_pressed(newPickups.addBlipsKey)) then
  84. newPickups.addArmorBlips()
  85. newPickups.addHealthBlips()
  86. end
  87.  
  88. -- Remove blips
  89. if (newPickups.blipsToggle == true and get_key_pressed(newPickups.removeBlipsKey)) then
  90. newPickups.removeArmorBlips()
  91. newPickups.removeHealthBlips()
  92. end
  93.  
  94. if((newPickups.currentTime - newPickups.runTime) > 1000) then
  95. newPickups.playerExists = ENTITY.DOES_ENTITY_EXIST(PLAYER.PLAYER_PED_ID())
  96. newPickups.runTime = newPickups.currentTime
  97.  
  98. if(newPickups.playerExists == true) then
  99. for i, coords in pairs(newPickups.armorLocations) do
  100. if(newPickups.armorObjects[i] == nil) then
  101. if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
  102. newPickups.armorObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), coords, 100)
  103. newPickups.armorReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
  104. newPickups.logAction(newPickups.armorObjects[i] .. " New Armor Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
  105. end
  106. else
  107. if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
  108. if(ENTITY.DOES_ENTITY_EXIST(newPickups.armorObjects[i]) == false) then
  109. if(newPickups.currentTime >= newPickups.armorReplenishTime[i]) then
  110. newPickups.armorObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), coords, 100)
  111. newPickups.armorReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
  112. newPickups.logAction(newPickups.armorObjects[i] .. " Armor Pickup Replenish x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
  113. end
  114. else
  115. newPickups.armorReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
  116. end
  117. end
  118. end
  119. end
  120. for i, coords in pairs(newPickups.healthPackLocations) do
  121. if(newPickups.healthPackObjects[i] == nil) then
  122. if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
  123. newPickups.healthPackObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_HEALTH_STANDARD"), coords, 100)
  124. newPickups.healthReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
  125. newPickups.logAction(newPickups.healthPackObjects[i] .. " New Health Pack Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
  126. end
  127. else
  128. if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
  129. if(ENTITY.DOES_ENTITY_EXIST(newPickups.healthPackObjects[i]) == false) then
  130. if(newPickups.currentTime >= newPickups.healthReplenishTime[i]) then
  131. newPickups.healthPackObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_HEALTH_STANDARD"), coords, 100)
  132. newPickups.healthReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
  133. newPickups.logAction(newPickups.healthPackObjects[i] .. " Health Pack Pickup Replenish x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
  134. end
  135. else
  136. newPickups.healthReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
  137. end
  138. end
  139. end
  140. end
  141. end
  142. end
  143. end
  144.  
  145. function newPickups.createPickup(hash, coords, value)
  146. return OBJECT.CREATE_AMBIENT_PICKUP(hash, coords[1], coords[2], coords[3], 1, value, hash, true, true)
  147. end
  148.  
  149. function newPickups.getPedDistanceToSpawnPoint(coords)
  150. local playerPed = PLAYER.GET_PLAYER_PED(-1)
  151. local playerLocation = ENTITY.GET_ENTITY_COORDS(playerPed, nil)
  152. return GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerLocation.x, playerLocation.y, playerLocation.z, coords[1], coords[2], coords[3], true)
  153. end
  154.  
  155. function newPickups.addArmorBlips()
  156. if(newPickups.armorBlipsSet == false) then
  157. for i, coords in pairs(newPickups.armorLocations) do
  158. newPickups.armorBlip[i] = UI.ADD_BLIP_FOR_COORD(coords[1], coords[2], coords[3])
  159. UI.SET_BLIP_SPRITE(newPickups.armorBlip[i], 175)
  160. UI.SET_BLIP_COLOUR(newPickups.armorBlip[i], 4)
  161. UI.SET_BLIP_SCALE(newPickups.armorBlip[i], 1)
  162. UI.SET_BLIP_AS_SHORT_RANGE(newPickups.armorBlip[i], true)
  163.  
  164. newPickups.logAction("Map Blip " .. i .. " Added - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
  165. end
  166.  
  167. newPickups.armorBlipsSet = true
  168. end
  169. end
  170.  
  171. function newPickups.addHealthBlips()
  172. if(newPickups.healthBlipsSet == false) then
  173. for i, coords in pairs(newPickups.healthPackLocations) do
  174. newPickups.healthBlip[i] = UI.ADD_BLIP_FOR_COORD(coords[1], coords[2], coords[3])
  175. UI.SET_BLIP_SPRITE(newPickups.healthBlip[i], 153)
  176. UI.SET_BLIP_COLOUR(newPickups.healthBlip[i], 4)
  177. UI.SET_BLIP_SCALE(newPickups.healthBlip[i], 1)
  178. UI.SET_BLIP_AS_SHORT_RANGE(newPickups.healthBlip[i], true)
  179.  
  180. newPickups.logAction("Map Blip " .. i .. " Added - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
  181. end
  182.  
  183. newPickups.healthBlipsSet = true
  184. end
  185. end
  186.  
  187. function newPickups.removeArmorBlips()
  188. if(newPickups.armorBlipsSet == true) then
  189. for i, v in pairs(newPickups.armorBlip) do
  190. if(UI.DOES_BLIP_EXIST(v)) then
  191. UI.REMOVE_BLIP(v)
  192. end
  193.  
  194. coords = newPickups.armorLocations[i]
  195. newPickups.logAction("Map Blip " .. i .. " Removed - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
  196. end
  197.  
  198. newPickups.armorBlipsSet = false
  199. end
  200. end
  201.  
  202. function newPickups.removeHealthBlips()
  203. if(newPickups.healthBlipsSet == true) then
  204. for i, v in pairs(newPickups.healthBlip) do
  205. if(UI.DOES_BLIP_EXIST(v)) then
  206. UI.REMOVE_BLIP(v)
  207. end
  208.  
  209. coords = newPickups.healthPackLocations[i]
  210. newPickups.logAction("Map Blip " .. i .. " Removed - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
  211. end
  212.  
  213. newPickups.healthBlipsSet = false
  214. end
  215. end
  216.  
  217. function newPickups.logAction(msg)
  218. if(newPickups.log) then
  219. print("[" .. os.date("%c") .. "] newPickups " .. newPickups.version .. ": " .. msg)
  220. end
  221. end
  222.  
  223. return newPickups
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement