Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local CLOCK
- local gptimer=os.clock()-.40
- local energyring=3051
- local energyring_active=3088
- local normalring=3048
- local percenthp=85
- local checkspeed=.1
- local oldnum=0
- local oldslot=0
- function auto_energyring()
- CLOCK=os.clock()
- if (CLOCK-gptimer<checkspeed) then return 0; end
- gptimer=CLOCK
- if (self.hp<(percenthp*self.hpmax)/100 and self.ring~=energyring) then
- local gp=FindItem(energyring)
- if (gp~=nil) then
- ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,energyring,1)
- oldnum=gp.num
- oldslot=gp.slot
- gptimer=CLOCK+.4
- end
- return
- end
- if (self.hp>self.hpmax-10 and self.ring==energyring_active and normalring>0) then
- local gp=FindItem(normalring)
- if (gp~=nil) then
- ThrowItemCtoI(gp.num,gp.slot,SLOT_RING,normalring,1)
- end
- return
- end
- if (self.hp>self.hpmax-20 and self.ring==energyring_active and normalring==0) then
- print("unloading")
- ThrowItemItoC(SLOT_RING,oldnum,oldslot,energyring_active,1)
- gptimer=CLOCK+1
- end
- end
- SetTimerCallback("auto_energyring")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement