Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- players={}
- os.loadAPI('ip')
- ip.open()
- ip.getIP()
- p=peripheral.wrap('bottom')
- function health()
- while true do
- for name,player in pairs(players) do
- if player.time>0 then
- -- player.pl.heal(20)
- player.time=player.time-1
- else
- player.pl.sendChat(name..', time out!')
- players[name]=nil
- end
- end
- sleep(1)
- end
- end
- function check()
- while true do
- local event,name=os.pullEvent("player_logout")
- players[name]=nil
- end
- end
- t=30
- function craftnet()
- while true do
- name=ip.receive()
- pl=p.getPlayerByName(name)
- if pl then
- pl.sendChat(name..', you are deathless for '..t..' seconds!')
- players[name]={pl=pl,time=t}
- file=io.open('health.log','a')
- file:write(name..'\n')
- file:close()
- end
- end
- end
- parallel.waitForAll(health,check,craftnet)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement