[Release] /Admin Command

12/10/2008 13:25 _Emme_#1
Sup guys. Small release coded in about 2 minutes, not tested ( as usual ). The reason im not testing is because im to lazy installing appserv, lawl. Well, here you are.

This is what it does:
If an player types /admin, it will list up all admins that are online , if there isnt any admin online, it says that.

Search for /save or something like that where the playercommands are, and add this somewhere.

Code:
if (Message == "/admin")
                            {
                                string BackMsg = "";
                                foreach (DictionaryEntry DE in World.AllChars)
                                {
                                    Character Char = (Character)DE.Value;

                                    if (Char.MyClient.Status == 8 || Char.MyClient.Status == 7)
                                    {
                                        BackMsg += Char.Name + ", ";
                                    }
                                    else
                                    {
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "There are no admin's online.", 2000));
                                    }
                                    if (BackMsg.Length > 1)
                                    {
                                        BackMsg = BackMsg.Remove(BackMsg.Length - 2, 2);
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "Admin(s) Online : " + BackMsg, 2000));
                                    }
                                 }
                            }


Emme
12/10/2008 14:00 Beta Limit#2
Thanks Emme this is a cool command.
12/10/2008 15:03 ~jochemke~#3
nice release
didn't thought about something like that but i can save some broadcast spam
like any gm on? gm?
12/11/2008 00:45 Rab#4
You should at least look your code over for logical errors.
Code:
if (Message == "/admin")
                            {
                                string BackMsg = "";
                                foreach (DictionaryEntry DE in World.AllChars)
                                {
                                    Character Char = (Character)DE.Value;

                                    if (Char.MyClient.Status == 8 || Char.MyClient.Status == 7)
                                    {
                                        BackMsg += Char.Name + ", ";
                                    }
                                    [color=red]else
                                    {
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "There are no admin's online.", 2000));
                                    }
                                    if (BackMsg.Length > 1)
                                    {
                                        BackMsg = BackMsg.Remove(BackMsg.Length - 2, 2);
                                        SendPacket(General.MyPackets.SendMsg(MessageId, "SYSTEM", MyChar.Name, "Admin(s) Online : " + BackMsg, 2000));
                                    }[/color]
                                 }
                            }
By having the last two conditional statements in that foreach loop, are you not repeating those two constantly? Wouldn't they be better placed outside of the loop?
12/11/2008 02:50 scottdavey#5
It's compatible with one source, how is it a release?