Go to your console and type /cmdcreate xspawn.
Find Cmdxspawn.cs in the extra/commands/source folder.
Open it in notepad (quick and easy) and find the section that looks like this:
- Code: Select all
public override void Use(Player p, string message)
{
}
Inside these curly braces you can insert the following code:
- Code: Select all
if (String.IsNullOrEmpty(message) || message.IndexOf(' ') != -1)
{
Help(p);
return;
}
Player who = Player.Find(message);
if (who != null && !who.hidden)
{
if (who.group.Permission < p.group.Permission)
{
Command.all.Find("spawn").Use(who, "");
if (p != null)
{
Player.SendMessage(who, p.color + p.PublicName + Server.DefaultColor + " sent you to the spawn.");
}
else
{
Player.SendMessage(who, "The console sent you back to the spawn.");
}
Player.SendMessage(p, "You sent " + who.color + who.PublicName + Server.DefaultColor + " to the spawn.");
}
else
{
Player.SendMessage(p, "Cannot spawn players of greater or equal rank.");
}
}
else
{
Player.SendMessage(p, "Player could not be found.");
}
Also within this section of code:
- Code: Select all
public override void Help(Player p)
{
}
You'll want to add something along the lines of;
- Code: Select all
Player.SendMessage(p, "/xspawn [player] - send [player] to the spawn.");
Lastly, make sure you change the details at the top of the command skeleton referring to the command name, its shortcut and more.
Then you can go back to your console and type /compile xspawn. Hopefully you get no compiler error... in which case you can then load your command with /cmdload xspawn.
Add "xspawn" to cmdautoload.txt to ensure it loads on server startup.
I have just made this now and haven't tested it so if anything messes up let me know asap and I can help you out.