Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local event=require("event")
- local component = require("component")
- local debug = component.debug
- --chat msg, uuid, name "chat_message"_
- while true do
- local ev, _ , name, msg = event.pull("chat_message")
- if msg:sub(1,3) == "tp " then
- local n1, n2 = string.match(msg, "tp%s([^%s]+)%s([^%s]+)")
- print(n1,n2)
- if n1 == nil then
- n2 = string.match(msg, "tp%s([^%s]+)")
- n1 = name
- end
- if n1 ~= nil and n2 ~= nil then
- -- print(tostring(n1),tostring(n2))
- local p1 = debug.getPlayer(n1)
- local p2 = debug.getPlayer(n2)
- local players = debug.getPlayers()
- local f1, f2 = false, false
- for i, v in ipairs(players) do
- if v == n1 then f1 = true end
- if v == n2 then f2 = true end
- end
- if f1 and f2 then
- local posX, posY, posZ = p2.getPosition()
- p1.setPosition(posX, posY, posZ)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment