本文整理汇总了C#中SMP.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于SMP命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Use
public override void Use(Player p, params string[] args)
{
// CURRENTLY JUST USING FOR DEBUG
p.health = 0;
p.SendHealth();
}
示例2: Use
public override void Use(Player p, params string[] args)
{
if (args.Length < 2)
{
Help(p);
return;
}
Player pr = Player.FindPlayer(args[0]);
Group gr = Group.FindGroup(args[1]);
if (pr == p)
{
p.SendMessage(HelpBot + "You can't change your own rank.");
return;
}
if (!GroupUtils.IsHigherRank(p.group, gr))
{
p.SendMessage(HelpBot + "You can't rank someone higher than your own rank.");
return;
}
if (gr != null && pr != null)
{
pr.group = gr;
p.SendMessage("There have a nice day!");
pr.SendMessage(HelpBot + p.username + " set your rank to " + gr.Name + ". Congratulations!");
}
}
示例3: Use
public override void Use(Player p, params string[] args)
{
if (args.Length == 0)
{
Help(p);
return;
}
Player pr = Player.FindPlayer(args[0]);
if (pr == null)
{
p.SendMessage(HelpBot + "Could not find player.");
return;
}
if (pr == p)
{
p.SendMessage(HelpBot + "You can't promote yourself.");
return;
}
if (GroupUtils.PromotePlayer(pr))
{
p.SendMessage(HelpBot + "Player promoted.");
pr.SendMessage(HelpBot + p.username + " promoted you. Congratulations!");
}
else
p.SendMessage(HelpBot + "Could not promote player");
}
示例4: Use
public override void Use(Player p, params string[] args)
{
if (args.Length != 1) { Help(p); return; }
int radius;
try
{
radius = Convert.ToInt32(args[0]);
}
catch
{
p.SendMessage("Invalid radius.");
return;
}
if (radius > 15)
{
p.SendMessage("Radius too big");
return;
}
if (radius < 3)
{
p.SendMessage("Radius too small");
return;
}
p.viewdistance = radius;
}
示例5: DemotePlayer
/// <summary>
/// Tries to demote a player based on track, if not, and inheritance has only one entry uses it.
/// </summary>
/// <param name="p">
/// A <see cref="Player"/>
/// </param>
/// <returns>
/// A <see cref="System.Boolean"/>
/// </returns>
public static bool DemotePlayer(Player p)
{
for (int i = 0; i < p.group.Tracks.Count; i++)
{
if(Group.TracksDictionary.ContainsKey(p.group.Tracks[i]))
{
List<Group> tempList;
Group.TracksDictionary.TryGetValue(p.group.Tracks[i], out tempList);
if(tempList.Count >= 1)
{
for(int ind = 0; i < tempList.Count; i++)
{
if(p.group == tempList[ind])
{
if(ind > 0)
{
p.group = tempList[ind - 1];
return true;
}
}
}
}
}
}
if(p.group.InheritanceList.Count == 1)
{
p.group = p.group.InheritanceList[0];
return true;
}
return false;
}
示例6: Use
public override void Use(Player p, params string[] args)
{
if (args.Length == 0)
{
Help(p);
return;
}
Player banplayer = Player.FindPlayer(args[0]);
if (banplayer != null)
{
if (args.Length >= 2)
{
banplayer.Kick("You were banned: " + String.Join(" ", args, 1, args.Length - 1));
Server.BanList.Add(banplayer.username.ToLower());
}
else
{
banplayer.Kick("You were banned by " + p.username);
Server.BanList.Add(banplayer.username.ToLower());
}
Player.GlobalMessage(Color.Announce + banplayer.username + " has been banned!");
}
else
{
Server.BanList.Add(args[0]);
p.SendMessage(HelpBot + args[0] + " has been banned");
}
foreach(string s in Server.BanList)
Server.Log(s);
}
示例7: Use
public override void Use(Player p, params string[] args)
{
if (args.Length > 0)
{
Help(p);
return;
}
StringBuilder sb = new StringBuilder();
/*lock (Player.GetPlayerLock())
{
if (Player.players.Count > 0)
for (int i = 0; i < Player.players.Count; i++)
{
sb.Append(Player.players[i].Username);
if (i != Player.players.Count - 1)
sb.Append(", ");
}
else
p.SendMessage("No body is minecrafting right now.");
}*/
p.SendMessage("Currently Online: " + sb.ToString());
}
示例8: Use
public override void Use(Player p, params string[] args)
{
Server.mode = (Server.mode == 0 ? (byte)1 : (byte)0);
foreach (Player pl in Player.players)
pl.SendState(3, Server.mode);
Player.GlobalMessage("The gamemode has been changed to " + (Server.mode == 0 ? "Survival" : "Creative") + "!");
}
示例9: Use
public override void Use(Player p, params string[] args)
{
if (args.Length != 0 && args.Length != 1)
{
Help(p);
return;
}
if (args.Length == 1)
{
int update = IntParseFast(args[0].ToLower());
if (update > 0 & update < 10000)
{
p.FlyingUpdate = update;
p.SendMessage("Flying update interval set to " + IntParseFast(args[0]));
}
else if (update == 61964 || update == 29964) Help(p);
else p.SendMessage("Cant set interval to " + args[0]);
return;
}
if (p.isFlying)
{
p.isFlying = false;
p.SendMessage("Stopped flying");
return;
}
p.SendMessage("You are now flying. &cJump!");
p.isFlying = true;
//Thread flyThread = new Thread(() =>
//{
//flyingcode(p);
//}) { Name = "FlyThread-" + p.username };
//flyThread.Start();
}
示例10: rain
public void rain(bool on, Player p)
{
if (on)
{
byte[] bytes = new byte[1];
byte thisin = 1;
bytes[0] = thisin;
p.SendRaw(0x46, bytes);
Israining = true;
// p.SendMessage("Weather is: " + Israining.ToString());
return;
}
if(!on)
{
byte[] bytes = new byte[1];
bytes[0] = 2;
p.SendRaw(0x46, bytes);
Israining = false;
return;
// p.SendMessage("Weather is: " + Israining.ToString());
}
//
//{
// Israining = false;
//}
//else
//{
// Israining = true;
//}
}
示例11: Use
public override void Use(Player p, params string[] args)
{
World.worlds.ForEach(delegate(World w)
{
p.SendMessage(w.name + ": " + w.chunkData.Count);
});
}
示例12: Use
public override void Use(Player p, params string[] args)
{
// CURRENTLY JUST USING FOR DEBUG
if (args.Length == 1)
{
string text = args[0];
Player q = Player.FindPlayer(args[0]);
if (text[0] == '@')
{
string newtext = text;
if (text[0] == '@') newtext = text.Remove(0, 1).Trim();
Player d = Player.FindPlayer(newtext);
d.health = 0;
d.SendHealth();
}
q.health = 0;
q.SendHealth();
Player.GlobalMessage(q.username + " was destroyed by " + p.username);
return;
}
else if (args.Length == 0)
{
p.health = 0;
p.SendHealth();
return;
}
else
{
}
}
示例13: Use
public override void Use(Player p, params string[] args)
{
SpheroidData cd; cd.x = 0; cd.y = 0; cd.z = 0;
cd.type = -1; cd.vertical = false;
if (args.Length >= 2)
{
try { cd.type = Convert.ToInt16(args[0]); }
catch { cd.type = FindBlocks.FindBlock(args[0]); }
if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; }
cd.vertical = (args[1].ToLower() == "vertical");
}
else if (args.Length >= 1)
{
cd.vertical = (args[0].ToLower() == "vertical");
if (!cd.vertical)
{
try { cd.type = Convert.ToInt16(args[0]); }
catch { cd.type = FindBlocks.FindBlock(args[0]); }
if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; }
}
}
p.ClearBlockChange();
p.BlockChangeObject = cd;
p.OnBlockChange += Blockchange1;
p.SendMessage("Place/delete a block at 2 corners for the spheroid.");
}
示例14: Use
public override void Use(Player p, params string[] args)
{
//TODO: Add in checks so you can't kick people higher ranked than you
if (args.Length == 0 || args[0].ToLower() == "help")
{
Help(p);
return;
}
Player KickPlayer = Player.FindPlayer(args[0]);
if (KickPlayer != null && KickPlayer != p)
{
if (args.Length >= 2)
{
StringBuilder reason = new StringBuilder();
for (int i = 1; i < args.Length; i++)
{
reason.Append(args[i] + " ");
}
reason.Remove(reason.Length - 1, 1);
KickPlayer.Kick(reason.ToString());
}
else
{
KickPlayer.Kick("You were kicked by " + p.username);
}
}
else if (KickPlayer == p)
{
p.SendMessage(HelpBot + "Why are you trying to kick yourself??");
}
else if (KickPlayer == null)
p.SendMessage(HelpBot + "Cannot find player: " + args[0]);
}
示例15: Use
public override void Use(Player p, params string[] args)
{
World w = World.Find(p.level.name);
if (args.Length == 1)
{
if (args[0] == "off")
{
foreach (Player q in Player.players)
{
w.rain(false, q);
}
p.SendMessage(Color.Red + "Stopping rain..");
w.Israining = false;
// p.SendMessage("rain is: " + w.isRain().ToString());
}
if (args[0] == "on")
{
foreach (Player q in Player.players)
{
w.SendLightning(1, 1, 100, 2, q);
w.rain(true, q);
}
w.Israining = true;
// p.SendMessage("rain is: " + w.isRain().ToString());
p.SendMessage(Color.Green + "Starting rain...");
}
if (args[0] == "status") { p.SendMessage(Color.Purple + "Rain is: " + w.Israining); }
}
else { Help(p); return; }
}