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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
addhook("ms100","SZ_Hud")
addhook("kill","SZ_kill")
addhook("leave","SZ_leave")
addhook("join","SZ_join")
function initArray(m)
	local array = {}
		for i = 1, m do
			array[i]=0
		end
return array
end
function string.split(text,b)
local cmd = {}
if b then
b = b
else
b = "%s"
end
b = "[^"..b.."]+"
for o in string.gmatch(text,b) do
table.insert(cmd,o)
end
return cmd
end
playerip=initArray(32)
usgn=initArray(32)
level=initArray(32)
points=initArray(32)
Exper=initArray(32)
Cor=initArray(32)
points2=initArray(32)
money=initArray(32)
function Exist(location)
local f=io.open(location)
if f~=nil then
io.close(f)
end
return f~=nil
end
function _Save(i)
Status(i)
	if usgn[i] >0 then
		 io.output(io.open("sys/lua/Level System/"..usgn[i]..".xx","w+"))
io.write(level[i].." "..points[i].." "..points2[i].." "..money[i])
io.close()
		print("©000255000Save Clonclued")
	else
		io.output(io.open("sys/lua/Level System/"..playerip[i]..".xx","w+"))
io.write(level[i].." "..points[i].." "..points2[i].." "..money[i])
io.close()
		print("©000255000Save Clonclued")
	end
end	
function _Load(i)
		if Exist("sys/lua/Level System/"..usgn[i]..".xx") then
			for line in io.lines("sys/lua/Level System/"..usgn[i]..".xx") do
				line = line:split()
				local n1 = tonumber(line[1])
				local n2 = tonumber(line[2])
				local n3 = tonumber(line[2])
local n4 = tonumber(line[4])
					level[i]=n1
					points[i] = n2
					points2[i]=n3
money[i]=n4
					msg2(i,"©000255000Load Concluded@C")
			end
		
		elseif Exist("sys/lua/Level System/"..playerip[i]..".xx") then
			for line in io.lines("sys/lua/Level System/"..playerip[i]..".xx") do
				line = line:split()
				local n1 = tonumber(line[1])
				local n2 = tonumber(line[2])
				local n3 = tonumber(line[2])
local n4 = tonumber(line[4])
					level[i]=n1
					points[i] = n2
					points2[i]=n3
money[i]=n4
					msg2(i,"©000255000Load Concluded@C")
			end
		else
			level[i] = 1
			points[i] = 0
			points2[i] = 80
money[i]=100
			Cor[i] = "255000000"
			msg2(i,"©255255000Not logged in")
		end
Status(i)
end
									-- Start --
function SZ_Hud()
for i = 1,32 do
parse('hudtxt2 '..i..' 1 "©000177255Level :: '..level[i]..'" 13 120 0')
parse('hudtxt2 '..i..' 2 "©000255150Points :: '..points[i]..' / '..points2[i]..'" 13 140 0')
			 parse('hudtxt2 '..i..' 5 "©'..Cor[i]..'EXP :: '..Exper[i]..'" 13 160 0')
parse('hudtxt2 '..i..' 7 "©255000000money :: '..money[i]..'" 13 180 0')
end
end
function SZ_kill(i)
Status(i)
	if (player(i,"weapontype")==50) then
		points[i] = points[i] +40
		msg2(i,"©150255000Kill Bonus X2@C")
	else
	points[i] = points[i] +p
		if points[i] >= points2[i] then	
			points[i] = 0
			level[i] = level[i] +1
			Status(i)
			msg2(i,"©000255000 Level up @C")
			parse('effect "flare" '..player(i,"x")..' '..player(i,"y")..' 5 5 192 192 000')
			parse("sv_sound2 "..i.." levelup.wav")
			msg("©255255000"..player(i,"name").." UP to level "..level[i])
		end
	end
	money[i]=money[i]+50
end
function Status(i)
	if level[i] == 1 and points[i] >= 0 then points2[i] = 100 Exper[i] = "Very Bad" Cor[i] = "255000000" p = 20
	elseif level[i] == 2 and points[i] >= 0 then points2[i] = 180 Exper[i] = "Bad"	Cor[i] = "255100000" p = 20
	elseif level[i] == 3 and points[i] >= 0 then points2[i] = 340 Exper[i] = "Beginner"	Cor[i] = "255200000" p = 20
	elseif level[i] == 4 and points[i] >= 0 then points2[i] = 660 Exper[i] = "Amateur" Cor[i] = "255255000" p = 20
	elseif level[i] == 5 and points[i] >= 0 then points2[i] = 2400 Exper[i] = "Good" Cor[i] = "200255000" p = 20
	elseif level[i] == 6 and points[i] >= 0 then points2[i] = 3800 Exper[i] = "Very Good" Cor[i] = "100255000" p = 20
	elseif level[i] == 7 and points[i] >= 0 then points2[i] = 7200 Exper[i] = "Spectacular" Cor[i] = "000255000" p = 20
	elseif level[i] == 8 and points[i] >= 0 then points2[i] = 14400 Exper[i] = "Incredible" Cor[i] = "255000000" p = 20
	elseif level[i] == 9 and points[i] >= 0 then points2[i] = 28800 Exper[i] = "Expert" Cor[i] = "100255100" p = 20
	elseif level[i] == 10 and points[i] >= 0 then points2[i] = 57600 Exper[i] = "MASTER" Cor[i] = "200255200" p = 10
	elseif level[i] == 11 and points[i] >= 0 then points2[i] = 100000 Exper[i] = "MÁX .." Cor[i] = "255255255" end
end			
function SZ_leave(i)
	_Save(i)
end
function SZ_join(i)
	usgn[i]=player(i,"usgn")
	playerip[i]=player(i,"ip")
	Status(i)
	_Load(i)
end
function getmoney(i)
	return money[i]
end
function setmoney(i, m)
	money[i] = m
	return true
end
function setlvl(i, lvl)
	level[i] = lvl
	return true
end
function addmoney(i, m)
	if m < 0 and getmoney(i)+m < 0 then
		return false
	end
	setmoney(i, getmoney(i)+m)
	return true
end