Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sc=peripheral.wrap("left")
- se=peripheral.wrap("right")
- function scan(s,mode)
- entity={}
- entity.item={}
- entity.mob={}
- entity.player={}
- entity.minecart={}
- entity.itemFrame={}
- if mode==nil then
- mode="all"
- end
- if mode=="mob" or mode=="all" then
- mobs=s.getEntityIds("mob")
- for i=1, #mobs do
- data=nil
- data=s.getEntityData(mobs[i],"mob")
- if data~=nil then
- entity.mob[#entity.mob+1]=data.all()
- else
- entity.mob[#entity.mob+1]="lost"
- end
- end
- end
- if mode=="item" or mode=="all" then
- items=s.getEntityIds("item")
- for i=1, #items do
- data=nil
- data=s.getEntityData(items[i],"item")
- if data~=nil then
- entity.item[#entity.item+1]=data.all()
- else
- entity.item[#entity.item+1]="lost"
- end
- end
- end
- if mode=="player" or mode=="all" then
- players=s.getPlayers()
- for i=1, #players do
- data=nil
- data=s.getPlayerByName(players[i].name)
- if data~=nil then
- entity.player[#entity.player+1]=data.all()
- inv=entity.player[#entity.player].player.inventory
- for i2=1, 40 do
- if inv[i2]~=nil then
- fp=fs.open("temp","w")
- itemp=#entity.player
- i2temp=i2
- error=true
- fp.write("entity.player[itemp].player.inventory[i2temp]=inv[i2temp].all() error=false")
- fp.close()
- shell.run("temp")
- shell.run("rm temp")
- if error then
- entity.player[itemp].player.inventory[i2temp]=nil
- end
- end
- end
- else
- entity.player[#entity.player+1]="lost"
- end
- end
- end
- if mode=="minecart" or mode=="all" then
- minecarts=s.getEntityIds("minecart")
- for i=1, #minecarts do
- data=nil
- data=s.getEntityData(minecarts[i],"minecart")
- if data~=nil then
- entity.minecart[#entity.minecart+1]=data.all()
- else
- entity.minecart[#entity.minecart+1]="lost"
- end
- end
- end
- if mode=="frame" or mode=="all" then
- itemFrames=s.getEntityIds("item_frame")
- for i=1, #itemFrames do
- data=nil
- data=s.getEntityData(itemFrames[i],"item_frame")
- if data~=nil then
- entity.itemFrame[#entity.itemFrame+1]=data.all()
- else
- entity.itemFrame[#entity.itemFrame+1]="lost"
- end
- end
- end
- return entity
- end
- while true do
- scan(se,"player")
- for i=1,#entity.player do
- sc.clearText(tostring(i))
- sc.setText(tostring(i),entity.player[i].name..": ",0xffffff)
- krass=#entity.player[i].player.inventory
- color=0x00ff00
- if entity.player[i].name == "ecco7777" then
- krass=500
- color=0xff0000
- end
- for i2=1,krass do
- sc.addText(tostring(i),"!",color)
- end
- end
- sleep(1)
- end
Add Comment
Please, Sign In to add comment