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
---------------------------------------------
---------- Construction ver 1.2 -------------
---------------------------------------------
Player = {}
parse("mp_supply_items 52,69,49,10,34,22,77,72,82")
parse("sv_gm 2")
parse('mp_building_limit "dispenser" 3')
parse('mp_building_limit "turret" 7')
parse('mp_building_limit "supply" 2')
parse('mp_building_limit "gate field" 15')
addhook("join","onjoin")
function onjoin(id)
Player[id] = {}
Player[id].metal = 0
Player[id].cash = 0
Player[id].t1 = 0
Player[id].t2 = 0
Player[id].t3 = 0
Player[id].g = 0
Player[id].sl = 0
end
addhook("spawn","onspawn")
function onspawn(id)
	Player[id].metal = 5
	parse("setmaxhealth "..id.." 175")
	parse("speedmod "..id.." 10")
	parse("equip "..id.." 74")
	parse("setmoney "..id.." 10000")
end
addhook("menu","gimmestuff")
function gimmestuff(id,t,b)
	if t=="Buildings Menu" then
		if b==1 then
			Player[id].t1 = 1
			Player[id].t2 = 0
			Player[id].t3 = 0
			Player[id].g = 0
			msg2(id,"You are now building ©255000000Turret")
		elseif b==2 then
			Player[id].t1 = 0
			Player[id].t2 = 1
			Player[id].t3 = 0
			Player[id].g = 0
			msg2(id,"You are now building ©255000000Double Turret")
		elseif b==3 then
			Player[id].t1 = 0
			Player[id].t2 = 0
			Player[id].t3 = 1
			Player[id].g = 0
			msg2(id,"You are now building ©255000000Triple Turret")
		elseif b==4 then
			Player[id].t1 = 0
			Player[id].t2 = 0
			Player[id].t3 = 0
			Player[id].g = 1
			msg2(id,"You are now building ©255000000Gate")
		end
	elseif t=="Shop" then
		if b==1 then
			if Player[id].cash > 49 then
				Player[id].cash = Player[id].cash - 50
				Player[id].metal = Player[id].metal + 1
			else
				msg2(id,"You dont have enough cash")
			end
		elseif b==2 then
			if Player[id].cash > 149 then
				Player[id].cash = Player[id].cash - 150
				parse("equip "..id.." 51")
			else
				msg2(id,"You dont have enough cash")
			end
		elseif b==3 then
			if Player[id].cash > 74 then
				Player[id].cash = Player[id].cash - 75
				parse("equip "..id.." 80")
			else
				msg2(id,"You dont have enough cash")
			end
		elseif b==4 then
			if Player[id].cash > 399 then
				Player[id].cash = Player[id].cash - 400
				Player[id].sl = Player[id].sl + 1
			else
				msg2(id,"You dont have enough cash")
			end
		end
	end
end
addhook("movetile","moving")
function moving(id,x,y)
	if Player[id].sl > 0 then
		if hp < 30 then
			parse("sethealth "..id.." "..maxhp)
			Player[id].sl = Player[id].sl - 1
		end
	end
end
addhook("projectile","projectileeffects")
function projectileeffects(id,wep,x,y)
	if wep == 51 then
		for i=1,14 do
			timer(500*i, "parse", "explosion "..x.." "..y.." 96 107 "..id)
		end
	end
end
addhook("kill","getstuff")
function getstuff(id,victim,wep,x,y)
	if player(id,"team") ~= player(victim,"team") then
		Player[id].cash = Player[id].cash + 25
	end
end
addhook("die","woosh")
function woosh(id,kill,wep,x,y)
	for k, v in pairs(object(0, 'table')) do
		if object(v, 'player') == id and (object(v, 'type') == 12 or object(v, 'type') == 11 or object(v, 'type') == 8 or object(v, 'type') == 6) then
			parse('killobject '.. v)
		end
	end
end
addhook("second","hud")
function hud()
	for _, id in pairs(player(0,"tableliving")) do
		parse("hudtxt2 "..id.." 1 \"Cash : "..Player[id].cash.."\" 80 80 0 ")
		parse("hudtxt2 "..id.." 2 \"Metal : "..Player[id].metal.."\" 80 100 0 ")
	end
end
	
addhook("serveraction","pressthebutton")
function pressthebutton (id,b)
local hp = player(id,"health")
local maxhp = player(id,"maxhealth")
local spd = player(id,"speedmod")
local ap = player(id,"armor")
local team = player(id,"team")
local tilex = player(id,"tilex")
local tiley = player(id,"tiley")
local wep = player(id,"weapontype")
local cash2 = player(id,"money")
	if b==1 then
		menu(id,"Buildings Menu,Build Turret,Build Double Turret,Build Triple Turret,Build Gate")
	elseif b==2 then
		menu(id,"Shop,Metal +1|50 Cash,Explosion He|150 Cash,Armor|75 Cash,Life +1|400 Cash")
	elseif b==3 then
		if Player[id].t1 == 1 then
			if Player[id].metal > 0 then
				Player[id].metal = Player[id].metal - 1
				parse("spawnobject 8 "..(tilex+1).." "..(tiley+1).." 0 0 "..team.." "..id)
			else
				msg2(id,"You dont have enough metal")
			end
		elseif Player[id].t2 == 1 then
			if Player[id].metal > 1 then
				Player[id].metal = Player[id].metal - 2
				parse("spawnobject 11 "..(tilex-1).." "..(tiley).." 0 0 "..team.." "..id)
			else
				msg2(id,"You dont have enough metal")
			end
		elseif Player[id].t3 == 1 then
			if Player[id].metal > 3 then
				Player[id].metal = Player[id].metal - 4
				parse("spawnobject 12 "..(tilex+1).." "..(tiley).." 0 0 "..team.." "..id)
			else
				msg2(id,"You dont have enough metal")
			end
		elseif Player[id].g == 1 then
			if Player[id].metal > 1 then
				Player[id].metal = Player[id].metal - 2
				parse("spawnobject 6 "..(tilex+1).." "..(tiley+1).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex-1).." "..(tiley+1).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex+1).." "..(tiley-1).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex-1).." "..(tiley-1).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex).." "..(tiley+1).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex+1).." "..(tiley).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex-1).." "..(tiley).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex).." "..(tiley-1).." 0 0 "..team.." "..id)
				parse("spawnobject 6 "..(tilex).." "..(tiley).." 0 0 "..team.." "..id)
			else
				msg2(id,"You dont have enough metal")
			end
		end
	end
end