Example #1
0
 private static void InSimMessageHandler(InSim insim, IS_MSO packet)
 {
     if (packet.UserType == UserType.MSO_O && packet.Msg == "clear")
     {
         var fileName = Assembly.GetExecutingAssembly().Location;
         System.Diagnostics.Process.Start(fileName);
         Environment.Exit(0);
     }
 }
Example #2
0
        bool TryParseCommand(IS_MSO mso, out string[] args)
        {
            if (mso.UserType == UserType.MSO_PREFIX)
            {
                var message = mso.Msg.Substring(mso.TextStart);
                args = message.Split();
                return(args.Length > 0);
            }

            args = null;
            return(false);
        }
Example #3
0
        private void MessageReceived(IS_MSO mso)
        {
            try
            {
                string Msg = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart));

                if (Msg.StartsWith("!") == false)
                {
                    if (mso.UCID == 0 == false && _connections[mso.UCID].PName == HostName == false)
                    {
                        _connections[mso.UCID].timesChatted += 1;
                    }
                }
            }
            catch { }
        }
Example #4
0
        public static void MSO(InSim insim, IS_MSO MSO)
        {
            foreach (Connections Conn in Connections._connections.Values)
            {
                if (Conn.UCID == MSO.UCID)
                {
                    if (MSO.UserType == UserType.MSO_PREFIX)
                    {
                        string   Command = (((MSO.Msg.Substring(MSO.TextStart, (MSO.Msg.Length - MSO.TextStart))).Split(' ').Take(1).First()).Substring(1));
                        string[] Args    = ((MSO.Msg.Substring(MSO.TextStart, (MSO.Msg.Length - MSO.TextStart))).Split(' ').Skip(1).ToArray());

                        try
                        {
                            CommandHandler.Command.Get(Command, Args, Conn);
                        }
                        catch { }
                    }
                }
            }
        }
Example #5
0
        // Method called whenever an IS_MSO packet is received.
        public void MessageOut(InSim insim, IS_MSO mso)
        {
            // string datetime = DateTime.UtcNow.Hour + ":" + DateTime.UtcNow.Minute + "." + DateTime.UtcNow.Second + " ";
            TimeZone zone  = TimeZone.CurrentTimeZone;
            DateTime local = zone.ToLocalTime(DateTime.Now);

            string put = (mso.Msg);

            // Print out the message content.
            textBox2.Items.Insert(0, local + " " + put);

            StreamWriter w = File.AppendText("Log.txt");
            {
                w.WriteLine("[" + local + "] " + put);
                w.Close();
            }



            string Msg = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart));

            string[] StrMsg = Msg.Split(' ');

            switch (StrMsg[0])
            {
            case "<help":

                insim.Send(new IS_MSL {
                    Msg = "test"
                });

                break;

            default:
                if (StrMsg[0].StartsWith("<"))
                {
                }
                break;
            }
        }
Example #6
0
 private void MessageOut(InSim insim, IS_MSO mso)
 {
     AddNewLine(mso.Msg);
 }
Example #7
0
        private void MessageReceived(InSim insim, IS_MSO mso)
        {
            try
            {
                const string TimeFormat = "HH:mm";//ex: 23/03/2003
                {
                    chatbox.AppendText(StringHelper.StripColors(mso.Msg.ToString()) + " \r\n");

                    if (mso.UserType == UserType.MSO_PREFIX)
                    {
                        string   Text    = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart));
                        string[] command = Text.Split(' ');
                        command[0] = command[0].ToLower();

                        switch (command[0])
                        {
                        case "!test":

                            insim.Send(255, _connections[mso.UCID].PName + " ^8is a f****t.");

                            break;

                        case "!help":
                            _connections[mso.UCID].serverTime = true;

                            if (_connections[mso.UCID].DisplaysOpen == false)
                            {
                                HomeScreen(mso.UCID);
                                _connections[mso.UCID].DisplaysOpen = true;
                            }
                            else
                            {
                                insim.Send(255, DisplaysOpenedMsg);
                            }
                            break;

                        case "!send":

                            if (command.Length > 1)
                            {
                                if (Text.Contains("-") || Text.Contains("+"))
                                {
                                    insim.Send(mso.UCID, "^1Invalid format. ^7Usage: ^3!send <amount>");
                                }
                                else
                                {
                                    byte ButtonID1 = 150;
                                    byte LocationY = 15;

                                    _connections[mso.UCID].SendAmount = Convert.ToInt32(command[1]);
                                    insim.Send(mso.UCID, "^2€" + _connections[mso.UCID].SendAmount);

                                    foreach (var c in _connections.Values)
                                    {
                                        if (c.UName != "")
                                        {
                                            insim.Send(new IS_BTN {
                                                UCID = mso.UCID, ReqI = ButtonID1, ClickID = ButtonID1, BStyle = ButtonStyles.ISB_DARK | ButtonStyles.ISB_CLICK, H = 4, W = 20, T = LocationY, L = 69, Text = "^7" + c.PName + " ^3(" + c.UName + ") " + c.UCID
                                            });
                                        }

                                        LocationY += 4;
                                        ButtonID1++;
                                    }
                                }
                            }
                            else
                            {
                                insim.Send(mso.UCID, "^1Invalid command, ^3" + Text + " ^1did not work.");
                            }

                            break;

                        case "!ac":
                        {        //Admin chat
                            if (mso.UCID == _connections[mso.UCID].UCID)
                            {
                                if (!IsConnAdmin(_connections[mso.UCID]))
                                {
                                    insim.Send(mso.UCID, 0, "You are not an admin");
                                    break;
                                }
                                if (command.Length == 1)
                                {
                                    insim.Send(mso.UCID, 0, "^1Invalid command format. ^2Usage: ^7!ac <text>");
                                    break;
                                }

                                string atext = Text.Remove(0, command[0].Length + 1);

                                foreach (var Conn in _connections.Values)
                                {
                                    {
                                        if (IsConnAdmin(Conn) && Conn.UName != "")
                                        {
                                            insim.Send(Conn.UCID, 0, "^3Admin chat: ^7" + _connections[mso.UCID].PName + " ^8(" + _connections[mso.UCID].UName + "):");
                                            insim.Send(Conn.UCID, 0, "^7" + atext);
                                        }
                                    }
                                }
                            }

                            break;
                        }

                        case "!pos":

                            if (_connections[mso.UCID].IsAdmin == false)
                            {
                                insim.Send(mso.UCID, "^1Error: ^7You are not an Admin!");
                                break;
                            }
                            if (AskedPosition == true)
                            {
                                insim.Send(mso.UCID, "^1Error: ^7Someone else already wants their position, please try again.");
                                break;
                            }

                            //position @ MCI Packet
                            AskedPosUCID  = mso.UCID;
                            AskedPosition = true;
                            break;

                        case "!teamspeak":
                        case "!ts":

                            insim.Send(mso.UCID, "^7Teamspeak 3 Server: ^3" + "ts.eugaming.org");

                            break;

                        case "!p":
                        case "!pen":
                        case "!penalty":

                            insim.Send("/p_clear " + _connections[mso.UCID].UName);

                            break;

                        case "!ban":
                            var k = _connections[mso.UCID];
                            insim.Send(255, "^1Added ^7" + k.PName + " ^1to the ban list!");
                            SqlInfo.AddtoBanlist(k.UName, StringHelper.StripColors(k.PName), "14.01.2016", "no longer welcome");
                            break;

                        case "!show":
                        case "!showoff":
                            foreach (var conn in _connections.Values)
                            {
                                if (conn.UCID == mso.UCID)
                                {
                                    if (conn.PName.EndsWith("s"))
                                    {
                                        insim.Send(255, conn.PName + "^8' cars: ^2" + _connections[mso.UCID].cars);
                                    }
                                    else
                                    {
                                        insim.Send(255, conn.PName + "^8's cars: ^2" + _connections[mso.UCID].cars);
                                    }

                                    insim.Send(255, conn.PName + " ^8has driven: ^2" + string.Format("{0:n0}", conn.TotalDistance / 1000) + " kms ^8- ^2" + string.Format("{0:n0}", conn.TotalDistance / 1609) + " mi");
                                    insim.Send(255, conn.PName + " ^8registered: ^2" + conn.regdate);

                                    TimeSpan span = TimeSpan.FromSeconds(conn.TotalConnectionTime);
                                    string   hrs  = span.ToString(@"hh\:mm\:ss");

                                    insim.Send(255, conn.PName + " ^8has played: ^2" + hrs);


                                    // insim.Send(255, "^6Showoff for ^7" + _connections[mso.UCID].PName + " ^6(^7" + _connections[mso.UCID].UName + "^6)");
                                    // insim.Send(255, "^6Cash: ^2€" + string.Format("{0:n0}", conn.cash));
                                    // insim.Send(255, "^6Bankbalance: ^2€" + string.Format("{0:n0}", conn.bankbalance));
                                    // insim.Send(255, "^6Total distance driven: ^7" + string.Format("{0:n0}", conn.TotalDistance / 1000) + " kms^6/^7" + string.Format("{0:n0}", conn.TotalDistance / 1609) + " mi");



                                    // insim.Send(255, "^6Jobs completed: ^7" + string.Format("{0:n0}", _connections[mso.UCID].totaljobsdone));
                                    // insim.Send(255, "^6Cash earned from jobs: ^2€" + string.Format("{0:n0}", _connections[mso.UCID].totalearnedfromjobs));
                                    // insim.Send(255, "^6Last seen: ^7" + _connections[mso.UCID].lastseen);
                                    // insim.Send(255, "^6Registration date: ^7" + _connections[mso.UCID].regdate);
                                }
                            }
                            break;

                        case "!gmt":

                            var connn = _connections[mso.UCID];
                            if (command.Length == 1)
                            {
                                insim.Send(mso.UCID, "^1Invalid command. ^7Usage: ^3!gmt <timezone>");
                            }
                            else if (command.Length == 2)
                            {
                                #region ' Command '
                                if (command[1] == "-12" || command[1] == "-12:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -12;
                                }
                                else if (command[1] == "-11" || command[1] == "-11:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -11;
                                }
                                else if (command[1] == "-10" || command[1] == "-10:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -10;
                                }
                                else if (command[1] == "-9" || command[1] == "-9:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -9;
                                }
                                else if (command[1] == "-8" || command[1] == "-8:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -8;
                                }
                                else if (command[1] == "-7" || command[1] == "-7:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -7;
                                }
                                else if (command[1] == "-6" || command[1] == "-6:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -6;
                                }
                                else if (command[1] == "-5" || command[1] == "-5:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -5;
                                }
                                else if (command[1] == "-4" || command[1] == "-4:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -4;
                                }
                                else if (command[1] == "-3" || command[1] == "-3:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -3;
                                }
                                else if (command[1] == "-2" || command[1] == "-2:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -2;
                                }
                                else if (command[1] == "-1" || command[1] == "-1:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -1;
                                }
                                else if (command[1] == "0" || command[1] == "0:00" || command[1] == "+0" || command[1] == "+0:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "default (GMT 0:00)");
                                    connn.Timezone = 0;
                                }
                                else if (command[1] == "1" || command[1] == "1:00" || command[1] == "+1" || command[1] == "+1:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 1;
                                }
                                else if (command[1] == "2" || command[1] == "2:00" || command[1] == "+2" || command[1] == "+2:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 2;
                                }
                                else if (command[1] == "3" || command[1] == "3:00" || command[1] == "+3" || command[1] == "+3:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 3;
                                }
                                else if (command[1] == "4" || command[1] == "4:00" || command[1] == "+4" || command[1] == "+4:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 4;
                                }
                                else if (command[1] == "5" || command[1] == "5:00" || command[1] == "+5" || command[1] == "+5:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 5;
                                }
                                else if (command[1] == "6" || command[1] == "6:00" || command[1] == "+6" || command[1] == "+6:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 6;
                                }
                                else if (command[1] == "7" || command[1] == "7:00" || command[1] == "+7" || command[1] == "+7:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 7;
                                }
                                else if (command[1] == "8" || command[1] == "8:00" || command[1] == "+8" || command[1] == "+8:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 8;
                                }
                                else if (command[1] == "9" || command[1] == "9:00" || command[1] == "+9" || command[1] == "+9:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 9;
                                }
                                else if (command[1] == "10" || command[1] == "10:00" || command[1] == "+10" || command[1] == "+10:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 10;
                                }
                                else if (command[1] == "11" || command[1] == "11:00" || command[1] == "+11" || command[1] == "+11:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 11;
                                }
                                else if (command[1] == "12" || command[1] == "12:00" || command[1] == "+12" || command[1] == "+12:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 12;
                                }
                                #endregion
                            }
                            break;

                        default:
                            insim.Send(mso.UCID, 0, "^8Invalid command, type {0} to see available commands", "^2!help^8");
                            break;
                        }
                    }
                }
            }
            catch (Exception e) { LogTextToFile("commands", "[" + mso.UCID + "] " + StringHelper.StripColors(_connections[mso.UCID].PName) + "(" + GetConnection(mso.PLID).UName + ") NPL - Exception: " + e, false); }
        }
Example #8
0
        private void MessageReceived(InSim insim, IS_MSO mso)
        {
            try
            {
                // const string TimeFormat = "HH:mm";//ex: 23/03/2003
                {
                    // chatbox.Text += StringHelper.StripColors(mso.Msg.ToString() + " \r\n");

                    if (mso.UserType == UserType.MSO_PREFIX)
                    {
                        string   Text    = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart));
                        string[] command = Text.Split(' ');
                        command[0] = command[0].ToLower();

                        switch (command[0])
                        {
                        case "!e":

                            insim.Send(255, "^3amount: ^7" + _players.Count());

                            break;

                        case "!ap":
                        case "!adminpanel":
                            var conn = _connections[mso.UCID];

                            ptsFIRST  = Convert.ToInt32(onepts);
                            ptsSECOND = Convert.ToInt32(twopts);
                            ptsTHIRD  = Convert.ToInt32(threepts);
                            ptsFORTH  = Convert.ToInt32(fourpts);

                            if (conn.IsAdmin == true)
                            {
                                if (conn.inAP == false)
                                {
                                    #region ' buttons '

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 25,
                                        ClickID = 25,
                                        BStyle  = ButtonStyles.ISB_DARK,
                                        H       = 80,
                                        W       = 50,
                                        T       = 52, // up to down
                                        L       = 75, // left to right
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 26,
                                        ClickID = 26,
                                        BStyle  = ButtonStyles.ISB_LIGHT,
                                        H       = 9,
                                        W       = 48,
                                        T       = 53, // up to down
                                        L       = 76, // left to right
                                        Text    = "^7ADMIN PANEL"
                                    });



                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 27,
                                        ClickID = 27,
                                        BStyle  = ButtonStyles.ISB_C4,
                                        H       = 5,
                                        W       = 48,
                                        T       = 65, // up to down
                                        L       = 76, // left to right
                                        Text    = "^3** Point Administration **"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 28,
                                        ClickID = 28,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 73, // up to down
                                        L       = 88, // left to right
                                        Text    = "^31st. Place:"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 29,
                                        ClickID = 29,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 77, // up to down
                                        L       = 88, // left to right
                                        Text    = "^32nd Place:"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 30,
                                        ClickID = 30,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 81, // up to down
                                        L       = 88, // left to right
                                        Text    = "^33rd Place:"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 31,
                                        ClickID = 31,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 85, // up to down
                                        L       = 88, // left to right
                                        Text    = "^34th Place:"
                                    });



                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 32,
                                        ClickID = 32,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 73,  // up to down
                                        L       = 102, // left to right
                                        Text    = "^7" + ptsFIRST,
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 1st place"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 33,
                                        ClickID = 33,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 77,  // up to down
                                        L       = 102, // left to right
                                        Text    = "^7" + ptsSECOND,
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 2nd place"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 34,
                                        ClickID = 34,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 81,  // up to down
                                        L       = 102, // left to right
                                        Text    = "^7" + ptsTHIRD,
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 3rd place"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 35,
                                        ClickID = 35,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 85,  // up to down
                                        L       = 102, // left to right
                                        Text    = "^7" + ptsFORTH,
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 4th place"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 36,
                                        ClickID = 36,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 10,
                                        T       = 73,  // up to down
                                        L       = 111, // left to right
                                        Text    = "^7DEFAULT"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 135,
                                        ClickID = 135,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 10,
                                        T       = 77,  // up to down
                                        L       = 111, // left to right
                                        Text    = "^7ANNOUNCE"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 37,
                                        ClickID = 37,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 10,
                                        T       = 85,  // up to down
                                        L       = 111, // left to right
                                        Text    = "^7CLOSE"
                                    });



                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 38,
                                        ClickID = 38,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 19,
                                        T       = 92, // up to down
                                        L       = 82, // left to right
                                        Text    = "^3Point System:"
                                    });

                                    #region ' Point system '
                                    if (PointSystem == true)
                                    {
                                        insim.Send(new IS_BTN
                                        {
                                            UCID    = mso.UCID,
                                            ReqI    = 39,
                                            ClickID = 39,
                                            BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                            H       = 4,
                                            W       = 8,
                                            T       = 92,  // up to down
                                            L       = 102, // left to right
                                            Text    = "^2Enabled"
                                        });
                                    }
                                    else
                                    {
                                        insim.Send(new IS_BTN
                                        {
                                            UCID    = mso.UCID,
                                            ReqI    = 39,
                                            ClickID = 39,
                                            BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                            H       = 4,
                                            W       = 8,
                                            T       = 92,  // up to down
                                            L       = 102, // left to right
                                            Text    = "^1Disabled"
                                        });
                                    }

                                    #endregion


                                    #endregion

                                    conn.inAP = true;
                                }
                                else
                                {
                                    insim.Send(mso.UCID, "^1Du er allerede i admin panelet!");
                                }
                            }
                            else
                            {
                                insim.Send(mso.UCID, "^1No access");
                            }

                            break;

                        case "!track":

                            insim.Send(mso.UCID, "^3Track: ^8" + TrackName + " - " + TrackHelper.GetFullTrackName(TrackName));


                            break;

                        case "!test":

                            insim.Send(255, ".CurrentMapHotlap: " + _connections[mso.UCID].CurrentMapHotlap);

                            break;

                        case "!deletepts":
                        case "!deletepoints":
                        case "!delpts":
                            _connections[mso.UCID].points = 0;
                            SqlInfo.deleteownPTS(_connections[mso.UCID].UName);
                            insim.Send(mso.UCID, "^8Your points has reset");
                            UpdateGui(255, true);
                            break;

                        case "!deletedist":
                        case "!deletedistance":
                        case "!deldist":
                            _connections[mso.UCID].TotalDistance = 0;
                            SqlInfo.deleteownDIST(_connections[mso.UCID].UName);
                            insim.Send(mso.UCID, "^8Your total distance has reset");
                            UpdateGui(255, true);
                            break;

                        case "!deleteptsall":
                        case "!deletepointsall":
                        case "!delptsall":
                            if (_connections[mso.UCID].IsAdmin == true)
                            {
                                insim.Send(mso.UCID, "^3" + dbCount + " ^8entries of column ^3points ^8deleted");
                                UpdateGui(255, true);
                            }
                            else
                            {
                                insim.Send(mso.UCID, "^1No access");
                            }

                            foreach (var conns in _connections.Values)
                            {
                                conns.points = 0;
                                SqlInfo.deletePTS();
                            }
                            break;

                        case "!deldistanceall":
                        case "!deldistall":
                        case "!deletedistall":
                        case "!deletedistanceall":
                            if (_connections[mso.UCID].IsAdmin == true)
                            {
                                foreach (var conns in _connections.Values)
                                {
                                    conns.TotalDistance = 0;
                                    SqlInfo.deleteDIST();
                                }

                                insim.Send(mso.UCID, "^3" + dbCount + " ^8entries of column ^3distance ^8deleted.");
                                UpdateGui(255, true);
                            }
                            else
                            {
                                insim.Send(mso.UCID, "^1No access");
                            }
                            break;

                        case "!ac":
                        {        //Admin chat
                            if (mso.UCID == _connections[mso.UCID].UCID)
                            {
                                if (!IsConnAdmin(_connections[mso.UCID]))
                                {
                                    insim.Send(mso.UCID, 0, "You are not an admin");
                                    break;
                                }
                                if (command.Length == 1)
                                {
                                    insim.Send(mso.UCID, 0, "^1Invalid command format. ^2Usage: ^7!ac <text>");
                                    break;
                                }

                                string atext = Text.Remove(0, command[0].Length + 1);

                                foreach (var Conn in _connections.Values)
                                {
                                    {
                                        if (IsConnAdmin(Conn) && Conn.UName != "")
                                        {
                                            insim.Send(Conn.UCID, 0, "^3Admin chat: ^7" + _connections[mso.UCID].PName + " ^8(" + _connections[mso.UCID].UName + "):");
                                            insim.Send(Conn.UCID, 0, "^7" + atext);
                                        }
                                    }
                                }
                            }

                            break;
                        }

                        case "!p":
                        case "!pen":
                        case "!penalty":
                            insim.Send("/p_clear " + _connections[mso.UCID].UName);
                            break;

                        case "!help":
                            insim.Send(mso.UCID, 0, "^3Help commands (temporary list):");
                            insim.Send(mso.UCID, 0, "^7!help ^8- See a list of available commands");



                            // Admin commands
                            foreach (var CurrentConnection in _connections.Values)
                            {
                                if (CurrentConnection.UCID == mso.UCID)
                                {
                                    if (IsConnAdmin(CurrentConnection) && CurrentConnection.UName != "")
                                    {
                                        insim.Send(CurrentConnection.UCID, 0, "^3Administrator commands:");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!ac ^8- Talk with the other admins that are online");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!pos ^8- Check your current position in x y z");
                                    }
                                }
                            }

                            break;

                        default:
                            insim.Send(mso.UCID, 0, "^8Invalid command, type ^2{0}^8 to see available commands", "!help");
                            break;
                        }
                    }
                }
            }
            catch (Exception e) { LogTextToFile("commands", "[" + mso.UCID + "] " + StringHelper.StripColors(_connections[mso.UCID].PName) + "(" + GetConnection(mso.PLID).UName + ") NPL - Exception: " + e, false); }
        }
Example #9
0
        private void MessageReceived(InSim insim, IS_MSO mso)
        {
            try
            {
                {
                    if (mso.UserType == UserType.MSO_PREFIX)
                    {
                        string Text = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart));

                        string[] command = Text.Split(' ');
                        command[0] = command[0].ToLower();
                        var conn = _connections[mso.UCID];

                        switch (command[0])
                        {
                        case "!find":

                            insim.Send(mso.UCID, "^8Been online for ^3" + conn.totalplaytime + " seconds");

                            break;

                        case "!info":

                            CommandInfo(mso.UCID);

                            break;

                        case "!stats":

                            if (conn.DisplaysOpen == false && conn.inStats == false)
                            {
                                CommandStats(mso.UCID);
                            }

                            break;


                        case "!ac":
                        {        //Admin chat
                            if (mso.UCID == _connections[mso.UCID].UCID)
                            {
                                if (!IsConnAdmin(_connections[mso.UCID]))
                                {
                                    insim.Send(mso.UCID, 0, "You are not an admin");
                                    break;
                                }
                                if (command.Length == 1)
                                {
                                    insim.Send(mso.UCID, 0, "^1Invalid command format. ^2Usage: ^7!ac <text>");
                                    break;
                                }

                                string atext = Text.Remove(0, command[0].Length + 1);

                                foreach (var Conn in _connections.Values)
                                {
                                    {
                                        if (IsConnAdmin(Conn) && Conn.UName != "")
                                        {
                                            insim.Send(Conn.UCID, 0, "^3Admin Chat ^7" + _connections[mso.UCID].PName + " ^8(" + _connections[mso.UCID].UName + "):");
                                            insim.Send(Conn.UCID, 0, "^7" + atext);
                                        }
                                    }
                                }
                            }

                            break;
                        }

                        case "!pos":

                            if (_connections[mso.UCID].IsAdmin == false)
                            {
                                insim.Send(mso.UCID, "^1Error: ^7You are not an Admin!");
                                break;
                            }
                            if (AskedPosition == true)
                            {
                                insim.Send(mso.UCID, "^1Error: ^7Someone else already wants their position, please try again.");
                                break;
                            }

                            //position @ MCI Packet
                            AskedPosUCID  = mso.UCID;
                            AskedPosition = true;
                            break;

                        case "!teamspeak":
                        case "!ts":

                            insim.Send(mso.UCID, "^8Teamspeak 3 Server: ^3" + "ts.eugaming.org");

                            break;

                        case "!website":
                        case "!web":

                            insim.Send(mso.UCID, "^8Our website: ^3" + "www.eugaming.org");
                            insim.Send(mso.UCID, "^8Global statistics can be found on the website too.");

                            break;

                        case "!p":
                        case "!pen":
                        case "!penalty":

                            insim.Send("/p_clear " + _connections[mso.UCID].UName);

                            break;

                        case "!ban":
                            insim.Send(mso.UCID, "^8This command is inactive");
                            SqlInfo.AddtoBanlist(k.UName, StringHelper.StripColors(k.PName), "14.01.2016", "no longer welcome");
                            break;

                        case "!help":
                            insim.Send(mso.UCID, 0, "^3Commands:");
                            insim.Send(mso.UCID, 0, "^7!help ^8- See a list of available commands");
                            insim.Send(mso.UCID, 0, "^7!info ^8- See a few lines of server info");
                            insim.Send(mso.UCID, 0, "^7!stats ^8- Check your personal stats");
                            insim.Send(mso.UCID, 0, "^7!pen (!p) ^8- Remove the pit penalty");
                            insim.Send(mso.UCID, 0, "^7!gmt <timezone> ^8- Set your own timezone, ex: !gmt +12");
                            insim.Send(mso.UCID, 0, "^7!teamspeak (!ts) ^8- To view our teamspeak address");
                            insim.Send(mso.UCID, 0, "^7!website (!web) ^8- To view our website address");

                            // Admin commands
                            foreach (var CurrentConnection in _connections.Values)
                            {
                                if (CurrentConnection.UCID == mso.UCID)
                                {
                                    if (IsConnAdmin(CurrentConnection) && CurrentConnection.UName != "")
                                    {
                                        insim.Send(CurrentConnection.UCID, 0, "^3Administrator commands:");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!ac ^8- Talk with the other admins that are online");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!pos ^8- Check your current position in x, y, z");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!ban <username> <days> ^8- Ban the selected player for x days (0 = 12 hours)");
                                    }
                                }
                            }

                            break;

                        case "!gmt":

                            var connn = _connections[mso.UCID];
                            if (command.Length == 1)
                            {
                                insim.Send(mso.UCID, "^1Invalid command. ^7Usage: ^3!gmt <timezone>");
                            }
                            else if (command.Length == 2)
                            {
                                #region ' Command '
                                if (command[1] == "-12" || command[1] == "-12:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -12;
                                }
                                else if (command[1] == "-11" || command[1] == "-11:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -11;
                                }
                                else if (command[1] == "-10" || command[1] == "-10:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -10;
                                }
                                else if (command[1] == "-9" || command[1] == "-9:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -9;
                                }
                                else if (command[1] == "-8" || command[1] == "-8:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -8;
                                }
                                else if (command[1] == "-7" || command[1] == "-7:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -7;
                                }
                                else if (command[1] == "-6" || command[1] == "-6:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -6;
                                }
                                else if (command[1] == "-5" || command[1] == "-5:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -5;
                                }
                                else if (command[1] == "-4" || command[1] == "-4:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -4;
                                }
                                else if (command[1] == "-3" || command[1] == "-3:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -3;
                                }
                                else if (command[1] == "-2" || command[1] == "-2:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -2;
                                }
                                else if (command[1] == "-1" || command[1] == "-1:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = -1;
                                }
                                else if (command[1] == "0" || command[1] == "0:00" || command[1] == "+0" || command[1] == "+0:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "default (GMT 0:00)");
                                    connn.Timezone = 0;
                                }
                                else if (command[1] == "1" || command[1] == "1:00" || command[1] == "+1" || command[1] == "+1:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 1;
                                }
                                else if (command[1] == "2" || command[1] == "2:00" || command[1] == "+2" || command[1] == "+2:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 2;
                                }
                                else if (command[1] == "3" || command[1] == "3:00" || command[1] == "+3" || command[1] == "+3:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 3;
                                }
                                else if (command[1] == "4" || command[1] == "4:00" || command[1] == "+4" || command[1] == "+4:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 4;
                                }
                                else if (command[1] == "5" || command[1] == "5:00" || command[1] == "+5" || command[1] == "+5:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 5;
                                }
                                else if (command[1] == "6" || command[1] == "6:00" || command[1] == "+6" || command[1] == "+6:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 6;
                                }
                                else if (command[1] == "7" || command[1] == "7:00" || command[1] == "+7" || command[1] == "+7:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 7;
                                }
                                else if (command[1] == "8" || command[1] == "8:00" || command[1] == "+8" || command[1] == "+8:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 8;
                                }
                                else if (command[1] == "9" || command[1] == "9:00" || command[1] == "+9" || command[1] == "+9:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 9;
                                }
                                else if (command[1] == "10" || command[1] == "10:00" || command[1] == "+10" || command[1] == "+10:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 10;
                                }
                                else if (command[1] == "11" || command[1] == "11:00" || command[1] == "+11" || command[1] == "+11:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 11;
                                }
                                else if (command[1] == "12" || command[1] == "12:00" || command[1] == "+12" || command[1] == "+12:00")
                                {
                                    insim.Send(mso.UCID, "^8Your timezone has been set to ^3" + "GMT " + command[1]);
                                    connn.Timezone = 12;
                                }
                                #endregion
                            }
                            break;

                        default:
                            insim.Send(mso.UCID, 0, "^8Invalid command, type {0} to see available commands", "^2!help^8");
                            break;
                        }
                    }
                    else
                    {
                        chat.Text += SqlInfo.RemoveStupidCharacters(StringHelper.StripColors(mso.Msg + " \r\n"));
                    }
                }
            }
            catch (Exception e) { LogTextToFile("commands", "[" + mso.UCID + "] " + StringHelper.StripColors(_connections[mso.UCID].PName) + "(" + GetConnection(mso.PLID).UName + ") NPL - Exception: " + e, false); }
        }
Example #10
0
        private void MessageReceived(InSim insim, IS_MSO mso)
        {
            try
            {
                {
                    if (mso.UserType == UserType.MSO_PREFIX)
                    {
                        string   Text    = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart));
                        string[] command = Text.Split(' ');
                        command[0] = command[0].ToLower();

                        switch (command[0])
                        {
                        case "!ac":
                        {        //Admin chat
                            if (mso.UCID == _connections[mso.UCID].UCID)
                            {
                                if (!IsConnAdmin(_connections[mso.UCID]))
                                {
                                    insim.Send(mso.UCID, 0, "You are not an admin");
                                    break;
                                }
                                if (command.Length == 1)
                                {
                                    insim.Send(mso.UCID, 0, "^1Invalid command format. ^2Usage: ^7!ac <text>");
                                    break;
                                }

                                string atext = Text.Remove(0, command[0].Length + 1);

                                foreach (var Conn in _connections.Values)
                                {
                                    {
                                        if (IsConnAdmin(Conn) && Conn.UName != "")
                                        {
                                            insim.Send(Conn.UCID, 0, "^3Admin chat: ^7" + _connections[mso.UCID].PName + " ^8(" + _connections[mso.UCID].UName + "):");
                                            insim.Send(Conn.UCID, 0, "^3: ^7" + atext);
                                        }
                                    }
                                }
                            }

                            break;
                        }

                        case "!help":
                            insim.Send(mso.UCID, 0, "^3Help commands (temporary list):");
                            insim.Send(mso.UCID, 0, "^7!help ^8- See a list of available commands");
                            insim.Send(mso.UCID, 0, "^7!info ^8- See a few lines of server info");


                            // Admin commands
                            foreach (var CurrentConnection in _connections.Values)
                            {
                                if (CurrentConnection.UCID == mso.UCID)
                                {
                                    if (IsConnAdmin(CurrentConnection) && CurrentConnection.UName != "")
                                    {
                                        insim.Send(CurrentConnection.UCID, 0, "^3Administrator commands:");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!ac ^8- Talk with the other admins that are online");
                                    }
                                }
                            }

                            insim.Send(mso.UCID, "^8Playername: ^7" + StringHelper.StripColors(_connections[mso.UCID].PName));

                            break;

                        case "!info":

                            int count = _connections.Count - 1;

                            insim.Send(mso.UCID, 0, "^3Server Info (temporary list):");
                            insim.Send(mso.UCID, 0, "^8Players connected: ^2" + count);
                            insim.Send(mso.UCID, 0, "^8Players on the track: ^2" + _players.Count);
                            break;

                        case "!s":
                            foreach (var CurrentConnection in _players.Values)
                            {
                                if (CurrentConnection.UCID == mso.UCID)
                                {
                                    insim.Send(mso.UCID, "^8Current speed: ^3{0} ^8kmh, ^3{1} ^8mph", CurrentConnection.kmh, CurrentConnection.mph);
                                }
                            }
                            break;

                        case "!show":
                        case "!showoff":
                        case "!stats":
                            foreach (var conn in _connections.Values)
                            {
                                if (conn.UCID == mso.UCID)
                                {
                                    insim.Send(255, "^8Showoff for ^7" + _connections[mso.UCID].PName + " ^8(" + _connections[mso.UCID].UName + ")");
                                    insim.Send(255, "^8Cash: ^2€" + conn.cash);
                                }
                            }
                            break;

                        default:
                            insim.Send(mso.UCID, 0, "^8Invalid command, check out {0} for commands", "^2!help^8");
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("" + e, "AN ERROR OCCURED");
                insim.Send(255, "^8An error occured: ^1{0}", e);
            }
        }
Example #11
0
        private void MessageReceived(InSim insim, IS_MSO mso)
        {
            try
            {
                // const string TimeFormat = "HH:mm";//ex: 23/03/2003
                {
                    // chatbox.Text += StringHelper.StripColors(mso.Msg.ToString() + " \r\n");

                    if (mso.UserType == UserType.MSO_PREFIX)
                    {
                        string   Text    = mso.Msg.Substring(mso.TextStart, (mso.Msg.Length - mso.TextStart));
                        string[] command = Text.Split(' ');
                        command[0] = command[0].ToLower();

                        switch (command[0])
                        {
                        case "!ap":
                        case "!adminpanel":
                            var conn = _connections[mso.UCID];

                            if (conn.IsAdmin == true)
                            {
                                if (conn.inAP == false)
                                {
                                    #region ' buttons '

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 25,
                                        ClickID = 25,
                                        BStyle  = ButtonStyles.ISB_DARK,
                                        H       = 80,
                                        W       = 50,
                                        T       = 52, // up to down
                                        L       = 75, // left to right
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 26,
                                        ClickID = 26,
                                        BStyle  = ButtonStyles.ISB_LIGHT,
                                        H       = 9,
                                        W       = 48,
                                        T       = 53, // up to down
                                        L       = 76, // left to right
                                        Text    = "^7ADMIN PANELET"
                                    });



                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 27,
                                        ClickID = 27,
                                        BStyle  = ButtonStyles.ISB_C4,
                                        H       = 5,
                                        W       = 48,
                                        T       = 65, // up to down
                                        L       = 76, // left to right
                                        Text    = "^3** Point Administration **"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 28,
                                        ClickID = 28,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 73, // up to down
                                        L       = 88, // left to right
                                        Text    = "^71. place:"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 29,
                                        ClickID = 29,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 77, // up to down
                                        L       = 88, // left to right
                                        Text    = "^72. place:"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 30,
                                        ClickID = 30,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 81, // up to down
                                        L       = 88, // left to right
                                        Text    = "^73. place:"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 31,
                                        ClickID = 31,
                                        BStyle  = ButtonStyles.ISB_RIGHT,
                                        H       = 4,
                                        W       = 13,
                                        T       = 85, // up to down
                                        L       = 88, // left to right
                                        Text    = "^74. place:"
                                    });



                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 32,
                                        ClickID = 32,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 73,  // up to down
                                        L       = 102, // left to right
                                        Text    = "",
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 1st place"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 33,
                                        ClickID = 33,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 77,  // up to down
                                        L       = 102, // left to right
                                        Text    = "",
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 2nd place"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 34,
                                        ClickID = 34,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 81,  // up to down
                                        L       = 102, // left to right
                                        Text    = "",
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 3rd place"
                                    });

                                    insim.Send(new IS_BTN
                                    {
                                        UCID    = mso.UCID,
                                        ReqI    = 35,
                                        ClickID = 35,
                                        BStyle  = ButtonStyles.ISB_LIGHT | ButtonStyles.ISB_CLICK,
                                        H       = 4,
                                        W       = 5,
                                        T       = 85,  // up to down
                                        L       = 102, // left to right
                                        Text    = "",
                                        TypeIn  = 3,
                                        Caption = "^0Amount of points to reward 4th place"
                                    });



                                    #endregion

                                    conn.inAP = true;
                                }
                                else
                                {
                                    insim.Send(mso.UCID, "^1Du er allerede i admin panelet!");
                                }
                            }
                            else
                            {
                                insim.Send(mso.UCID, "^1Ingen tilgang");
                            }

                            break;

                        case "!t":

                            insim.Send(mso.UCID, "^8Distance: ^3+3 km");
                            _connections[mso.UCID].TotalDistance += 3000;

                            break;

                        case "!test":
                            // MessageToAdmins("nub");

                            insim.Send(mso.UCID, "^8Distance: ^3" + _connections[mso.UCID].TotalDistance);
                            insim.Send(mso.UCID, "^8Nickname: ^3" + _connections[mso.UCID].PName);
                            insim.Send(mso.UCID, "^8Points: ^3" + _connections[mso.UCID].points);



                            break;

                        case "!stats":

                            insim.Send(mso.UCID, "^8Elapsed race time: ^3" + _connections[mso.UCID].ERaceTime);
                            insim.Send(mso.UCID, "^8Laps done: ^3" + _connections[mso.UCID].LapsDone);
                            insim.Send(mso.UCID, "^8Pitstops: ^3" + _connections[mso.UCID].NumStops);
                            insim.Send(mso.UCID, "^8Lap time: ^3" + _connections[mso.UCID].LapTime);
                            insim.Send(mso.UCID, "^8Car: ^3" + _connections[mso.UCID].CarName);
                            insim.Send(mso.UCID, "^8Track: ^3" + TrackName.ToUpper());

                            insim.Send(mso.UCID, "^3[" + TrackName + "] ^8Completed a lap: ^3" + string.Format("{0:00}:{1:00}:{2:0}",
                                                                                                               (int)_connections[mso.UCID].LapTime.Minutes,
                                                                                                               _connections[mso.UCID].LapTime.Seconds,
                                                                                                               _connections[mso.UCID].LapTime.Milliseconds) + " ^8- ^3" + _connections[mso.UCID].CarName);

                            break;

                        case "!ac":
                        {        //Admin chat
                            if (mso.UCID == _connections[mso.UCID].UCID)
                            {
                                if (!IsConnAdmin(_connections[mso.UCID]))
                                {
                                    insim.Send(mso.UCID, 0, "You are not an admin");
                                    break;
                                }
                                if (command.Length == 1)
                                {
                                    insim.Send(mso.UCID, 0, "^1Invalid command format. ^2Usage: ^7!ac <text>");
                                    break;
                                }

                                string atext = Text.Remove(0, command[0].Length + 1);

                                foreach (var Conn in _connections.Values)
                                {
                                    {
                                        if (IsConnAdmin(Conn) && Conn.UName != "")
                                        {
                                            insim.Send(Conn.UCID, 0, "^3Admin chat: ^7" + _connections[mso.UCID].PName + " ^8(" + _connections[mso.UCID].UName + "):");
                                            insim.Send(Conn.UCID, 0, "^7" + atext);
                                        }
                                    }
                                }
                            }

                            break;
                        }

                        case "!p":
                        case "!pen":
                        case "!penalty":
                            insim.Send("/p_clear " + _connections[mso.UCID].UName);
                            break;

                        case "!help":
                            insim.Send(mso.UCID, 0, "^3Help commands (temporary list):");
                            insim.Send(mso.UCID, 0, "^7!help ^8- See a list of available commands");
                            insim.Send(mso.UCID, 0, "^7!info ^8- See a few lines of server info");
                            insim.Send(mso.UCID, 0, "^7!showoff (!show) ^8- Show your stats to everyone connected to the server");
                            insim.Send(mso.UCID, 0, "^7!pen (!p) ^8- Remove the pit penalty");
                            insim.Send(mso.UCID, 0, "^7!gmt <timezone> ^8- Set your own timezone, ex: !gmt +12");



                            // Admin commands
                            foreach (var CurrentConnection in _connections.Values)
                            {
                                if (CurrentConnection.UCID == mso.UCID)
                                {
                                    if (IsConnAdmin(CurrentConnection) && CurrentConnection.UName != "")
                                    {
                                        insim.Send(CurrentConnection.UCID, 0, "^3Administrator commands:");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!ac ^8- Talk with the other admins that are online");
                                        insim.Send(CurrentConnection.UCID, 0, "^7!pos ^8- Check your current position in x y z");
                                    }
                                }
                            }

                            break;

                        default:
                            insim.Send(mso.UCID, 0, "^8Invalid command, type ^2{0}^8 to see available commands", "!help");
                            break;
                        }
                    }
                }
            }
            catch (Exception e) { LogTextToFile("commands", "[" + mso.UCID + "] " + StringHelper.StripColors(_connections[mso.UCID].PName) + "(" + GetConnection(mso.PLID).UName + ") NPL - Exception: " + e, false); }
        }