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
p_buildings = {};
addhook("build", "void_build");
addhook("buildattempt", "int_buildattempt");
addhook("spawn", "void_spawn");
--increment build counter when building is successfull
function void_build(id)
	if (p_buildings[id] == nil) then p_buildings[id] = -1; end
	p_buildings[id] = p_buildings[id] + 1;
end
--prevent money loss on build failure.
--prevent player from building when: player building count > 2
function int_buildattempt(id)
	if (player(id, "team") == 2) then return 0; end --Cts dürfen immer bauen!
	if (p_buildings[id] == nil or p_buildings[id] < 2) then
		return 0;
	else	
		msg2(id, "Du hast eindeutig Krebs");
	end
	return 1;
end
--reset building count on (re)spawn
function void_spawn(id)
	p_buildings[id] = 0;
end