Forum

> > CS2D > Scripts > How to make A Menu....
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to make A Menu....

5 replies
To the start Previous 1 Next To the start

old How to make A Menu....

j4
User Off Offline

Quote
I Need to know how to make a menu.... when you press f3, f4, f2 a menu will open...

for example if i press f4 i will use wallhack if i press f3 it will open admin menu like that....

old Re: How to make A Menu....

Jynxxx
User Off Offline

Quote
Something like that right, hope it helps you--Untested--

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("serveraction","menu")
function menu(id,action)
	if action == 1 then --f2
		menu(id,Your Title,Button1,button2,so on")
	end
	elseif action == 2 then -- f3
		menu(id,"Admin Menu,Button1,So on")
	elseif button == 3 then -- f4
		local rot = player(id,"rot")
		if rot < -90 then rot = rot + 360 end
			local angle = math.rad(math.abs( rot + 90 )) - math.pi
			local x = player(id,"x") + math.cos(angle) * 10
			local y = player(id,"y") + math.sin(angle) * 10
			if x > 0 and y > 0 and x < map("xsize") * 32 and y < map("ysize") * 32 then
				parse("setpos "..id.." "..x.." "..y)
		end
	end
end
@user EngiN33R: ok yea seen what you meant right here i fixed it
edited 1×, last 03.01.12 04:01:30 pm

old Re: How to make A Menu....

Jynxxx
User Off Offline

Quote
to make the 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
33
34
35
36
37
38
39
40
41
42
43
44
addhook("menu","Nmenu")
function Nmenu(id,title,button)
	if title == "Your Title" then
		if button == 1 then
			--whatever you want to put
		elseif button == 2 then
			--
		elseif button == 3 then
			--
		elseif button == 4 then
			--
		elseif button == 5 then
			--
		elseif button == 6 then
			--
		elseif button == 7 then
			--
		elseif button == 8 then
			--
		elseif button == 9 then
			--
	end
	elseif title == "Admin Menu" then
		if button == 1 then
			--whatever you want to put
		elseif button == 2 then
			--
		elseif button == 3 then
			--
		elseif button == 4 then
			--
		elseif button == 5 then
			--
		elseif button == 6 then
			--
		elseif button == 7 then
			--
		elseif button == 8 then
			--
		elseif button == 9 then
			--
		end
	end
end

old Re: How to make A Menu....

EngiN33R
Moderator Off Offline

Quote
@user Jynxxx: Why did you copy your first menu off some admin script? You didn't even care to put ends that are missing in the going-thru-walls part.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview