Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p=peripheral.wrap("top")
- file="players"
- function fileToTable(file)
- if fs.exists(file)~=true then
- print("file"..file.." not found")
- return(false)
- end
- fp=fs.open(file,"r")
- line={}
- i=1
- line[i]=fp.readLine()
- if line[i]==nil then return(false) end
- while line[i]~=nil do
- i=i+1
- line[i]=fp.readLine()
- end
- return(line)
- end
- function addPlayer()
- e,player=os.pullEvent("player")
- eingetragen=false
- if fs.exists(file) then
- players=fileToTable(file)
- i=1
- while players[i]~=nil do
- if players[i]==player then
- eingetragen=true
- end
- end
- end
- if eingetragen==false then
- fp=fs.open(file,"a")
- fp.writeLine(player)
- end
- end
Add Comment
Please, Sign In to add comment