Jump to content

HEEEEELP IMPORTANT


DonOmar

Recommended Posts

That's what i said, try this :

local spawnLocation = { 
    {1954.70984, -1717.59546, 15.96875}, 
    {861.59393, -1284.14832, 14.05591}, 
    {-2037.42590, -2350.11719, 40.89063}, 
    {-2305.93457, 150.06975, 35.31250}, 
    {-1543.31372, 698.40350, 139.27344}, 
} 
  
last_i = 0 
  
function createMysteryBag () 
    local i = math.random ( #spawnLocation ) 
    if ( i == last_i  ) then 
        while ( i == last_i ) do 
            i = math.random ( #spawnLocation ) 
        end 
    end 
    
    local locData = spawnLocation[i] 
    local area = getZoneName(locData[1], locData[2], locData[3]) 
    local city = getZoneName(locData[1], locData[2], locData[3], true) 
    bag = createPickup(locData[1], locData[2], locData[3], 3, 1550) 
    bagBlip = createBlipAttachedTo(bag, 37) 
    exports.CORtexts:output("A Mystery Bag has appeared at "..area..", "..city..", go and get it!", getRootElement(), 0, 255, 0) 
end 
addEventHandler("onResourceStart", resourceRoot, createMysteryBag) 
  
  
addEventHandler("onPickupHit", root, function(player) 
    if source == bag then 
        if getElementType(player) == "player" then 
            if isPedInVehicle(player) then return end 
                randomCash = math.random(1000, 100000) 
                randomHP = math.random(5, 15) 
                randomArmour = math.random(5, 20) 
                randomGun = math.random(22, 34) 
                randomAmmo = math.random(100, 500) 
                local iron = getElementData(player, "iron") or 0 
                local oil = getElementData(player, "oil") or 0 
                local randomiron = math.random(20, 100) 
                local randomoil = math.random(20, 200) 
                local randomoil = math.random(50, 300) 
                exports.CORtexts:output("You have found $"..tostring(randomCash)..", "..tostring(randomArmour).."% Armour, "..tostring(randomHP).."% Health and a "..getWeaponNameFromID(randomGun).." with "..tostring(randomAmmo).." Ammo! "..tostring(randomiron).." iron "..tostring(randomoil).." oil!", player, 0, 255, 0) 
                givePlayerMoney(player, randomCash) 
                setElementData(player, "iron", iron+randomiron) 
                setElementData(player, "oil", oil+randomoil) 
                setPedArmor(player, getPedArmor(player) + randomArmour) 
                setElementHealth(player, getElementHealth(player) + randomHP) 
                giveWeapon(player, randomGun, randomAmmo) 
                destroyElement( bag ) 
                destroyElement(bagBlip) 
                setTimer ( createMysteryBag, 5000, 1) 
        end 
    end 
end ) 
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...