datsexyanon

Messy lua

Jul 23rd, 2014
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. function RSGMod()
  2.     local rsg = {}
  3.     local index = 1
  4.    
  5.     --Determine weapon
  6.     local wepIndex = RSWeaponPacks[math.random(#RSWeaponPacks)]
  7.     rsg[index] = RSWeaponPacks[wepIndex].weapon[1]
  8.     index = index + 1
  9.    
  10.     --Add ammo
  11.     if RSWeaponPacks[wepIndex].ammo ~= {} then
  12.         for i=1, math.random(RSWeaponPacks[wepIndex].ammo[2]) do
  13.             rsg[index] = RSWeaponPacks[wepIndex].ammo[1]
  14.             index = index + 1
  15.         end
  16.     end
  17.    
  18.     --Add Bomb items
  19.     local expIndex = RSExplosivePacks[math.random(#RSExplosivePacks)]
  20.     local expNum = math.random(RSExplosivePacks[expIndex].number)
  21.     for i=1, expNum do
  22.         rsg[index] = RSExplosivePacks[expIndex].item[1]
  23.         index = index + 1
  24.     end
  25.    
  26.     --Determine Rare items
  27.     local luckRoll = math.random()
  28.     if luckRoll < 0.25 then --25% chance for extra item
  29.         if luckRoll < 0.05 then --5% chance for rarer item
  30.             local URIndex = math.random(#RSUltraRare)
  31.             for i=1, #RSUltraRare[URIndex]
  32.                 rsg[index] = RSUltraRare[URIndex][i]
  33.                 index = index + 1
  34.             end
  35.         else
  36.             local RIndex = math.random(#RSBonusPacks)
  37.             for i=1, #RSBonusPacks[RIndex] do
  38.                 rsg[index] = RSBonusPacks[RIndex][i]
  39.                 index = index + 1
  40.             end
  41.         end
  42.     end
  43.    
  44.     return rsg
  45. end
Advertisement
Add Comment
Please, Sign In to add comment