コード例 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            contador--;

            if (contador <= 0)
            {
                Server = new Fivem("om4z9r");
                UpdatePlayerList();
                contador = 5;
            }
        }
コード例 #2
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            contador--;

            if (contador <= 0)
            {
                Server = new Fivem("151.80.111.185:30120");
                if (Server != null)
                {
                    UpdatePlayerList();
                }
                contador = 5;
            }
        }
コード例 #3
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);
        }
コード例 #4
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;
            }
        }
コード例 #5
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;
            }
        }
コード例 #6
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Server = new Fivem("cfxkod");
     GetStat();
     Rpc.SetupRpc();
 }