本文整理汇总了C#中MCSharp.Player.ChangeLevel方法的典型用法代码示例。如果您正苦于以下问题:C# Player.ChangeLevel方法的具体用法?C# Player.ChangeLevel怎么用?C# Player.ChangeLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCSharp.Player
的用法示例。
在下文中一共展示了Player.ChangeLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
// Code to run when used by a player
public override void Use(Player p,string message)
{
bool blnLevelFound = false;
Level targetLevel = null;
if (message != "")
{
message = message.ToLower();
if (p.level.name.ToLower() != message)
{
foreach (Level level in Server.levels)
{
if (level.name.ToLower() == message)
{
targetLevel = level;
blnLevelFound = true;
break;
}
}
if (blnLevelFound)
{
if (targetLevel.PlayerCanVisit(p))
{
p.ChangeLevel(targetLevel);
if (!p.hidden)
{
Player.GlobalChat(p, p.color + "*" + p.name + "&e went to \"" + p.level.name + "\".", false);
}
}
else
{
p.SendMessage("You do not have perimssion to visit this level");
}
}
else
{
// Level either not found or non-existant
p.SendMessage("There is no level \"" + message + "\" loaded.");
}
}
else
{
p.SendMessage("You are already on that level!");
}
}
else
{
Help(p);
}
}
示例2: Use
// Code to run when used by a player
public override void Use(Player p, string message)
{
if (message != "")
{
if (Player.ValidName(message))
{
Player target = Player.Find(message);
if (target != null)
{
// if the target is visible or your rank is higher than theirs, then teleport
if (!target.hidden || p.Rank > target.Rank)
{
if (p.level != target.level)
{
// Change levels if needed
p.ChangeLevel(target.level.name);
}
// Teleport to the player
unchecked
{
p.SendPos((byte)-1, target.pos[0], target.pos[1], target.pos[2], target.rot[0], 0);
}
}
else
{
// Player is offline
p.SendMessage("There is no player \"" + message + "\"!");
}
}
else
{
// Player is offline
p.SendMessage("There is no player \"" + message + "\"!");
}
}
else
{
p.SendMessage("Invalid Name!");
}
}
else
{
Help(p);
}
}