/nick
Posted: September 14th, 2011, 7:37 pm
Just a quick favour... can I have the /nick code, it'l be soo helpful, thanks in advance
Code: Select all
static readonly CommandDescriptor CdNick = new CommandDescriptor
{
Name = "Nick",
Category = CommandCategory.Maintenance,
IsConsoleSafe = true,
Permissions = new[] { Permission.EditPlayerDB },
Usage = "/Nick PlayerName DisplayedName",
Help = "&SA shortcut for /Setinfo DisplayedName, it changes a player's displayedName",
Handler = NickHandler
};
static void NickHandler(Player player, Command cmd)
{
string targetName = cmd.Next();
string valName = cmd.NextAll();
if (targetName == null)
{
CdNick.PrintUsage(player);
return;
}
PlayerInfo info = PlayerDB.FindPlayerInfoOrPrintMatches(player, targetName);
if (info == null) return;
string oldDisplayedName = info.DisplayedName;
if (valName.Length == 0) valName = null;
if (valName == info.DisplayedName)
{
if (valName == null)
{
player.Message("Nick: DisplayedName for {0} is not set.",
info.Name);
}
else
{
player.Message("Nick: DisplayedName for {0} is already set to \"{1}&S\"",
info.Name,
valName);
}
return;
}
info.DisplayedName = valName;
if (oldDisplayedName == null)
{
player.Message("Nick: DisplayedName for {0} set to \"{1}&S\"",
info.Name,
valName);
}
else if (valName == null)
{
player.Message("Nick: DisplayedName for {0} was reset (was \"{1}&S\")",
info.Name,
oldDisplayedName);
}
else
{
player.Message("Nick: DisplayedName for {0} changed from \"{1}&S\" to \"{2}&S\"",
info.Name,
oldDisplayedName,
valName);
}