Forum

> > CS2D > Scripts > Simple menu creation
Forums overviewCS2D overview Scripts overviewLog in to reply

English Simple menu creation

4 replies
To the start Previous 1 Next To the start

old Simple menu creation

kewixasd
User Off Offline

Quote
Hi
I would like to ask
how can I make a smooth menu?
I was thinking that extra menu was a weapon purchase
and some information from the server

Thanks in advance for the answers
or discuss it privately

sorry if the text is not understandable
I'm not English

old Re: Simple menu creation

jerezinho
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook ("serveraction","menu_f2")
addhook("menu", "startmenu")

function menu_f2(id,action)
if action==1 then
menu(id,"Player Menu,Example,Example2")
end
end

function startmenu(id, title, button)
if (title=="Player Menu") then
if button==1 then 
menu(id,"Menu Name,Add menu,Add Menu")
end
end
end

old Re: Simple menu creation

Friendly
User Off Offline

Quote
@user jerezinho: You should use Tab for Readable Scripts.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("serveraction", "_svact")
addhook("menu", "_menu")

function _svact(id, action)
	if (action == 1) then
		menu(id, "Title Menu F2,Example 1,Example 2")
	end
end

function _menu(id, title, button)
	if (title == "Title Menu F2") then
		if (button == 1) then
			msg("Hello World)
		end
	end
end

•
if (action == 1) then
1 = F2, 2 = F3, 3 = F4.
•
if (title == "Title Menu F2")
Title is from cs2d lua cmd menu (line 6)
•
if (button == 1)
Max Button is 9. also from cs2d lua cmd menu (line 6)
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview