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 :
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