Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.45 KB | None | 0 0
  1. nameAmmo = nameAmmo:lower()
  2. if nameAmmo:find("spear") then useSpear = true else useSpear = false end
  3. ammoID = Item.GetID(nameAmmo)
  4. function withdrawAmmo(from, to) -- from : index of backpack in depot/ to: index of backpack in self
  5.         last = Container.GetLast()
  6.         if useSpear then    
  7.             to = 0 bid = Self.Weapon().count
  8.         else to= to bid = Self.Ammo().count
  9.         end
  10.         ammoCount = function () return ((Container(to):CountItemsOfID(ammoID)) + bid) end
  11.         EnoughAmmo = false
  12.             function draw()
  13.                 while ((last:CountItemsOfID(ammoID)) > 0
  14.                 and (ammoCount() < maxAmmo ))
  15.                     do last:MoveItemToContainer(0, to, 0, 100) wait(800, 1200)
  16.                 end
  17.             end
  18.     if useAmmo and _check("ammodp") then
  19.         print("Current Ammo : " .. ammoCount())
  20.         if not(useSpear) then
  21.             Walker.Stop()
  22.             Self.OpenDepot()
  23.                 wait(500, 800)
  24.             last:UseItem(from,true)
  25.                 wait(400, 800)
  26.                 draw()
  27.             while (ammoCount() < maxAmmo)
  28.                 and not(last:isEmpty())
  29.             do
  30.                 print("Trying to find more ammo")
  31.                     wait(700, 1000)
  32.                 last:UseItem(0, true)
  33.                     wait(700, 1000)
  34.                 draw()
  35.                     print("Current Ammo : " .. ammoCount())
  36.             end
  37.         else Self.WithdrawItems(from, {ammoID, to, ammoCount()-maxAmmo}) Walker.Start()
  38.         end
  39.         if (ammoCount() >= maxAmmo) then
  40.                 EnoughAmmo = true
  41.                     print("Enough ammo, continuing")
  42.                 Walker.Start()
  43.         elseif not(EnoughAmmo) then
  44.                     print("You don't have enough ammo!, stoping script...")
  45.                 Walker.Stop()
  46.         end
  47.     end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement