1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function add_newbies()
local file = 0
local report_l = 0
local steamid = 0
local nick = 0
	for i = 1, 32 do
		if player(i,'exists') then
			steamid = steam(i)
			nick = name(i)
			if steamid ~= 0 then
				if member_data(steamid,1) == 0 then
					file = io.open("sys/ranks/areports.txt", "ab")
					if not file then msg('©255100100Internal error: Could not read "sys/ranks/areports.txt"') return end
					report_l = 'A-'..nick..'-'..steamid
					file:write(report_l,'\r\n')
					file:close()
					msg('©200200200OMG a Newbie! '..player(i,'name')..' earns newbie bonus: ©100255100+1500©200200200 rank points!')
				end
			end
		end
	steamid = 0
	end
run_calculator()
end
What happens with this code: I always get the new player message but for some reason I have to run this function twice or several times before it actually appends the report_l. I also never see Error report that I added, so it opens file but doesn't write to it?
Why doesn't it work correctly?
File append often does not work
1 
Offline
Yates