It is currently January 21st, 2018, 10:23 am


All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: command making
PostPosted: April 2nd, 2012, 7:23 am 

Joined: December 29th, 2011, 11:42 am
Posts: 50
Location: Australia
i have been able to edit vanillas version

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:
        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);
            }
        }


with this idea how do i make commands?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: command making
PostPosted: April 2nd, 2012, 9:16 am 

Joined: May 26th, 2011, 2:15 pm
Posts: 279
If you'd wrote that command, you would have known.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: command making
PostPosted: April 2nd, 2012, 10:42 am 

Joined: August 21st, 2011, 6:31 am
Posts: 280
Location: United Kingdom
Silv didn't write this command, its exactly the same as my code except its been badly modified and will not work.

If you're asking about plugins such as my /Write, plugins are not a feature of fCraft just yet, they're coming soon. My /Slap command is not compatible with fCraft, if you have a reasonable understanding of programming then you'll be able to make it compatible yourself.

_________________
You cannot use certain BBCodes: [img].


Top
Offline Profile  
Reply with quote  
 Post subject: Re: command making
PostPosted: April 3rd, 2012, 1:25 am 

Joined: December 29th, 2011, 11:42 am
Posts: 50
Location: Australia
sorry i just edited a bit... Thanks anyway..


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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