Forum

> > CS2D > Scripts > Invisible menu
Forums overviewCS2D overview Scripts overviewLog in to reply

English Invisible menu

17 replies
To the start Previous 1 Next To the start

old Invisible menu

alluclone1
User Off Offline

Quote
Hi guys
I know how to make invisible menu
example: menu(id,"Select class@i,Soldier")
but how do i make buttons?

old Re: Invisible menu

DragonAwper
User Off Offline

Quote
Oh yeah, u can access the buttons w/ numbers
Example

-----Menu-----
1. Open Door
2. Close Door
---------------

When u open the menu u press the number of the button and it will work

When i press 1 a door will open emulating a click on the button 1
When i press 2 a door will Close emulating a click on the button 2

old Re: Invisible menu

alluclone1
User Off Offline

Quote
can you make example

Edit: yes if i press button it will press it but how do i make custom buttons i see thems?
edited 1×, last 12.03.11 11:22:06 am

old Re: Invisible menu

DragonAwper
User Off Offline

Quote
If the menu is invisible, the buttons don't will appear, i don't understand what you want to do,

It you want HUD Buttons you can create with hudtxt nad mouse3 movements and clicks.

So, explain best what do u want.

> Sorry for this but it's more easy you create e Basic Menu.

old Re: Invisible menu

Kiffer-Opa
User Off Offline

Quote
1
menu(id,"Select class@i,Soldier")

Yeah, if your menu is invisible, this means there appears nothing automatically on the player's screen by just calling this cs2d lua cmd menu function.
But the player's client still behaves as there were a menu. Instead of clicking buttons, the player must press a key from [0] to [9] to select a menu item. This also means, the player can't shoot while the menu's open, just like in a visible menu.

[0] is always available, it closes the menu. [Esc] also closes the menu. The first button is selected with [1], the second with [2], the ninth with [9].

You can still use cs2d cmd hudtxt2 or cs2d lua cmd image (and co.) to draw something on the player's screen, making the menu visible again but on your own way.
I highly suggest this, because otherwise you could cause confusion because the player can't shoot as long none of the number keys or [Esc] was pressed.

old Re: Invisible menu

DragonAwper
User Off Offline

Quote
No, it's so Easy
This is a small hudtxt Menu.

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
men = 2

addhook ("parse","menu") 
function menu(cmd)
if cmd=="otm" and men==2 then 
men = 1
parse ("sv_sound2 1 weapons/click.wav")
parse ("sv_fow 1")
parse ('hudtxt2 1 1 "©000255000Fow On" 320 240 0')
parse ('hudtxt2 1 2 "©255000000Fow Off" 320 250 0')
elseif cmd=="otm" and men==1 then
men = 2
parse ("sv_sound2 1 weapons/click.wav")
parse ("sv_fow 0")
parse ('hudtxt2 1 1 "©255000000Fow On" 320 240 0')
parse ('hudtxt2 1 2 "©000255000Fow Off" 320 250 0')
end
end

addhook ("spawn","initial")
function initial(id)
if id==1 then
men = 2
parse ('hudtxt2 1 1 "©255000000Fow On" 320 240 0')
parse ('hudtxt2 1 2 "©255000000Fow Off" 320 250 0')
end
end

addhook ("spawn","themenu")
function themenu(p)
parse ("bind mouse3 otm")
end

>When u click the Mouse3 the FOW will be changed and the menu will appear on the center of your screen

I hope it's help you

old Re: Invisible menu

DragonAwper
User Off Offline

Quote
Tested and Working
When u press F2 a hudtxt menu will appear, press F2 again to change the fow

Press F3 to Close the Menu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
men = 2

addhook ("serveraction","menu") 
function menu(id,action)
if action==1 and men==2 then 
men = 1
parse ("sv_sound2 1 weapons/click.wav")
parse ("sv_fow 1")
parse ('hudtxt2 1 1 "©000255000Fow On" 320 240 0')
parse ('hudtxt2 1 2 "©255000000Fow Off" 320 250 0')
elseif action==2 then
parse ('hudtxt2 1 1 "" 320 240 0')
parse ('hudtxt2 1 2 "" 320 250 0')
else 
men = 2
parse ("sv_sound2 1 weapons/click.wav")
parse ("sv_fow 0")
parse ('hudtxt2 1 1 "©255000000Fow On" 320 240 0')
parse ('hudtxt2 1 2 "©000255000Fow Off" 320 250 0')
end
end

old Re: Invisible menu

DragonAwper
User Off Offline

Quote
Yeah.
I have an Idea for you.

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
men = 2

addhook ("serveraction","menu")
function menu(id,action)
if action==1 and men==2 then
men = 1
parse ("sv_sound2 1 weapons/click.wav")
parse ("sv_fow 1")
parse ('hudtxt2 1 1 "©000255000Soldier" 320 240 0')
parse ('hudtxt2 1 2 "©255000000Awper" 320 250 0')
elseif action==2 then
parse ('hudtxt2 1 1 "" 320 240 0')
parse ('hudtxt2 1 2 "" 320 250 0')
else
men = 2
parse ("sv_sound2 1 weapons/click.wav")
parse ("sv_fow 0")
parse ('hudtxt2 1 1 "©255000000Soldier" 320 240 0')
parse ('hudtxt2 1 2 "©000255000Awper" 320 250 0')
end
end

addhook("spawn","chooseclass")
function chooseclass(id)
if (men==1) then
return "40,80";
elseif (men==2) then
return "35";
end
end

illegalNot Tested
√Probably it works.

When u spawn u be the lest change u changed on the menu
the changed thing is the green.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview