Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nameAmmo = nameAmmo:lower()
- if nameAmmo:find("spear") then useSpear = true else useSpear = false end
- ammoID = Item.GetID(nameAmmo)
- function withdrawAmmo(from, to) -- from : index of backpack in depot/ to: index of backpack in self
- last = Container.GetLast()
- if useSpear then
- to = 0 bid = Self.Weapon().count
- else to= to bid = Self.Ammo().count
- end
- ammoCount = function () return ((Container(to):CountItemsOfID(ammoID)) + bid) end
- EnoughAmmo = false
- function draw()
- while ((last:CountItemsOfID(ammoID)) > 0
- and (ammoCount() < maxAmmo ))
- do last:MoveItemToContainer(0, to, 0, 100) wait(800, 1200)
- end
- end
- if useAmmo and _check("ammodp") then
- print("Current Ammo : " .. ammoCount())
- if not(useSpear) then
- Walker.Stop()
- Self.OpenDepot()
- wait(500, 800)
- last:UseItem(from,true)
- wait(400, 800)
- draw()
- while (ammoCount() < maxAmmo)
- and not(last:isEmpty())
- do
- print("Trying to find more ammo")
- wait(700, 1000)
- last:UseItem(0, true)
- wait(700, 1000)
- draw()
- print("Current Ammo : " .. ammoCount())
- end
- else Self.WithdrawItems(from, {ammoID, to, ammoCount()-maxAmmo}) Walker.Start()
- end
- if (ammoCount() >= maxAmmo) then
- EnoughAmmo = true
- print("Enough ammo, continuing")
- Walker.Start()
- elseif not(EnoughAmmo) then
- print("You don't have enough ammo!, stoping script...")
- Walker.Stop()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement