It is currently July 22nd, 2018, 12:43 pm


All times are UTC




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: How i start server?
PostPosted: February 3rd, 2012, 10:43 pm 

Joined: July 16th, 2011, 5:09 am
Posts: 24
I have made a command with some help of bob and also am wondering how do i start the server with the command


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 3rd, 2012, 11:48 pm 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
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.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 4th, 2012, 2:56 am 

Joined: July 16th, 2011, 5:09 am
Posts: 24
Code:
        #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


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 4th, 2012, 3:04 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
Code:
        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:
Show
Code:
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].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 4th, 2012, 4:47 am 
User avatar

Joined: January 18th, 2012, 6:16 am
Posts: 14
Playdude98 wrote:
Code:
        #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


just a small suggestion:

replace:
Code:
            player.messagenow("Player Want an OP to review his/her build!");


with:
Code:
            Server.Players.Message("&SPlayer {0}&S Would like an OP to review his/her build!", player.ClassyName);


also, why is
Code:
            IsConsoleSafe = false,

false?


-EDIT: woops, didn't see Jonty's post. :P


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 4th, 2012, 5:48 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
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 :P.

So I guess that's why he set it to false.

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 4th, 2012, 9:51 am 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
I would suggest this:
Show


Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 4th, 2012, 10:14 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
I would suggest this, it's more practical

Show
Code:
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.");
        }


Edit: as a note, I wouldn't recommend using Chat.SendStaff for something like this. SendStaff uses
Code:
String.Format( "&P(staff){0}&P: {1}",
                                                     player.ClassyName,
                                                     rawMessage );

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.
Code:
string message = String.Format("{0}&6 would like staff to check their build", player.ClassyName);

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
Code:
foreach(Player p in Server.Players)
{
if(p.Can(Permission.ReadStaffChat)) //staff ya?
p.Message(message);
}

or even better
Code:
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

_________________
You cannot use certain BBCodes: [img].


Last edited by Jonty800 on February 4th, 2012, 10:30 am, edited 2 times in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: How i start server?
PostPosted: February 4th, 2012, 10:28 am 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
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 ;)


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net