예제 #1
0
 void GetStat()
 {
     if (Server.GetStatu())
     {
         labelCount.Text = " " + Server.GetOnlinePlayersCount().ToString() + " / " + Server.GetMaxPlayersCount() + " OYUNCU";
     }
     else
     {
         labelCount.Text      = "SUNUCU BAKIMDA";
         labelCount.ForeColor = Color.Red;
     }
 }
예제 #2
0
        public static FiveMServerStatusReturnModel CheckFiveMServerPlayerCount()
        {
            //https://github.com/ErenKrt/Fivem-Server-Status
            var server_status_model = new FiveMServerStatusReturnModel();

            try
            {
                var status_response = new Fivem(string.Format("{0}:{1}", fivem_bluebird_hostname, fivem_bluebird_port));
                if (status_response.GetStatu())
                {
                    server_status_model.server_online       = true;
                    server_status_model.raw_server_response = status_response;

                    var ClassObject = status_response.GetObject();

                    server_status_model.max_users     = status_response.GetMaxPlayersCount();
                    server_status_model.current_users = status_response.GetOnlinePlayersCount();

                    //Console.WriteLine(status_response.GetGameName()); //string
                    //Console.WriteLine(status_response.GetMaxPlayersCount());  //int
                    //Console.WriteLine(status_response.GetOnlinePlayersCount());  //int
                    //Console.WriteLine(status_response.GetPlayers()); //object list
                    //Console.WriteLine(status_response.GetResources()); //string list
                    //Console.WriteLine(status_response.GetServerHost());  //string
                    //Console.WriteLine(status_response.GetStatu()); // server online(bool=true) or ofline(bool=false)
                    //Console.WriteLine(status_response.GetVars()); //object list
                    //Console.WriteLine(status_response.GetVars());
                    //var xD = status_response.GetVars();
                    //for (int i = 0; i < xD.Count; i++)
                    //{
                    //    var name = xD[i].key;
                    //    var value = xD[i].value;

                    //    Console.WriteLine("{0}:{1}", name, value);
                    //}
                }
                else
                {
                    throw new Exception("Server connection failed!  Couldn't check status!");
                }
            }
            catch (Exception ex)
            {
                LogMessage(ex.Message);
                LogException(ex);
                server_status_model.server_online = false;
            }
            return(server_status_model);
        }
예제 #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Server = new Fivem("151.80.111.185:30120");
            timer1.Start();

            if (Server.GetStatu())
            {
                label6.Text      = "Server ON";
                label6.ForeColor = Color.Green;
                UpdatePlayerList();
            }
            else
            {
                label6.Text      = "Server ON";
                label6.ForeColor = Color.Red;
            }
        }
예제 #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Server = new Fivem("om4z9r");
            timer1.Start();

            if (Server.GetStatu())
            {
                label2.Text      = "Server is Online";
                label2.ForeColor = Color.Green;
                UpdatePlayerList();
            }
            else
            {
                label2.Text      = "Server is Offline";
                label2.ForeColor = Color.Red;
            }
        }