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
votesRequired = 14 -- how many votes are needed to change map?
votesCurrent = 0 -- current YES votes. You could also take NO votes into account and change the math accordingly
voteBarLength = 12 -- how long the HUDTXT bar will be
function actionVote(id, action)
if action == 2 then
votesCurrent = votesCurrent + 1
elseif action == 3 then
votesCurrent = votesCurrent - 1
end
	if votesCurrent > votesRequired then
		votesCurrent = votesRequired
	elseif votesCurrent < 0 then
		votesCurrent = 0
	end
	local finishs = ">" if votesCurrent == votesRequired then finishs = "=" end
	msg2(id,"|".. string.rep("=", math.floor(voteBarLength * (votesCurrent/votesRequired)))..finishs..string.rep(" ", 2*math.ceil(voteBarLength - (voteBarLength) * (votesCurrent/votesRequired))) .. "| "..votesCurrent)
end
addhook("serveraction","actionVote")
addhook("always","AlwaysVote")
function AlwaysVote()
	votesRequired = #player(0,"table")
end