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
--------------------------------------------------
-- These are settings
build = {}
fastbuild = true -- true for turn on fast build
limit = true -- true for limiting fast build buildings
if fastbuild then cost_money = false end -- true for costing money
if fastbuild then upgraded = true end -- true for upgraded buildings
--------------------------------------------------
if limit then addhook("join", "_j") end
if fastbuild then addhook("buildattempt", "_build") end
--------------------------------------------------
buildings = { -- name, limit, price, health, [final building](Do not change this), building type(Do not change this)
[1] = {"Barricade", "999", "300", "150", 1};
[2] = {"Barbed Wire", "999", "500", "300", 2};
[3] = {"Wall I", "999", "1000", "500", "5", 3};
[4] = {"Wall II", "999", "2000", "1000", "5", 4};
[5] = {"Wall III", "999", "3000", "2000", 5};
[6] = {"Gate Field", "999", "1500", "1000", 6};
[7] = {"Dispenser", "5", "5000", "1000", 7};
[8] = {"Turret", "50", "5000", "100", "12", 8};
[9] = {"Supply", "15", "5000", "1000", "15", 9};
[13] = {"Teleporter Entrance", "3", "3000", "500", 13};
[14] = {"Teleporter Exit", "3", "3000", "500", 14};
}
for _, func in pairs(buildings) do
parse ('mp_building_limit "'..func[1]..'" '..func[2])
parse ('mp_building_price "'..func[1]..'" '..func[3])
parse ('mp_building_health "'..func[1]..'" '..func[4])
end
--------------------------------------------------
-- These are main code
function _j(p)
	if limit then build[p] = {}
		for _, b in pairs(buildings) do
			build[p][b[#b]] = tonumber(b[2])
		end
	end
end
if fastbuild then
	function _build(p, t, x, y, m)
		if t == 20 or t == 21 then
		 return 0
		end
		if limit then if build[p][t] == 0 then
		 msg2(p, "\169255000000You cannot build this type of building any more!")
		 return 1
		end
	end
	if cost_money then
		local money = player(p, "money")
		if money < tonumber(buildings[t][3]) then
		 return 0
		end
		local money = player(p, "money") - buildings[t][3]
		parse ("setmoney "..p.." "..money) end
		if not upgraded then
		 parse ("spawnobject "..t.." "..x.." "..y.." 0 "..m.." "..player(p, "team").." "..p)
		else
		 parse ("spawnobject "..buildings[t][5].." "..x.." "..y.." 0 "..m.." "..player(p, "team").." "..p)
		end
		if limit then
		 build[p][t] = build[p][t] - 1
		end
		return 1
	end
end