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); }
void GetStat() { if (Server.GetStatu()) { labelCount.Text = " " + Server.GetOnlinePlayersCount().ToString() + " / " + Server.GetMaxPlayersCount() + " OYUNCU"; } else { labelCount.Text = "SUNUCU BAKIMDA"; labelCount.ForeColor = Color.Red; } }
public void UpdatePlayerList() { label3.Text = "Conectados: " + Server.GetOnlinePlayersCount().ToString() + " / " + Server.GetMaxPlayersCount(); }