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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
function Array(value,mz,ez)
	local array = {}
	if not mz then mz = 32 end
	if not ez then ez = 1 end
	for i = ez,mz do
		array[i] = value
	end
	return array
end
money = Array(0)
function toTable(t,match)
	local cmd = {}
	if not match then match = "%s" end
	match = "[^"..match.."]+"
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end
	return cmd
end
function hudtxt(i,txt,x,y,algin)
	if not algin then algin = 0 end
	parse([[hudtxt ]]..i..[[ "]]..txt..[[" ]]..x..[[ ]]..y..[[ ]]..algin)
end
function hudtxt2(id,i,txt,x,y,algin)
	if not algin then algin = 0 end
	parse([[hudtxt2 ]]..id..[[ ]]..i..[[ "]]..txt..[[" ]]..x..[[ ]]..y..[[ ]]..algin)
end
function updatehud(id)
	hudtxt2(id,1,"©000255100Money "..money[id].."$",10,420,0)
end
function save()
	for _,id in ipairs(player(0,"table")) do
		saveslf(id)
	end
end
function saveslf(id)
	local usgn = player(id,"usgn")
	if usgn > 0 then
		local file = assert(io.open("sys/lua/saves/"..usgn..".sav","w"))
		file:write(money[id])
		file:close()
	end
end
function load(id)
	local usgn = player(id,"usgn")
	if usgn > 0 then
		local f = io.open("sys/lua/saves/"..usgn..".sav","r")
		if f ~= nil then
			f:close()
			for lines in io.lines("sys/lua/saves/"..usgn..".sav") do
				money[id] = tonumber(lines)
			end
		end
	end
end
function nom(id)
	msg2(id,"©255000000Not enough money!@C")
end
function menue(id)
	local mon = money[id]
	menu(id,[[Drop Menu@b,100$,500$,1000$,2000$,5000$,10000$,50000$,100000$,Money: ]]..mon..[[$]],1)
end
addhook([[join]],[[joiner]])
function joiner(id)
	load(id)
	updatehud(id)
end
addhook([[say]],[[sayer]])
function sayer(id,txt)
	local cmd = toTable(txt)
	local cmds = string.lower(cmd[1])
	if cmds == [[!drop]] or cmds == [[@drop]] then
		menue(id)
		return 1
	elseif cmds == [[!info]] or cmds == [[@info]] then
		msg2(id,"Name: "..game("sv_name"))
		msg2(id,"Maxplayers: "..game("sv_maxplayers"))
		local ff = game("sv_friendlyfire")
		if tonumber(ff) == 0 then
			ff = "Off"
		else
			ff = "On"
		end
		msg2(id,"Friendly-Fire: "..ff)
		return 1
	elseif cmds == [[!save]] or cmds == [[@save]] then
		saveslf(id)
		return 1
	elseif cmds == [[!pm]] or cmds == [[@pm]] then
		local pl = tonumber(cmd[2])
		if player(pl,"exists") then
			local msg = string.sub(txt,6)
			msg2(pl,"©255255255"..player(id,"name").." -> "..msg.." @C")
		end
		return 1
	end
end
addhook([[serveraction]],[[saca]])
function saca(id,a)
	if a == 1 then
		menue(id)
	end
end
addhook([[menu]],[[menus]])
function menus(id,men,sel)
	local x,y = player(id,"tilex"),player(id,"tiley")
	if men == [[Drop Menu]] then
		local moneys = money[id]
		if sel == 1 then
			if moneys > 99 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 100
				end
				parse([[spawnitem 66 ]]..x..[[ ]]..y)
			else
				nom(id)
			end
		elseif sel == 2 then
			if moneys > 499 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 500
				end
				parse([[spawnitem 67 ]]..x..[[ ]]..y)
			else
				nom(id)
			end
		elseif sel == 3 then
			if moneys > 999 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 1000
				end
				parse([[spawnitem 68 ]]..x..[[ ]]..y)
			else
				nom(id)
			end
		elseif sel == 4 then
			if moneys > 1999 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 2000
				end
				parse([[spawnitem 68 ]]..x..[[ ]]..y)
				parse([[spawnitem 68 ]]..x..[[ ]]..y)
			else
				nom(id)
			end
		elseif sel == 5 then
			if moneys > 4999 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 5000
				end
				for i = 1,5 do
					parse([[spawnitem 68 ]]..x..[[ ]]..y)
				end
			else
				nom(id)
			end
		elseif sel == 6 then
			if moneys > 9999 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 10000
				end
				for i = 1,10 do
					parse([[spawnitem 68 ]]..x..[[ ]]..y)
				end
			else
				nom(id)
			end
		elseif sel == 7 then
			if moneys > 49999 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 50000
				end
				for i = 1,50 do
					parse([[spawnitem 68 ]]..x..[[ ]]..y)
				end
			else
				nom(id)
			end
		elseif sel == 8 then
			if moneys > 99999 then
				if type(money[id]) ~= "string" then
					money[id] = money[id] - 100000
				end
				for i = 1,100 do
					parse([[spawnitem 68 ]]..x..[[ ]]..y)
				end
			else
				nom(id)
			end
		end
		if sel > 0 and sel < 9 then
			menue(id)
		end
		updatehud(id)
	end
end
addhook([[minute]],[[minuter]])
function minuter()
	for id = 1,game("sv_maxplayers") do
		if player(id,"exists") then
			if type(money[id]) ~= "string" then
				money[id] = money[id] + 500
				updatehud(id)
				saveslf(id)
			end
		end
	end
end
addhook([[ms100]],[[ms100er]])
function ms100er()
	for _,id in pairs(player(0,"table")) do
		if player(id,"money") > 0 then
			if type(money[id]) ~= "string" then
				money[id] = money[id] + player(id,"money")
			end
			parse([[setmoney ]]..id..[[ 0]])
			updatehud(id)
		end
		if type(money[id]) ~= "string" then
			if money[id] < 0 then
				money[id] = 0
				updatehud(id)
			end
		end
	end
end
addhook([[walkover]],[[collecting]])
function collecting(id,iid,types,ain,a,mode)
	if types == 66 then
		if player(id,"money") > 99 then
			parse([[setmoney ]]..id..[[ ]]..player(id,"money") - 100)
			if type(money[id]) ~= "string" then
				money[id] = money[id] + 100
			end
			updatehud(id)
		end
	elseif types == 67 then
		if player(id,"money") > 499 then
			parse([[setmoney ]]..id..[[ ]]..player(id,"money") - 500)
			if type(money[id]) ~= "string" then
				money[id] = money[id] + 500
			end
			updatehud(id)
		end
	elseif types == 68 then
		if player(id,"money") > 999 then
			parse([[setmoney ]]..id..[[ ]]..player(id,"money") - 1000)
			if type(money[id]) ~= "string" then
				money[id] = money[id] + 1000
			end
			updatehud(id)
		end
	end
end
addhook([[leave]],[[leaver]])
function leave(id,reason)
	saveslf(id)
	money[id] = 0
end