Advertisement
w9s66v09c8x5o1fl3p0

Untitled

Jan 21st, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. --[[
  2. Script Name: Wait For Spawn
  3. Description: Logout when spawn is empty and login after x time.
  4. Author: Ascer - example
  5. ]]
  6.  
  7. local SPAWN_MONSTERS = {"rotworm", "troll", "rat"} -- monsters separated by comma we looking.
  8. local SPAWN_RANGE = 7 -- max distane between you and monster default 7 = on screen
  9. local SPAWN_WAIT = 10 -- wait 10 min for spawn (not sure if 10min is enought need to test)
  10.  
  11. -- DON'T EDIT BELOW THIS LINE
  12.  
  13. local logoutTime
  14.  
  15. Module.New("Wait For Spawn", function (mod)
  16. if Self.isConnected() then
  17. local count = 0
  18. local monsters = table.lower(SPAWN_MONSTERS) -- case lower all table with mosters
  19. for i, mob in pairs(Creature.iMonsters(SPAWN_RANGE, false)) do
  20. if table.find(monsters, string.lower(mob.name)) then
  21. count = count + 1
  22. break -- break loop we don't need more here.
  23. end
  24. end
  25. if count == 0 then -- do action only when no monsters
  26. if not Self.isInFight() then
  27. logoutTime = os.clock()
  28. Self.Logout()
  29. wait(500, 1800)
  30. end
  31. end
  32. else
  33. printf("Successfully logout due a no monsters. Relogin for " .. math.floor((SPAWN_WAIT * 60) - (os.clock() - logoutTime)) .. "s." )
  34. wait(800, 1200)
  35. if os.clock() - logoutTime > (60 * SPAWN_WAIT) then
  36. Rifbot.PressKey(13) -- press enter key
  37. end
  38. end
  39. mod:Delay(1500, 3000)
  40. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement