How i start server?
-
- Offline
- Posts: 24
- Joined: July 16th, 2011, 5:09 am
How i start server?
I have made a command with some help of bob and also am wondering how do i start the server with the command
Re: How i start server?
The command we to started on isn't even close to done.
And you must compile the files by opening the fCraft file in the main folder.
And you must compile the files by opening the fCraft file in the main folder.
-
- Offline
- Posts: 24
- Joined: July 16th, 2011, 5:09 am
Re: How i start server?
Code: Select all
#region Review
static readonly CommandDescriptor CDReview = new CommandDescriptor
{
Name = Review,
Category = CommandCategory.Chat,
Aliases = new [] { "CheckBuild" },
IsConsoleSafe = false,
NotRepeatable = false,
DisableLogging = true,
Permissions = new [] { Permission.Chat },
Usage = "/Review",
Help = "Requests staff to review your build",
Handler = ReviewHandler
};
static void ReviewHandler( Player player, Command cmd) {
player.messagenow("Player Want an OP to review his/her build!");
}
#endregion
Re: How i start server?
Code: Select all
static readonly CommandDescriptor CDReview = new CommandDescriptor
{
Name = "Review",
Category = CommandCategory.Chat,
Aliases = new [] { "CheckBuild" },
IsConsoleSafe = false,
NotRepeatable = false,
DisableLogging = true,
Permissions = new [] { Permission.Chat },
Usage = "/Review",
Help = "Requests staff to review your build",
Handler = ReviewHandler
};
internal static void ReviewHandler( Player player, Command cmd) {
Server.Players.Message("{0}&S would like an OP to review his/her build!", player.ClassyName);
}
Your code commented:
Code: Select all
static readonly CommandDescriptor CDReview = new CommandDescriptor //lowercase for the 'D' in CDReview
{
Name = Review, //name needs to be a string. "Review",
Category = CommandCategory.Chat,
Aliases = new [] { "CheckBuild" },
IsConsoleSafe = false,
NotRepeatable = false,
DisableLogging = true,
Permissions = new [] { Permission.Chat },
Usage = "/Review",
Help = "Requests staff to review your build",
Handler = ReviewHandler
};
static void ReviewHandler( Player player, Command cmd) { //use internal static void
player.messagenow("Player Want an OP to review his/her build!"); //never use MessageNow, use Message instead. But this will only send the player a message, not the server. So use Server.Players.Message("
}
You cannot use certain BBCodes: [img].
Re: How i start server?
just a small suggestion:Playdude98 wrote:Code: Select all
#region Review static readonly CommandDescriptor CDReview = new CommandDescriptor { Name = Review, Category = CommandCategory.Chat, Aliases = new [] { "CheckBuild" }, IsConsoleSafe = false, NotRepeatable = false, DisableLogging = true, Permissions = new [] { Permission.Chat }, Usage = "/Review", Help = "Requests staff to review your build", Handler = ReviewHandler }; static void ReviewHandler( Player player, Command cmd) { player.messagenow("Player Want an OP to review his/her build!"); } #endregion
replace:
Code: Select all
player.messagenow("Player Want an OP to review his/her build!");
Code: Select all
Server.Players.Message("&SPlayer {0}&S Would like an OP to review his/her build!", player.ClassyName);
Code: Select all
IsConsoleSafe = false,
-EDIT: woops, didn't see Jonty's post.
Re: How i start server?
IsConsoleSafe pretty much means "can console use this command"
While the answer is "yes", you do not however want console to be reviewed. Console is not a player .
So I guess that's why he set it to false.
While the answer is "yes", you do not however want console to be reviewed. Console is not a player .
So I guess that's why he set it to false.
You cannot use certain BBCodes: [img].
Re: How i start server?
I would suggest this:
Show
Re: How i start server?
I would suggest this, it's more practical
Edit: as a note, I wouldn't recommend using Chat.SendStaff for something like this. SendStaff uses
This means that your message will only send to staff, but as (staff)Jonty800 Jonty800 would like an op to check their build
You can make your own String.Format instead like I have.
then you need to make a list of everyone who you want to send the message to. You can do this two ways I guess.
Either
or even better
Code: Select all
static readonly CommandDescriptor cdReview = new CommandDescriptor
{
Name = "Review",
Category = CommandCategory.Chat,
IsConsoleSafe = true,
Usage = "/review",
NotRepeatable = true,
Help = "Request an Op to review your build.",
Handler = Review
};
internal static void Review(Player player, Command cmd)
{
if (player.Info.IsMuted)
{
player.MessageMuted();
return;
}
var recepientList = Server.Players.Can(Permission.ReadStaffChat)
.NotIgnoring(player)
.Union(player);
string message = String.Format("{0}&6 would like staff to check their build", player.ClassyName);
recepientList.Message(message);
var ReviewerNames = Server.Players
.CanBeSeen(player)
.Where(r => r.Can(Permission.Promote, player.Info.Rank));
if (ReviewerNames.Count() > 0)
{
player.Message("&WOnline players who can review you: {0}", ReviewerNames.JoinToString(r => String.Format("{0}&S", r.ClassyName)));
return;
}
else
player.Message("&WThere are no players online who can review you. A member of staff needs to be online.");
}
Code: Select all
String.Format( "&P(staff){0}&P: {1}",
player.ClassyName,
rawMessage );
You can make your own String.Format instead like I have.
Code: Select all
string message = String.Format("{0}&6 would like staff to check their build", player.ClassyName);
Either
Code: Select all
foreach(Player p in Server.Players)
{
if(p.Can(Permission.ReadStaffChat)) //staff ya?
p.Message(message);
}
Code: Select all
var recepientList = Server.Players.Can(Permission.ReadStaffChat) //staff
.NotIgnoring(player) //who are not ignoring the player
.Union(player); //and send the player the message too
string message = String.Format("{0}&6 would like staff to check their build", player.ClassyName);
recepientList.Message(message); //you've got mail
Last edited by Jonty800 on February 4th, 2012, 10:30 am, edited 2 times in total.
You cannot use certain BBCodes: [img].
Re: How i start server?
Of course, Jonty, but it's his first command, and I wanted to make it as easy as possible, and as close as possible to his original command