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
function array(v)
	local a = {}
	for i = 1, 32 do
		a[i] = v
	end
	return a;
end
plr = {}
plr.voted = array(false)
plr.menuTable = array(0)
function addVote(id, vote)
	if not plr.voted[id] then
		plr.voted[id] = vote
	end
end
function allVotes()
	local a = 0
	for i = 1, 32 do
		if plr.voted[i] then
			a = a + 1
		end
	end
	return a;
end
function votedMaps()
	local a = {}
	for i = 1, 32 do
		if a[plr.voted[i]] then
			a[plr.voted[i]] = a[plr.voted[i]] + 1
		else
			a[plr.voted[i]] = 1
		end
	end
	return a;
end
function checkVotes()
	local table, votes, i = votedMaps(), allVotes(), 1
	local newTable = {}
	for k, v in pairs(table) do
		newTable[i] = {name = k, votes = v, percent = math.ceil(table[i] / votes * 100)}
		i = i + 1
	end
	plr.menuTable[id] = newTable
	return newTable;
end
function generateVotingMenu(id)
	local table, string = checkVotes(), ''
	for i = 1, #table do
		string = string..','..table[i].percent..'% - '..table[i].votes..' votes|'..table[i].name
	end
	menu(id, Voting'..string)
end
function serveractionHook(id, action)
	if action == 1 then
		generateVotingMenu(id)
	end
end
function menu(id, title, button)
	if title == 'Voting' then
		--got bored
	end
end