Forum

> > CS2D > Scripts > Similar c-4 map vote script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Similar c-4 map vote script

3 replies
To the start Previous 1 Next To the start

old Similar c-4 map vote script

Nooboo2
User Off Offline

Quote
I need a vote for maps like on the server "C-4". Coupled with the fact that when the mode "Standard", "zombie" and all those where you have to wait for the round were written "map was changed to a round end".
Oh yeah, almost forgot: vote "Yes" - F3, "no" - F4.Not voting wrote:the Player said Yes or when special is pressed the player said Yes!!! and the sound of the radio "affrimative", as well as with F4.You also need contrast in colour: for CT - blue, T - red, for the watching yellow for V. I. P - White.

old Re: Similar c-4 map vote script

GeoB99
Moderator Off Offline

Quote
Yeah, such as this.
user VADemon, thread cs2d C4 Map vote script has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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))) .. "|")

function actionVote(id, action)
    if action == 2 then
        votesCurrent = votesCurrent + 1
    elseif action == 3 then
        votesCurrent = votesCurrent - 1
    end
end

addhook("serveraction","actionVote")

Note that the script isn't actually fully finished though. There are some things left out and I guess the serveraction function that I added it may not work properly according to votesCurrent variable. You might want to remove the 7 line till 15 in case if you don't want the vote option to be through F3 (YES) / F4 (NO) (by cs2d lua hook serveraction hook).

old Re: Similar c-4 map vote script

RIP-HereRestsPlookerbooy
BANNED Off Offline

Quote
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

Updated a little it looks like the real one now if you want to use this you need some scripting skills unless this thread is hopeless.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview