04-15-2013, 12:33 AM
well since a tpa is different from a normal teleport i'd suggest writing it from scratch.
i quickly made this i hope it makes sense for you
:
i quickly made this i hope it makes sense for you

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 | function HandleTPACommand( Split, Player ) if Split[2] == nil then Player:SendMessage( cChatColor.Green .. "Usage: /tpa [Player]" ) return true end local loopPlayer = function ( OtherPlayer ) if OtherPlayer:GetName() == Split[2] then OtherPlayer:SendMessage( cChatColor.Green .. Player:GetName() .. " send a teleport request" ) Player:SendMessage( cChatColor.Green .. "You send a teleport request to " .. OtherPlayer:GetName() ) Destination[OtherPlayer:GetName()] = Player:GetName() end end local loopWorlds = function ( World ) World:ForEachPlayer( loopPlayer ) end cRoot:Get():ForEachWorld( loopWorlds ) return true end function HandleTPAcceptCommand( Split, Player ) if Destination[Player:GetName()] == nil then Player:SendMessage( cChatColor.Green .. "Nobody has send you a teleport request" ) return true end local loopPlayer = function ( OtherPlayer ) if Destination[Player:GetName()] == OtherPlayer:GetName() then if OtherPlayer:GetWorld():GetName() ~= Player:GetWorld():GetName() then OtherPlayer:MoveToWorld( Player:GetWorld():GetName() ) end OtherPlayer:TeleportToEntity( Player ) Player:SendMessage( cChatColor.Green .. OtherPlayer:GetName() .. " teleported to you" ) OtherPlayer:SendMessage( cChatColor.Green .. "You teleported to " .. Player:GetName() ) Destination[Player:GetName()] = nil end end local loopWorlds = function ( World ) World:ForEachPlayer( loopPlayer ) end cRoot:Get():ForEachWorld( loopWorlds ) return true end |