Advertisement
Guest User

Untitled

a guest
Aug 19th, 2022
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. local newPickups = {}
  2. newPickups.replenishInterval = 10000 --15 mins
  3. newPickups.version = "1.0"
  4. newPickups.armorLocations = {
  5. {1970.9019, 3819.0972, 33.4287},
  6. {6.0652, 520.5510, 174.6278},
  7. {-17.0625, -1430.479, 31.1015},
  8. {-816.3046, 178.4772, 76.7453},
  9. {-1146.893, 1511.565, 10.6327}
  10. }
  11.  
  12. newPickups.vehicleArmorLocations = {
  13. {0}
  14. }
  15.  
  16. newPickups.armorObjects = {}
  17.  
  18. function newPickups.unload()
  19. end
  20.  
  21. function newPickups.init()
  22. print("=======================")
  23. print("New Pickups " .. newPickups.version .. " by Daz")
  24. print("=======================")
  25. math.randomseed(os.time())
  26. newPickups.firstRun = true
  27. newPickups.spawnPickups = true
  28. newPickups.checkTime = GAMEPLAY.GET_GAME_TIMER()
  29. end
  30.  
  31. function newPickups.tick()
  32. newPickups.currentTime = GAMEPLAY.GET_GAME_TIMER()
  33. newPickups.playerExists = ENTITY.DOES_ENTITY_EXIST(PLAYER.PLAYER_PED_ID())
  34.  
  35. if (newPickups.playerExists == true) then
  36. if ((newPickups.currentTime - newPickups.checkTime) > newPickups.replenishInterval) then
  37. newPickups.checkTime = newPickups.currentTime
  38. newPickups.spawnPickups = true
  39. end
  40.  
  41. if (newPickups.spawnPickups == true) then
  42. if (newPickups.firstRun) then
  43. for i, coords in pairs(newPickups.armorLocations) do
  44. --newPickups.armorObjects[i] = OBJECT.CREATE_AMBIENT_PICKUP(GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), coords[1], coords[2], coords[3], 0, 0, GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), true, true)
  45. newPickups.armorObjects[i] =
  46. OBJECT.CREATE_PICKUP(
  47. GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"),
  48. coords[1],
  49. coords[2],
  50. coords[3],
  51. 0,
  52. 1,
  53. false,
  54. GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD")
  55. )
  56. OBJECT.PLACE_OBJECT_ON_GROUND_PROPERLY(newPickups.armorObjects[i])
  57. newPickups.firstRun = false
  58. newPickups.logAction(
  59. tostring(newPickups.armorObjects[i]) ..
  60. " New Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3]
  61. )
  62. end
  63. else
  64. for i, coords in pairs(newPickups.armorLocations) do
  65. if (OBJECT.DOES_PICKUP_EXIST(newPickups.armorObjects[i]) == true) then
  66. --if(OBJECT.DOES_PICKUP_OF_TYPE_EXIST_IN_AREA(GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), coords[1], coords[2], coords[3], 5) == false) then
  67. --newPickups.armorObjects[i] = OBJECT.CREATE_AMBIENT_PICKUP(GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), coords[1], coords[2], coords[3], 0, 0, GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), true, true)
  68. newPickups.armorObjects[i] =
  69. OBJECT.CREATE_PICKUP(
  70. GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"),
  71. coords[1],
  72. coords[2],
  73. coords[3],
  74. 0,
  75. 1,
  76. false,
  77. GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD")
  78. )
  79. OBJECT.PLACE_OBJECT_ON_GROUND_PROPERLY(newPickups.armorObjects[i])
  80. newPickups.logAction(
  81. tostring(newPickups.armorObjects[i]) ..
  82. " New Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3]
  83. )
  84. else
  85. newPickups.logAction(
  86. "Pickup Already Exists At x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3]
  87. )
  88. end
  89. end
  90. end
  91.  
  92. newPickups.spawnPickups = false
  93. end
  94. end
  95. end
  96.  
  97. function newPickups.logAction(msg)
  98. print("[" .. os.date("%c") .. "] newPickups " .. newPickups.version .. ": " .. msg)
  99. end
  100.  
  101. return newPickups
  102.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement