Forum

> > CS2D > Scripts > Menu Teleport a players
Forums overviewCS2D overview Scripts overviewLog in to reply

English Menu Teleport a players

6 replies
To the start Previous 1 Next To the start

old Re: Menu Teleport a players

TopNotch
User Off Offline

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

function _serveraction(id,action)
	if action==1 then
		menu(id,"Teleport,Location 1,Location 2")
	end
end

function _menu(id,title,button)
	if title=="Teleport" then
		if button==1 then
			parse("setpos "..id.." 100 100")
		elseif button==2 then
			parse("setpos "..id.." 100 100")
		end
	end
end
Untested. Just change 100 100 by your X Y.
Note: This position is defined in pixels and not in tiles.

old Re: Menu Teleport a players

Rainoth
Moderator Off Offline

Quote
That's not what he wants.

1
2
3
4
5
6
7
addhook("say","sayyouloveme")
function sayyouloveme(id,txt)
local target = txt:sub(7,8)
	if txt:sub(1,5) == "!goto" then
		parse("setpos "..id.." "..player(target,"x").." "..player(target,"y"))
	end
end

Hopefully this is what you need. Sorry that I can't make a menu.

old Re: Menu Teleport a players

Apache uwu
User Off Offline

Quote
If I had to guess, I'd say he wants a menu like this:

1
2
3
4
5
6
--Teleport To Player--
1. Player 1
2. Player 2
3. Player 3
...and so on
0. Cancel

When you press F2/F3/F4 a menu pops up with all the players (excluding yourself), when you click on a menu item, you teleport directly on top of the player.

There will also need to be pagination (next/back buttons) because not all 31 players can fit on one menu.

old Re: Menu Teleport a players

superpegamento
User Off Offline

Quote
user Apache uwu has written
If I had to guess, I'd say he wants a menu like this:

1
2
3
4
5
6
--Teleport To Player--
1. Player 1
2. Player 2
3. Player 3
...and so on
0. Cancel

When you press F2/F3/F4 a menu pops up with all the players (excluding yourself), when you click on a menu item, you teleport directly on top of the player.

There will also need to be pagination (next/back buttons) because not all 31 players can fit on one menu.

the menu is not the problem the problem is the function to go a user

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
45
46
47
48
49
50
addhook("serveraction" , "Accion")
function Accion(id,action)
if action==1 then
menu(id, "¿IR A UN USUARIO?,Ir")
end
end

addhook("menu" , "menu")
function menu(id,title,b)
if title=="¿IR A UN USUARIO?" then
if b==1 then
menu(id,"IR Pagina 1,"..exist(1).."|1,"..exist(2).."|2,"..exist(3).."|3,"..exist(4).."|4,"..exist(5).."|5,"..exist(6).."|6,"..exist(7).."|7,"..exist(8).."|8,Siguiente")
end
elseif title=="IR Pagina 1" then
if b==9 then
menu(id,"IR Pagina 2,"..exist(9).."|9,"..exist(10).."|10,"..exist(11).."|11,"..exist(12).."|12,"..exist(13).."|13,"..exist(14).."|14,"..exist(15).."|15,"..exist(16).."|16,Siguiente")
elseif b~=0 then
ir(b)
end
elseif title=="IR Pagina 2" then
if b==9 then
menu(id,"IR Pagina 3,"..exist(17).."|17,"..exist(18).."|18,"..exist(19).."|19,"..exist(20).."|20,"..exist(21).."|21,"..exist(22).."|22,"..exist(23).."|23,"..exist(24).."|24,Siguiente")
elseif b~=0 then
ir(b+8)
end
elseif title=="IR Pagina 3" then
if b==9 then
menu(id,"IR Pagina 4,"..exist(25).."|25,"..exist(26).."|26,"..exist(27).."|27,"..exist(28).."|28,"..exist(29).."|29,"..exist(30).."|30,"..exist(31).."|31,"..exist(32).."|32,Cerrar Menu")
elseif b~=0 then
ir(b+16)
end
elseif title=="IR Pagina 4" then
if b~=0 then
ir(b+24)
end
end
end


function ir(id, target)
parse("setpos "..id.." "..player(target,"x").." "..player(target,"y"))
end

function exist(param)
     if player(param,"exists") then
          return player(param,"name")
     else
          return "(Nada)"
     end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview