How to make a rank, score, reputation saved in 1 file. And how to fix a bug when a player enters the server but stops loading and exits, then his reputation is saved as 0 (Need 20).Spoiler 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
addhook("join","Load_Rank")
function Load_Rank(id)
if player(id, "steamname") ~= "" then
local file = io.open ("sys/lua/saves/"..player(id,"steamname").."_rank.txt","r")
if file then
Rank[id] = file:read("*n")
file:close ()
msg2(id,"\169255255255Profile successfully loaded.")
		 end
		 else
		 Rank[id]=0
end
end
addhook("leave","Save_Rank")
function Save_Rank(id)
if player(id, "steamname") ~= "" then
local file = io.open ("sys/lua/saves/"..player(id,"steamname").."_rank.txt","w")
local Rank = Rank[id]
file:write (Rank.."\n")
file:close ()
	 end
Rank[id]=0
end
addhook("join","Load_Rank2")
function Load_Rank2(id)
if player(id, "steamname") ~= "" then
local file = io.open ("sys/lua/saves/"..player(id,"steamname").."_score.txt","r")
if file then
score = file:read("*n")
			 parse("setscore "..id.." "..score)
file:close ()
		 end
		 else
		 --Rank[id]=0
end
end
addhook("leave","Save_Rank2")
function Save_Rank2(id)
if player(id, "steamname") ~= "" then
local file = io.open ("sys/lua/saves/"..player(id,"steamname").."_score.txt","w")
local c = player(id,"score")
file:write (c.."\n")
file:close ()
end
end
addhook("join","Load_Repka")
function Load_Repka(id)
if player(id, "steamname") ~= "" then
local file = io.open ("sys/lua/saves/"..player(id,"steamname").."_repka.txt","r")
if file then
Reputation[id] = file:read("*n")
file:close ()
		 end
		 else
		 Reputation[id]=20
end
end
addhook("leave","Save_Repka2")
function Save_Repka2(id)
if player(id, "steamname") ~= "" then
local file = io.open ("sys/lua/saves/"..player(id,"steamname").."_repka.txt","w")
local Reputation = Reputation[id]
file:write (Reputation.."\n")
file:close ()
	 end
		 Reputation[id]=20
end
Saving script
1 
Offline