sorry for my bad english
Forum
CS2D Scripts menu teleportmenu teleport
4 replies 1
sorry for my bad english
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
setx = 32 --Set it (x pos) sety = 32 -- Set it (y pos) addhook("serveraction","act") function act(id,action) 	if action == 3 then 		menu(id,"Teleport,Pos1") 	end end addhook("menu","tpmenu") function tpmenu(id,title,button) 	if title == "Teleport" then 		if button == 1 then 			parse("setpos "..id.." "..setx.." "..sety.."") 		end 	end end
Glix has written
how to make script like when you press f4 there open menu with 1 button when you press it you teleports to stetted position
sorry for my bad english
sorry for my bad english
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
posx = "xxx" posy = "xxx" addhook("serveraction","setup") function setup(id,action) if action == 3 then menu(id,"Teleportes,blabla") end end addhook("menu","setup2") function setup2(id,tt,ttt) if tt == "Teleportes" then if ttt == 1 then parse("setpos "..id.." "..posx.." "..posy) end end end
example
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
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
positions = { 	[1] = { 		x = 123; 		y = 123; 	}, } function menuTeleports(id) 	menu(id, "Teleports Menu,Position 1"); end addhook("serveraction", "onServerAction") function onServerAction(id, key) 	if key == 3 then 		menuTeleports(id); 	end end addhook("menu", "onMenu") function onMenu(id, title, button) 	if title == "Teleports Menu" then 		if button > 0 then 			parse('setpos '.. id ..' '.. positions[button].x ..' '.. positions[button].y); 		end 	end end
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
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
-- simple teleport by GajosPL pos1={100,100} -- [1] = x ,,, [2] = y pos2={200,100} -- addhook("menu","menu") addhook("serveraction","sa") function teleport_menu(id) 	menu(id,'teleport,pos 1,pos 2') end function sa(id,key) 	if key==3 then 		teleport_menu(id) 	end end function menu(id,title,button) 	if (title=='teleport') then 		if button==1 then 			parse('setpos '..id..' '..pos1[1]..' '..pos1[2]) 		end 		if button==2 then 			parse('setpos '..id..' '..pos2[1]..' '..pos2[2]) 		end 	end end
edited 1×, last 25.08.12 02:01:42 am
1