This Lua script is written for the Transformice.
Click another mouse and you will teleport to that mouse it's location and that mouse will teleport to your location.
-- Author: Jordynl
players = {}
function pythag(x1,y1,x2,y2,r)
local x=x2-x1
local y=y2-y1
local r=r+r
return x*x+y*y<r*r
end
function eventNewPlayer(name)
players[name] = {
spawned = true,
}
system.bindMouse(name, true)
end
function eventMouse(playerName, x, y)
if players[playerName].spawned then
for name, player in pairs(tfm.get.room.playerList) do
if pythag(x, y, player.x, player.y, 25) and playerName ~= name then
local playerData = tfm.get.room.playerList[playerName]
tfm.exec.movePlayer(name, playerData.x, playerData.y)
tfm.exec.displayParticle(36,playerData.x,playerData.y,0,0,0,0,nil)
tfm.exec.displayParticle(36,player.x,player.y,0,0,0,0,nil)
tfm.exec.movePlayer(playerName, player.x, player.y)
end
end
end
end
for k,v in pairs({}) do
tfm.exec["disable"..v](true)
end
for name, player in pairs(tfm.get.room.playerList) do
eventNewPlayer(name)
end