本文整理匯總了C#中fCraft.Player.TeleportTo方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.TeleportTo方法的具體用法?C# Player.TeleportTo怎麽用?C# Player.TeleportTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fCraft.Player
的用法示例。
在下文中一共展示了Player.TeleportTo方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: RandomPosRed
public static void RandomPosRed(Player p)
{
Random rand = new Random();
int x = rand.Next(2, TeamDeathMatch.TDMworld_.Map.Width);
int y = rand.Next(2, TeamDeathMatch.TDMworld_.Map.Length);
int z1 = 0;
for (int z = TeamDeathMatch.TDMworld_.Map.Height - 1; z > 0; z--)
{
if (TeamDeathMatch.TDMworld_.Map.GetBlock(x, y, z) != Block.Air)
{
z1 = z + 3;
break;
}
}
if (p.isOnTDMTeam)
{
p.TeleportTo(new Position(x, y, z1 + 2).ToVector3I().ToPlayerCoords()); //teleport players to a random position
}
}
示例2: Kill
static void Kill(Player killer, Player p, string message) {
DateTime now = DateTime.UtcNow;
if( (now - p.LastKilled).TotalSeconds < 1)
return;
world.Players.Message(killer.Team.Color + killer.Name +
message + p.Team.Color + p.Name);
p.LastKilled = DateTime.UtcNow;
p.TeleportTo(p.Team.Spawn);
if (p.IsHoldingFlag) {
world.Players.Message("{0} &cdropped the flag for the {1}&c team!",
p.ClassyName, p.Team.ClassyName);
p.Team.HasFlag = false;
p.IsHoldingFlag = false;
world.Map.QueueUpdate(new BlockUpdate(Player.Console,
killer.Team.FlagPos, killer.Team.FlagBlock));
}
}
示例3: SpawnHandler
static void SpawnHandler(Player player, Command cmd)
{
if (player.World == null) PlayerOpException.ThrowNoWorld(player);
if (player.Info.isPlayingCTF)
{
return;
}
player.previousLocation = player.Position;
player.previousWorld = null;
player.TeleportTo(player.World.LoadMap().Spawn);
}
示例4: JumpHandler
static void JumpHandler(Player player, Command cmd)
{
String blocks = cmd.Next();
short count = 0;
if (String.IsNullOrWhiteSpace(blocks))
{
CdJump.PrintUsage(player);
return;
}
if (blocks.Contains("-"))
{
player.Message("Jumping a negative distance is really hard!");
return;
}
if (short.TryParse(blocks, out count))
{
Position target = new Position(player.Position.X, player.Position.Y, player.Position.Z + (count * 32));
player.TeleportTo(target);
player.Message("You have jumped {0} blocks.", count.ToString());
return;
}
player.Message("Please use a whole number.");
return;
}
示例5: BackHandler
static void BackHandler(Player player, Command cmd)
{
if (player.previousLocation == null)
{
player.Message("&cYou haven't been teleported somewhere yet!");
return;
}
else
{
player.Message("&aTeleporting you back to your previous location...");
if (player.previousWorld == null)
{
player.TeleportTo(player.previousLocation);
}
else
{
player.JoinWorld(player.previousWorld, WorldChangeReason.ManualJoin);
player.TeleportTo(player.previousLocation);
}
return;
}
}
示例6: SpawnHandler
static void SpawnHandler( Player player, Command cmd )
{
if ( player.World == null ) PlayerOpException.ThrowNoWorld( player );
player.TeleportTo( player.World.LoadMap().Spawn );
}
示例7: BotHandler
//.........這裏部分代碼省略.........
}
if (model == "human") {
model = "humanoid";
}
if (!validEntities.Contains(model)) {
if (Map.GetBlockByName(model, false, out blockmodel)) {
model = blockmodel.GetHashCode().ToString();
} else {
player.Message(
"That wasn't a valid entity model! Valid models are chicken, creeper, human, pig, sheep, skeleton, spider, zombie, or any block ID/Name.");
break;
}
}
player.Message("Changed entity model to {0} with skin {1}.", model, skinString2 ?? bot.SkinName);
bot.changeBotModel(model, skinString2 ?? bot.SkinName);
} else
player.Message(
"Usage is /Ent model <bot> <model>. Valid models are chicken, creeper, human, pig, sheep, skeleton, spider, zombie, or any block ID/Name.");
break;
case "bring":
bot.teleportBot(player.Position);
break;
case "tp":
case "teleport":
World targetWorld = bot.World;
Bot target = bot;
if (targetWorld == player.World) {
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo(target.Position);
} else {
if (targetWorld.Name.StartsWith("PW_") &&
!targetWorld.AccessSecurity.ExceptionList.Included.Contains(player.Info)) {
player.Message(
"You cannot join due to that Bot being in a personal world that you cannot access.");
break;
}
switch (targetWorld.AccessSecurity.CheckDetailed(player.Info)) {
case SecurityCheckResult.Allowed:
case SecurityCheckResult.WhiteListed:
if (player.Info.Rank.Name == "Banned") {
player.Message("&CYou can not change worlds while banned.");
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
if (targetWorld.IsFull) {
player.Message("Cannot teleport to {0}&S because world {1}&S is full.",
target.Name, targetWorld.ClassyName);
player.Message("Cannot teleport to {0}&S.", target.Name,
targetWorld.ClassyName, targetWorld.AccessSecurity.MinRank.ClassyName);
break;
}
player.StopSpectating();
player.JoinWorld(targetWorld, WorldChangeReason.Tp, target.Position);
break;
case SecurityCheckResult.BlackListed:
player.Message("Cannot teleport to {0}&S because you are blacklisted on world {1}",
target.Name, targetWorld.ClassyName);
break;
case SecurityCheckResult.RankTooLow:
示例8: SuicideHandler
static void SuicideHandler(Player player, CommandReader cmd)
{
string note = cmd.NextAll();
if (player.World == null) PlayerOpException.ThrowNoWorld(player);
if (player.Info.TimeSinceLastServerMessage.TotalSeconds < 10) {
player.Info.getLeftOverTime(10, cmd);
return;
}
if (note.Length > 64)
{
player.Message("&sProbably bad timing, but your suicide note can't be {0} characters long. Max is 64.", note.Length);
return;
}
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
if (note == "")
{
Server.Message("&s{0}&s took the easy way out", player.ClassyName);
player.TeleportTo(player.World.LoadMap().Spawn);
player.Info.LastServerMessageDate = DateTime.Now;
return;
}
else
{
Server.Message("&s{0}&s took the easy way out and left a note", player.ClassyName);
Server.Message("&s[&fNote&s] {0}", note);
player.TeleportTo(player.World.LoadMap().Spawn);
player.Info.LastServerMessageDate = DateTime.Now;
return;
}
}
示例9: SpawnHandler
static void SpawnHandler( Player player, CommandReader cmd ) {
if( player.World == null ) PlayerOpException.ThrowNoWorld( player );
if (player.World != null) {
player.LastWorld = player.World;
player.LastPosition = player.Position;
}
player.TeleportTo( player.World.LoadMap().Spawn );
}
示例10: SpawnHandler
static void SpawnHandler( Player player, CommandReader cmd ) {
player.TeleportTo( player.WorldMap.Spawn );
}
示例11: SetSpawnHandler
static void SetSpawnHandler(Player player, Command cmd)
{
string playerName = cmd.Next();
if (playerName == null)
{
player.World.Map.Spawn = player.Position;
player.TeleportTo(player.World.Map.Spawn);
player.Send(PacketWriter.MakeAddEntity(255, player.ListName, player.Position));
player.Message("New spawn point saved.");
Logger.Log(LogType.UserActivity, "{0} changed the spawned point.",
player.Name);
}
else if (player.Can(Permission.Bring))
{
Player[] infos = player.World.FindPlayers(player, playerName);
if (infos.Length == 1)
{
Player target = infos[0];
if (player.Can(Permission.Bring, target.Info.Rank))
{
target.Send(PacketWriter.MakeAddEntity(255, target.ListName, player.Position));
}
else
{
player.Message("You can only set spawn of players ranked {0}&S or lower.",
player.Info.Rank.GetLimit(Permission.Bring).ClassyName);
player.Message("{0}&S is ranked {1}", target.ClassyName, target.Info.Rank.ClassyName);
}
}
else if (infos.Length > 0)
{
player.MessageManyMatches("player", infos);
}
else
{
infos = Server.FindPlayers(player, playerName, true);
if (infos.Length > 0)
{
player.Message("You can only set spawn of players on the same world as you.");
}
else
{
player.MessageNoPlayer(playerName);
}
}
}
else
{
player.MessageNoAccess(CdRealm);
}
}
示例12: SwitchTeamTo
public static void SwitchTeamTo(Player player, CtfTeam newTeam, bool unbalanced) {
CtfTeam oldTeam = newTeam == RedTeam ? BlueTeam : RedTeam;
player.Message("You have switched to the {0}&s team.", newTeam.ClassyName);
if (unbalanced)
player.Message( "&sThe teams are now unbalanced!");
oldTeam.Players.Remove(player);
if (!newTeam.Has(player))
newTeam.Players.Add(player);
if (player.IsHoldingFlag) {
world.Players.Message("&cFlag holder {0} &cswitched to the {1}&c team, " +
"thus dropping the flag for the {2}&c team!",
player.Name, newTeam.ClassyName, oldTeam.ClassyName );
oldTeam.HasFlag = false;
player.IsHoldingFlag = false;
world.Map.QueueUpdate(new BlockUpdate(Player.Console, newTeam.FlagPos, newTeam.FlagBlock));
}
player.Team = newTeam;
player.TeleportTo(newTeam.Spawn);
}
示例13: AddPlayerToTeam
static void AddPlayerToTeam(CtfTeam team, Player p) {
team.Players.Add(p);
p.Message("&SAdding you to the " + team.ClassyName + " team");
p.TeleportTo(team.Spawn);
p.Team = team;
p.IsPlayingCTF = true;
if (p.Supports(CpeExtension.HeldBlock))
p.Send(Packet.MakeHoldThis(Block.TNT, false));
}
示例14: SetPlayerNotDead
private static void SetPlayerNotDead( Player player )
{
try {
if ( player != null ) {
if ( player.IsOnline ) {
if ( player.PublicAuxStateObjects.ContainsKey( "dead" ) ) {
player.PublicAuxStateObjects.Remove( "dead" );
player.TeleportTo( GetRandomPosition( player ) );
}
}
}
} catch ( Exception e ) {
Logger.Log( LogType.Error, e.ToString() );
}
}