Forum

> > CS2D > Scripts > Button press
Forums overviewCS2D overview Scripts overviewLog in to reply

English Button press

5 replies
To the start Previous 1 Next To the start

old Button press

Suprise
BANNED Off Offline

Quote
When you press Button(serveraction 3) then a menu:(
1
menu(id,"Select map,bla,bla,bla,bla")
) activated and player never can press it again. And nobody can press it again.

So:
Player1 pressed F4 . He voted for the map. He and all players never can press F4 again. (They can but doesnt do anything)

( I hope you understand me ! )
Thx in advance !

old Re: Button press

Avo
User Off Offline

Quote
1
2
3
4
5
6
7
8
pressed=false
addhook("serveraction","_action")
function _action(id,a)
	if pressed==false and a==3 then
		pressed=true
		--your code here
	end
end

old Re: Button press

Cons
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("serveraction","vote")
function vote(id,act)
if act==3 then
menu(id,"Vote For Map,Map1,Map2,Map3,Map4")
end
end

addhook("menu","nowthemenu")
function nowthemenu(id,title,buton)
if title=="Vote" then
if buton==1 then
msg("©255255255"..player(id,"name").." Voted For Map1")
freehook("serveraction","vote")
end
end
end

More >

old Re: Button press

Suprise
BANNED Off Offline

Quote
both working fine. Thank you for helping

EDIT: Can you edit it that map will change to 'map1' at the endround?

EDIT2: I did that.

EDIT3: Heey. This works only whit the first button. second and third doesnt work (Dresa's)
Nvm Bolt_PL your code is work perfectly.
edited 2×, last 15.05.12 07:32:09 pm

old Re: Button press

Cons
User Off Offline

Quote
user Suprise has written
EDIT3: Heey. This works only whit the first button. second and third doesnt work (Dresa's)


Doesnt work?

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
addhook("serveraction","vote")
function vote(id,act)
if act==3 then
menu(id,"Vote For Map,Map1,Map2,Map3,Map4")
end
end

addhook("menu","nowthemenu")
function nowthemenu(id,title,buton)
if title=="Vote For Map" then
if buton==1 then
msg("©255255255"..player(id,"name").." Voted For Map1")
freehook("serveraction","vote")
elseif buton==2 then
msg("©255255255"..player(id,"name").." Voted For Map2")
freehook("serveraction","vote")
elseif buton==3 then
msg("©255255255"..player(id,"name").." Voted For Map3")
freehook("serveraction","vote")
elseif buton==4 then
msg("©255255255"..player(id,"name").." Voted For Map4")
freehook("serveraction","vote")
end
end
end

Are you Sure?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview