Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local newPickups = {}
- newPickups.replenishInterval = 10000 --15 mins
- newPickups.version = "1.0"
- newPickups.armorLocations = {
- {1970.9019, 3819.0972, 33.4287},
- {6.0652, 520.5510, 174.6278},
- {-17.0625, -1430.479, 31.1015},
- {-816.3046, 178.4772, 76.7453},
- {-1146.893, 1511.565, 10.6327}
- }
- newPickups.vehicleArmorLocations = {
- {0}
- }
- newPickups.armorObjects = {}
- function newPickups.unload()
- end
- function newPickups.init()
- print("=======================")
- print("New Pickups " .. newPickups.version .. " by Daz")
- print("=======================")
- math.randomseed(os.time())
- newPickups.firstRun = true
- newPickups.spawnPickups = true
- newPickups.checkTime = GAMEPLAY.GET_GAME_TIMER()
- end
- function newPickups.tick()
- newPickups.currentTime = GAMEPLAY.GET_GAME_TIMER()
- newPickups.playerExists = ENTITY.DOES_ENTITY_EXIST(PLAYER.PLAYER_PED_ID())
- if (newPickups.playerExists == true) then
- if ((newPickups.currentTime - newPickups.checkTime) > newPickups.replenishInterval) then
- newPickups.checkTime = newPickups.currentTime
- newPickups.spawnPickups = true
- end
- if (newPickups.spawnPickups == true) then
- if (newPickups.firstRun) then
- for i, coords in pairs(newPickups.armorLocations) do
- --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)
- newPickups.armorObjects[i] =
- OBJECT.CREATE_PICKUP(
- GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"),
- coords[1],
- coords[2],
- coords[3],
- 0,
- 1,
- false,
- GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD")
- )
- OBJECT.PLACE_OBJECT_ON_GROUND_PROPERLY(newPickups.armorObjects[i])
- newPickups.firstRun = false
- newPickups.logAction(
- tostring(newPickups.armorObjects[i]) ..
- " New Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3]
- )
- end
- else
- for i, coords in pairs(newPickups.armorLocations) do
- if (OBJECT.DOES_PICKUP_EXIST(newPickups.armorObjects[i]) == true) then
- --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
- --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)
- newPickups.armorObjects[i] =
- OBJECT.CREATE_PICKUP(
- GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"),
- coords[1],
- coords[2],
- coords[3],
- 0,
- 1,
- false,
- GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD")
- )
- OBJECT.PLACE_OBJECT_ON_GROUND_PROPERLY(newPickups.armorObjects[i])
- newPickups.logAction(
- tostring(newPickups.armorObjects[i]) ..
- " New Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3]
- )
- else
- newPickups.logAction(
- "Pickup Already Exists At x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3]
- )
- end
- end
- end
- newPickups.spawnPickups = false
- end
- end
- end
- function newPickups.logAction(msg)
- print("[" .. os.date("%c") .. "] newPickups " .. newPickups.version .. ": " .. msg)
- end
- return newPickups
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement