Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local newPickups = {}
- newPickups.version = "1.0"
- newPickups.blipsToggle = true -- Enable/disable blips function
- newPickups.replenishInterval = 1200000 -- Replenish collected pickups in 20 real time mins
- newPickups.spawnDistance = 50 -- Distance in which player needs to be to spawn point for spawn to occur
- newPickups.addBlipsKey = 79 -- "O" Key
- newPickups.removeBlipsKey = 76 -- "L" Key
- newPickups.log = false
- newPickups.armorLocations = {
- {1969.2553, 3814.6850, 33.4287}, -- Trevor trailer bedroom armor
- {-1150.5280, -1513.1900, 10.6327}, -- Trevor house bedroom armor
- {-811.5554, 175.1262, 76.7453}, -- Micheal house wardrobe armor
- {-18.3880, -1438.5963, 31.1015}, -- Franklin house bedroom armor
- {9.5294, 528.9376, 170.6172}, -- Franklin house 2 wardrobe armor
- {2140.8054, 4788.7373, 40.9702}, -- Mckenzie airfield hangar
- {1721.7912, 3300.5766, 41.2235}, -- Sandy shores hangar
- {246.7264, -50.9556, 69.9411}, -- AMMU Nation Free Pickup
- {-1311.0726, -395.7873, 36.6957}, -- AMMU Nation Free Pickup
- {-659.4631, -940.2515, 21.8292}, -- AMMU Nation Free Pickup
- {839.5900, -1029.0749, 28.1948}, -- AMMU Nation Free Pickup
- {2565.1220, 299.0618, 108.7348}, -- AMMU Nation Free Pickup
- {1699.1580, 3758.4548, 34.7053}, -- AMMU Nation Free Pickup
- {-324.9904, 6082.3271, 31.4547}, -- AMMU Nation Free Pickup
- {-1112.5435, 2696.7958, 18.5541}, -- AMMU Nation Free Pickup
- {-3166.3840, 1088.3576, 20.8387}, -- AMMU Nation Free Pickup
- {-634.1383, -110.2914, 38.0439}, -- Fire Station
- {-2180.3073, 4270.0561, 49.1073}, -- Back of hookies
- {-1599.8572, 5189.6821, 4.3100}, -- Sonar collections dock
- {900.6378, -171.4047, 74.0755}, --- Downtown cab co
- {-218.0942, -1161.9342, 23.0247}, -- Pillbox hill garage
- {-820.85052, -1363.4362, 5.15026664}, -- Puerto del sol marina
- {-1172.5003, -1571.4528, 4.6636}, -- Smoke on the water
- {92.5403, -1292.0668, 29.2687}, -- Trevor office
- {1995.0430, 3777.7578, 32.1808}, -- Sandys gas station
- {1391.1147, 3605.8562, 34.9809}, -- Liquor ace
- {1587.5664, 6449.6806, 25.3171}, -- Up n atom diner
- {718.4716, -964.3821, 30.3787}, -- Lester factory
- {-60.6906, -1098.2280, 26.4236}, -- Simeon car dealer
- }
- newPickups.healthPackLocations = {
- {1961.7957, 3740.7541, 32.3437}, -- Store
- {1697.5661, 4924.8930, 42.0636}, -- Store
- {-3241.7653, 1001.21679, 12.8307}, -- Store
- {-3039.0793, 586.010192, 7.9089}, -- Store
- {-2968.2336, 389.095123, 15.0433}, -- Store
- {-1820.3914, 792.485961, 138.1104}, -- Store
- {-1486.3477, -379.91302, 40.1962}, -- Store
- {-1223.8875, -907.93908, 12.3400}, -- Store
- {-707.47973, -915.19909, 19.2155}, --Store
- {1163.63024, -324.36721, 69.2051467}, -- Store
- {1135.50488, -981.34228, 46.4158058}, -- Store
- {-48.490131, -1757.9393, 29.4209995}, -- Store
- {373.6997, 325.4822, 103.5663}, -- Store
- {102.725982, -4.1181473, 67.6766662}, -- pop's pills
- {1587.5664, 6649.6806, 25.3171}, -- Up n atom diner
- }
- newPickups.armorObjects = {}
- newPickups.armorReplenishTime = {}
- newPickups.armorBlip = {}
- newPickups.healthPackObjects = {}
- newPickups.healthReplenishTime = {}
- newPickups.healthBlip = {}
- function newPickups.unload()
- end
- function newPickups.init()
- print("-----------------------")
- print("New Pickups " .. newPickups.version .. " by darren111")
- print("-----------------------")
- math.randomseed(os.time())
- newPickups.runTime = GAMEPLAY.GET_GAME_TIMER()
- newPickups.armorBlipsSet = false
- newPickups.healthBlipsSet = false
- end
- function newPickups.tick()
- newPickups.currentTime = GAMEPLAY.GET_GAME_TIMER()
- -- Add blips
- if ( newPickups.blipsToggle == true and get_key_pressed(newPickups.addBlipsKey)) then
- newPickups.addArmorBlips()
- newPickups.addHealthBlips()
- end
- -- Remove blips
- if (newPickups.blipsToggle == true and get_key_pressed(newPickups.removeBlipsKey)) then
- newPickups.removeArmorBlips()
- newPickups.removeHealthBlips()
- end
- if((newPickups.currentTime - newPickups.runTime) > 1000) then
- newPickups.playerExists = ENTITY.DOES_ENTITY_EXIST(PLAYER.PLAYER_PED_ID())
- newPickups.runTime = newPickups.currentTime
- if(newPickups.playerExists == true) then
- for i, coords in pairs(newPickups.armorLocations) do
- if(newPickups.armorObjects[i] == nil) then
- if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
- newPickups.armorObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), coords, 100)
- newPickups.armorReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
- newPickups.logAction(newPickups.armorObjects[i] .. " New Armor Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
- end
- else
- if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
- if(ENTITY.DOES_ENTITY_EXIST(newPickups.armorObjects[i]) == false) then
- if(newPickups.currentTime >= newPickups.armorReplenishTime[i]) then
- newPickups.armorObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_ARMOUR_STANDARD"), coords, 100)
- newPickups.armorReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
- newPickups.logAction(newPickups.armorObjects[i] .. " Armor Pickup Replenish x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
- end
- else
- newPickups.armorReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
- end
- end
- end
- end
- for i, coords in pairs(newPickups.healthPackLocations) do
- if(newPickups.healthPackObjects[i] == nil) then
- if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
- newPickups.healthPackObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_HEALTH_STANDARD"), coords, 100)
- newPickups.healthReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
- newPickups.logAction(newPickups.healthPackObjects[i] .. " New Health Pack Pickup Spawned x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
- end
- else
- if(newPickups.getPedDistanceToSpawnPoint(coords) <= newPickups.spawnDistance) then
- if(ENTITY.DOES_ENTITY_EXIST(newPickups.healthPackObjects[i]) == false) then
- if(newPickups.currentTime >= newPickups.healthReplenishTime[i]) then
- newPickups.healthPackObjects[i] = newPickups.createPickup(GAMEPLAY.GET_HASH_KEY("PICKUP_HEALTH_STANDARD"), coords, 100)
- newPickups.healthReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
- newPickups.logAction(newPickups.healthPackObjects[i] .. " Health Pack Pickup Replenish x:" .. coords[1] .. ",y:" .. coords[2] .. ",z:" .. coords[3])
- end
- else
- newPickups.healthReplenishTime[i] = newPickups.currentTime + newPickups.replenishInterval
- end
- end
- end
- end
- end
- end
- end
- function newPickups.createPickup(hash, coords, value)
- return OBJECT.CREATE_AMBIENT_PICKUP(hash, coords[1], coords[2], coords[3], 1, value, hash, true, true)
- end
- function newPickups.getPedDistanceToSpawnPoint(coords)
- local playerPed = PLAYER.GET_PLAYER_PED(-1)
- local playerLocation = ENTITY.GET_ENTITY_COORDS(playerPed, nil)
- return GAMEPLAY.GET_DISTANCE_BETWEEN_COORDS(playerLocation.x, playerLocation.y, playerLocation.z, coords[1], coords[2], coords[3], true)
- end
- function newPickups.addArmorBlips()
- if(newPickups.armorBlipsSet == false) then
- for i, coords in pairs(newPickups.armorLocations) do
- newPickups.armorBlip[i] = UI.ADD_BLIP_FOR_COORD(coords[1], coords[2], coords[3])
- UI.SET_BLIP_SPRITE(newPickups.armorBlip[i], 175)
- UI.SET_BLIP_COLOUR(newPickups.armorBlip[i], 4)
- UI.SET_BLIP_SCALE(newPickups.armorBlip[i], 1)
- UI.SET_BLIP_AS_SHORT_RANGE(newPickups.armorBlip[i], true)
- newPickups.logAction("Map Blip " .. i .. " Added - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
- end
- newPickups.armorBlipsSet = true
- end
- end
- function newPickups.addHealthBlips()
- if(newPickups.healthBlipsSet == false) then
- for i, coords in pairs(newPickups.healthPackLocations) do
- newPickups.healthBlip[i] = UI.ADD_BLIP_FOR_COORD(coords[1], coords[2], coords[3])
- UI.SET_BLIP_SPRITE(newPickups.healthBlip[i], 153)
- UI.SET_BLIP_COLOUR(newPickups.healthBlip[i], 4)
- UI.SET_BLIP_SCALE(newPickups.healthBlip[i], 1)
- UI.SET_BLIP_AS_SHORT_RANGE(newPickups.healthBlip[i], true)
- newPickups.logAction("Map Blip " .. i .. " Added - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
- end
- newPickups.healthBlipsSet = true
- end
- end
- function newPickups.removeArmorBlips()
- if(newPickups.armorBlipsSet == true) then
- for i, v in pairs(newPickups.armorBlip) do
- if(UI.DOES_BLIP_EXIST(v)) then
- UI.REMOVE_BLIP(v)
- end
- coords = newPickups.armorLocations[i]
- newPickups.logAction("Map Blip " .. i .. " Removed - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
- end
- newPickups.armorBlipsSet = false
- end
- end
- function newPickups.removeHealthBlips()
- if(newPickups.healthBlipsSet == true) then
- for i, v in pairs(newPickups.healthBlip) do
- if(UI.DOES_BLIP_EXIST(v)) then
- UI.REMOVE_BLIP(v)
- end
- coords = newPickups.healthPackLocations[i]
- newPickups.logAction("Map Blip " .. i .. " Removed - x:" .. coords[1] .." y:" .. coords[2] .. " z:".. coords[3])
- end
- newPickups.healthBlipsSet = false
- end
- end
- function newPickups.logAction(msg)
- if(newPickups.log) then
- print("[" .. os.date("%c") .. "] newPickups " .. newPickups.version .. ": " .. msg)
- end
- end
- return newPickups
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement