daily pastebin goal
66%
SHARE
TWEET

Rifbot Fishing

w9s66v09c8x5o1fl3p0 Jan 11th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.     Script Name:        Fishing
  3.     Description:        Go fishing :) personally love this.
  4.     Author:             Ascer - example
  5. ]]
  6.  
  7. local MAIN_DELAY = {1500, 2900}  -- miliseconds use fishing rod time
  8. local FISHING_ROD = 3483         -- fishing rod id
  9. local WATER_TILES =   {4597,4598,4599,4600, 4601, 4602, 4609} --{617, 618, 619, 620, 621}  {4597, 4598, 4599, 4600, 4601, 4602} -- ids of water fields
  10.  
  11. -- DONT'T EDIT BELOW THIS LINE
  12.  
  13. local selfloc, fishingPos = Self.Position(), {}
  14.  
  15. Module.New("fishing", function (mod)
  16.     if Self.isConnected() then
  17.         local pos = Self.Position()
  18.         local load = false
  19.        
  20.         -- check if postion changed or fishingPos table is empty.
  21.         if ((pos.x ~= selfloc.x) or (pos.y ~= selfloc.y) or (pos.z ~= selfloc.z)) or table.count(fishingPos) == 0  then
  22.             load = true
  23.             selfloc = Self.Position() -- set last position
  24.         end
  25.        
  26.         if load then -- load a new tiles
  27.             fishingPos = {} -- reset fishing pos
  28.             local map = Map.getArea(7) -- load map is CPU eatable function be careful with using it.   
  29.             for i, square in pairs(map) do
  30.                 if square.amount == 1  then -- check only for tile contains 1 item
  31.                     local items = square.items
  32.                     for j, item in pairs(items) do
  33.                         if table.find(WATER_TILES, item.id) then
  34.                             table.insert(fishingPos, {x = square.x, y = square.y, z = square.z})
  35.                         end
  36.                     end
  37.                 end
  38.             end
  39.         end
  40.  
  41.         -- set random tile to fish.
  42.         if table.count(fishingPos) > 0 then
  43.             local tile = fishingPos[math.random(1, table.count(fishingPos))]
  44.             Self.UseItemWithGround(FISHING_ROD, tile.x, tile.y, tile.z, 100) -- use fishing rod.
  45.         end
  46.  
  47.     end
  48.     mod:Delay(MAIN_DELAY[1], MAIN_DELAY[2]) -- set random delay
  49. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top