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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
function Array(size,value) 	local array = {} 	for i = 1, size do 		array[i]=value 	end 	return array end function totable(t,match) 	local cmd = {} 	if not match then match = "[^%s]+" end 	for word in string.gmatch(t, match) do 		table.insert(cmd, word) 	end 	return cmd end cs_exp = Array(32,0) cs_level = Array(32,0) cs_req = Array(32,0) function cs_msg(clr,txt) 	msg("©"..clr..""..txt) end function cs_msg2(id,clr,txt) 	msg2(id,"©"..clr..""..txt) end function SaveUser(id,UsgnID) 	local UsgnID = player(id,"usgn") 	file = io.open("sys/lua/save/"..UsgnID..".txt","w") or io.tmpfile() 	local text = "" 	text = tostring(cs_exp[id]) 	text = text.." "..cs_level[id] 	file:write(text) 	file:close() end function LoadUser(id,file) 	local UsgnID = player(id,"usgn") 	local file = io.open("sys/lua/save/"..UsgnID..".txt","r") 	if file then 		cs_msg2(id,"032096255","Logged In as "..UsgnID.." @C") 		cs_msg2(id,"000255000","Load Succesfully!") 		for line in file:lines() do local parses = totable(line) 		 local userExp=tonumber(parses[1]) 		if userExp ~= nil then cs_exp[id]= userExp 		end 		if (tonumber(parses[2])~=nil) then cs_level[id]=tonumber(parses[2]) 		end 		end 	else 		cs_msg2(id,"032096255","Logged In as "..UsgnID.." @C") 		cs_msg2(id,"255000000","Load Fail!") 	end end function hudtext2(id,tid,color,txt,x,y) local toprint = ("©"..color.." "..txt) parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y) end function ExpInfo(id) 	if id~=nil then 		hudtext2(id, 26,"255255255"," -Exp: "..cs_exp[id].."/"..cs_req[id].." -Level: "..cs_level[id].."/25",5,430) 	end end addhook("join","d_join") function d_join(id) cs_exp[id]=0 cs_level[id]=1 cs_req[id]=2120 if player(id,"usgn") ~= 0 then LoadUser(id,file) end end addhook("leave","d_leave") function d_leave(id) if player(id,"usgn") ~= 0 then SaveUser(id,UsgnID) end cs_exp[id]=0 cs_level[id]=1 cs_req[id]=2120 end addhook("spawn","rv_spawn") function cs_spawn(id) ExpInfo(id) end addhook("second","expsecond") function expsecond() for _,id in ipairs(player(0,"tableliving")) do cs_exp[id]=cs_exp[id]+1 ExpInfo(id) end end addhook("ms100","d_update") function d_update() name = player(id,"name") for id=1,32 do 		if player(id,'exists') then 			if cs_exp[id]<=2120 then --0 				cs_level[id] = 1 				cs_req[id] = 2120 			end 			if cs_exp[id]>=2120 then --50 				cs_level[id] = 2 				cs_req[id] = 3180 			end 			if cs_exp[id]>=3180 then --60 				cs_level[id] = 3 				cs_req[id] = 4240 			end 			if cs_exp[id]>=4240 then --70 				cs_level[id] = 4 				cs_req[id] = 5300 			end 			if cs_exp[id]>=5300 then --80 				cs_level[id] = 5 				cs_req[id] = 6360 		msg("©255255255"..name.." is now level 5.") 		rp_money[pl]=rp_money[pl]+50000 			end 			if cs_exp[id]>=6360 then --90 				cs_level[id] = 6 				cs_req[id] = 7420 			end 			if cs_exp[id]>=7420 then --100 				cs_level[id] = 7 				cs_req[id] = 8480 			end 			if cs_exp[id]>=8480 then --110 				cs_level[id] = 8 				cs_req[id] = 9540 			end 			if cs_exp[id]>=9540 then --120 				cs_level[id] = 9 				cs_req[id] = 10600 			end 			if cs_exp[id]>=10600 then --130 				cs_level[id] = 10 				cs_req[id] = 11660 		msg("©255255255"..name.." is now level 10.") 		rp_money[pl]=rp_money[pl]+100000 			end 			if cs_exp[id]>=11660 then --140 				cs_level[id] = 11 				cs_req[id] = 12720 			end 			if cs_exp[id]>=12720 then --150 				cs_level[id] = 12 				cs_req[id] = 13780 			end 			if cs_exp[id]>=13780 then --160 				cs_level[id] = 13 				cs_req[id] = 14840 			end 			if cs_exp[id]>=14840 then --170 				cs_level[id] = 14 				cs_req[id] = 15900 			end 			if cs_exp[id]>=15900 then --180 				cs_level[id] = 15 				cs_req[id] = 16960 		msg("©255255255"..name.." is now level 15.") 		rp_money[pl]=rp_money[pl]+150000 			end 			if cs_exp[id]>=16960 then --190 				cs_level[id] = 16 				cs_req[id] = 18020 			end 			if cs_exp[id]>=18020 then --200 				cs_level[id] = 17 				cs_req[id] = 19080 			end 			if cs_exp[id]>=19080 then --210 				cs_level[id] = 18 				cs_req[id] = 20140 			end 			if cs_exp[id]>=20140 then --220 				cs_level[id] = 19 				cs_req[id] = 21200 			end 			if cs_exp[id]>=21200 then --230 				cs_level[id] = 20 				cs_req[id] = 22260 		msg("©255255255"..name.." is now level 20.") 		rp_money[pl]=rp_money[pl]+200000 			end 			if cs_exp[id]>=22260 then --240 				rv_level[id] = 21 				rv_req[id] = 23320 			end 			if cs_exp[id]>=23320 then --250 				cs_level[id] = 22 				cs_req[id] = 24380 			end 			if cs_exp[id]>=24380 then --260 				cs_level[id] = 23 				cs_req[id] = 25440 			end 			if cs_exp[id]>=25440 then --270 				cs_level[id] = 24 				cs_req[id] = 26500 			end 			if cs_exp[id]>=26500 then --280 				cs_level[id] = 25 				cs_req[id] = Max 				msg("©255255255"..name.." is now level 25 and have been rewarded with a VIP rank.") 		rp_money[pl]=rp_money[pl]+250000 	 rp_license[pl]=2 rp_vip[pl]=1 updatehud(pl) fname = "sys/lua/IF/vip.txt" file = io.open(fname, "a") file:write(player(pl, "usgn").."\n") file:close() gmsg2(pl,"255255000","[Server]: \169000255000You are now a VIP User.") 			end 		end 	end 	ExpInfo(id) end
Error:
1
2
3
4
2
3
4
LUA ERROR: sys/lua/autorun/exp.lua:108: bad argument #1 to 'player' (number expected, got nil) -> [C]: in function 'player' -> sys/lua/autorun/exp.lua:108: in function <sys/lua/autorun/exp.lua:107>