Clear Inventory Command for Seraphs Dominion

Posts 1–15 of 27 · Page 1 of 2
Clear Inventory Command for Seraphs Dominion
This is extremely simple but it's for the people who don't know how to make/add commands.

Step one: Navigate to wServer > Realm > Commands > AdminCommands.cs.

Step two: Copy and paste the following

Code:
    internal class ClearInv : Command
    {
        public ClearInv() :base("ci", 1)
        {
        }
        protected override bool Process(Player player, RealmTime time, string args)
        {
            for (int i = 0; i < player.Inventory.Length; i++)
            {
                player.Inventory[i] = null;
                player.UpdateCount++;
            }
            player.SendInfo("Inventory Cleared");
            return true;
        }
    }
Note: No, this isn't completely copied. The method on how it works is different. Much easier to code and probably fast to run?

Code:
                string name = string.Join(" ", args.ToArray()).Trim();
                name = name.ToLower();
                try
                {

                    player.Inventory[4] = null;
                    player.Inventory[5] = null;
                    player.Inventory[6] = null;
                    player.Inventory[7] = null;
                    player.Inventory[8] = null;
                    player.Inventory[9] = null;
                    player.Inventory[10] = null;
                    player.Inventory[11] = null;
                    player.UpdateCount++;
                    return;
                }
                catch
                {
                    player.SendInfo("Error !");
                }
To

Code:
            for (int i = 0; i < player.Inventory.Length; i++)
            {
                player.Inventory[i] = null;
                player.UpdateCount++;
            }
            player.SendInfo("Inventory Cleared");
            return true;
Extra

This is for deleting a certain slot

Code:
    internal class ClearSlot : Command
    {
        public ClearSlot() : base("cl", 1)
        {
        }
        protected override bool Process(Player player, RealmTime time, string args)
        {
            int slot = Convert.ToInt32(args);
            if (slot < 11)
            {
                player.Inventory[slot] = null;
                player.UpdateCount++;
                player.SendInfo("Slot " + slot + " Cleared!");
                return true;
            }
            else
            {
                player.SendInfo(slot + " Is not a valid slot. Please choose a slot between [0-11]");
                return false;
            }
        }
    }
Note, when you type /cl *number* slots start from "0". So if you type /cl 1 it will remove your spell
Nice..............
Updated the Clear Slot command so you cannot enter an invalid value.
Quote Originally Posted by theman 12 View Post
verss help me

- - - Updated - - -

go to pserver help and help meh plz
I'll take a look
Nice method on making the code shorter keep it up vers
Thanks for sharing!
Quote Originally Posted by BARm View Post
Thanks for sharing!
@BARm can u help me with Seraphs? I need help setting up, the tutorials don't work for me.
@Versified you think you can make it so you can clear another players inventory
/clearin <playername>
Quote Originally Posted by Transferred View Post
@Versified you think you can make it so you can clear another players inventory
/clearin <playername>
just make an admin client for only u to use that has the take from inv hack lol
Quote Originally Posted by Riigged View Post


just make an admin client for only u to use that has the take from inv hack lol
lol or u can do it with simple client work without the hassle of server code
Quote Originally Posted by Slendergo View Post
lol or u can do it with simple client work without the hassle of server code
Not everyone has l33t inventory hacks or knows how to make them
Quote Originally Posted by ZeusAlmighty View Post
Not everyone has l33t inventory hacks or knows how to make them
well for your server...
Quote Originally Posted by ZeusAlmighty View Post
Not everyone has l33t inventory hacks or knows how to make them
thats because most people are smart enough to think of it / create it
If you don't want to get your Equipment Slots cleared too just use this

Code:
internal class ClearInvSolo : Command
    {
        public ClearInvSolo() :base("ci", 1)
        {
        }
        protected override bool Process(Player player, RealmTime time, string args)
        {
            for (int i = 4; i < player.Inventory.Length; i++)
            {
                player.Inventory[i] = null;
                player.UpdateCount++;
            }
            player.SendInfo("Inventory Cleared");
            return true;
        } 
    }
And thanks for this Vers
pls Clear inv command for [Fabiano]
Posts 1–15 of 27 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?