i have taken out and edited commands;
how do i add commands;
so fair i copy what other commands have, but wheres the purpose go, like /write
this is my edited /slap code
Code: Select all
static readonly CommandDescriptor CdSlap = new CommandDescriptor
{
Name = "Slap",
IsConsoleSafe = true,
NotRepeatable = false,
Aliases = new[] { "sky""hit""punch" },
Category = CommandCategory.Moderation,
Permissions = new[] { Permission.Slap },
Help = "Slaps a player to the sky.",
Handler = Slap
};
static void Slap(Player player, Command cmd)
{
string name = cmd.Next();
if (name == null)
{
player.Message("Please enter a name, or else you cannot slap someone,");
return;
}
Player target = Server.FindPlayerOrPrintMatches(player, name, false, true);
if (target == null) return;
if ((DateTime.Now - player.Info.LastUsedSlap).TotalSeconds < 1)
{
player.Message("&CYou can only use /Slap once every 1 seconds. Slow down.");
return;
}
if (player.Can(Permission.Slap, target.Info.Rank))
{
Position slap = new Position(target.Position.X, target.Position.Y, (target.World.Map.Bounds.ZMax) * 32);
Server.Players.CanSee(target).Message("{0} &swas slapped sky high by {1}", target.ClassyName, player.ClassyName);
target.TeleportTo(slap);
player.Info.LastUsedSlap = DateTime.Now;
return;
}
else
{
player.Message("&sYou can only Slap players ranked {0}&S or lower",
player.Info.Rank.GetLimit(Permission.Slap).ClassyName);
player.Message("{0}&S is ranked {1}", target.ClassyName, target.Info.Rank.ClassyName);
}
}