Here's a image shows how the script looks like
www.hostingpics.net/viewer.php?id=620205Untitled3.png
Could you help me please with that?
Bye.
Scripts
C4 Map vote script
C4 Map vote script
1

You need a way to vote for/against the next map. F3/F4 or a voting menu, or a chat command.
The white status bar is a
hudtxt which has the following structure:votesRequired = 14 -- how many votes are needed to change map?
votesCurrent = 7 -- 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
print("|".. string.rep("=", math.floor(voteBarLength * (votesCurrent/votesRequired))) .. ">" .. string.rep(" ", math.ceil((voteBarLength+1) * (votesCurrent/votesRequired))) .. "|")
print("|".. string.rep("=", math.floor(voteBarLength * (votesCurrent/votesRequired))) .. ">" .. string.rep(" ", math.ceil((voteBarLength+1) * (votesCurrent/votesRequired))) .. "|")
Mami Tomoe: Yes, as I said above. I've been playing around with this code snippet on http://www.lua.org/demo.html for a few minutes to get it done right.
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
print("|".. string.rep("=", math.floor(voteBarLength * (votesCurrent/votesRequired))) .. ">" .. string.rep(" ", 2* math.ceil(voteBarLength - (voteBarLength) * (votesCurrent/votesRequired))) .. "|")
The HUDTXT became longer with every vote. FIX: voteBarLength - (voteBarLength) in the second string.rep -> the longer the left side (more YES votes), the shorter the right side
Removed (voteBarLength + 1) as it was unnecessary and lead to bugs
2* because spaces has smaller size than =
1
