Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. local CLOCK
  2. local gptimer=os.clock()-.40
  3. local energyring=3051
  4. local energyring_active=3088
  5. local normalring=3048
  6. local percenthp=85
  7. local checkspeed=.1
  8. local oldnum=0
  9. local oldslot=0
  10. function auto_energyring()
  11. CLOCK=os.clock()
  12. if (CLOCK-gptimer<checkspeed) then return 0; end
  13. gptimer=CLOCK
  14. if (self.hp<(percenthp*self.hpmax)/100 and self.ring~=energyring) then
  15. local gp=FindItem(energyring)
  16. if (gp~=nil) then
  17. ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,energyring,1)
  18. oldnum=gp.num
  19. oldslot=gp.slot
  20. gptimer=CLOCK+.4
  21. end
  22. return
  23. end
  24. if (self.hp>self.hpmax-10 and self.ring==energyring_active and normalring>0) then
  25. local gp=FindItem(normalring)
  26. if (gp~=nil) then
  27. ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,normalring,1)
  28. end
  29. return
  30. end
  31. if (self.hp>self.hpmax-20 and self.ring==energyring_active and normalring==0) then
  32. print("unloading")
  33. ThrowItemItoC(SLOT_RING,oldnum,oldslot,energyring_active,1)
  34. gptimer=CLOCK+1
  35. end
  36. end
  37.  
  38.  
  39. SetTimerCallback("auto_energyring")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement