Forum

> > CS2D > Scripts > Bring and Teleport to!
Forums overviewCS2D overview Scripts overviewLog in to reply

English Bring and Teleport to!

2 replies
To the start Previous 1 Next To the start

old Bring and Teleport to!

Black Wolf
User Off Offline

Quote
Can some on tell how i can make script like when you say
!bring <id> player teleports to you!
!tp <id> You teleports to player
edited 1×, last 16.08.12 06:52:38 pm

old Re: Bring and Teleport to!

Cure Pikachu
User Off Offline

Quote
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
function totable(t,match)
	local cmd = {}
	if not match then
		match = "[^%s]+"
	else
		match = "[^"..match.."]+"
	end
	for word in string.gmatch(t,match) do
		table.insert(cmd,word)
	end
	return cmd
end

addhook("say","teleport_say")
function teleport_say(id,txt)
	local s = totable(txt)
	local t1 = tostring(s[1])
	if t1 == "!bring" then
		local t2 = tonumber(s[2])
		if t2 then
			if player(t2,"exists") then
				if player(id,"health") > 0 and if player(t2,"health") > 0 then
					parse("setpos "..t2.." "..player(id,"x").." "..player(id,"y"))
				end
			end
		end
	end
	if t1 == "!tp" then
		local t2 = tonumber(s[2])
		if t2 then
			if player(t2,"exists") then
				if player(t2,"health") > 0 and player(id,"health") > 0 then
					parse("setpos "..id.." "..player(t2,"x").." "..player(t2,"y"))
				end
			end
		end
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview