Forum

> > CS2D > Scripts > C4 Map vote script
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch C4 Map vote script

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Re: C4 Map vote script

RIP-HereRestsPlookerbooy
BANNED Off Offline

Zitieren
Heh,I saw it many times and I have script better than it,but, i didn't think that peoples here don't know how to do this lua.I just thought that they can easily do it and I am the only one who don't know how to..Anyway why can't anyone give me some hints is that hard?

alt Re: C4 Map vote script

VADemon
User Off Offline

Zitieren
• 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 cs2d cmd hudtxt which has the following structure:
1
2
3
4
5
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))) .. "|")

If you want a further explanation on the status bar code, feel free to ask. It looks clunky in it's finished form

alt Re: C4 Map vote script

Mami Tomoe
User Off Offline

Zitieren
1
print("|".. string.rep("=", math.floor(voteBarLength * (votesCurrent/votesRequired))) .. ">" .. string.rep(" ", math.ceil((voteBarLength+1) * (votesCurrent/votesRequired))) .. "|")

is that meant to be a hudtxt?

alt Re: C4 Map vote script

VADemon
User Off Offline

Zitieren
Fixed code:
1
2
3
4
5
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× editiert, zuletzt 22.01.16 16:57:26
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht