Added and changed documentation for some functions. Hopefully fixed #54

This commit is contained in:
EntenKoeniq
2022-03-25 15:45:22 +01:00
parent 44c04147cc
commit 9c3aab008c
4 changed files with 45 additions and 29 deletions

View File

@ -94,8 +94,9 @@ namespace CoopClient
}
/// <summary>
/// ?
/// Connect to any server
/// </summary>
/// <param name="serverAddress">The server address to connect. Example: 127.0.0.1:4499</param>
public static void Connect(string serverAddress)
{
Main.MainNetworking.DisConnectFromServer(serverAddress);
@ -120,7 +121,7 @@ namespace CoopClient
/// <summary>
/// Get the local net handle from this Lidgren-Network client when connected to a server
/// </summary>
/// <returns>long</returns>
/// <returns>NetHandle</returns>
public static long GetLocalNetHandle()
{
return Main.LocalNetHandle;
@ -128,8 +129,8 @@ namespace CoopClient
/// <summary>
/// Get all connected player's as a Dictionary.
/// Key = Lidgren-Network net handle
/// Value = Character handle or null
/// Key = Lidgren-Network net handle.
/// Value = Character handle or null.
/// </summary>
public static Dictionary<long, int?> GetAllPlayers()
{
@ -254,7 +255,7 @@ namespace CoopClient
/// <summary>
/// Enable or disable sharing of NPCs with other players
/// </summary>
/// <param name="share"></param>
/// <param name="share">true to share NPCs</param>
public static void SetShareNPCs(bool share)
{
Main.ShareNPCsWithPlayers = share;
@ -263,7 +264,7 @@ namespace CoopClient
/// <summary>
/// Enable or disable the local traffic for this player
/// </summary>
/// <param name="enable"></param>
/// <param name="enable">true to disable traffic</param>
public static void SetLocalTraffic(bool enable)
{
Main.DisableTraffic = !enable;
@ -273,7 +274,7 @@ namespace CoopClient
/// Sets the alignment for the player list, if set to true it will align left,
/// otherwise it will align right
/// </summary>
/// <param name="leftAlign"></param>
/// <param name="leftAlign">true to move the player list to the left</param>
public static void SetPlayerListLeftAlign(bool leftAlign)
{
PlayerList.LeftAlign = leftAlign;

View File

@ -276,20 +276,20 @@ namespace CoopClient
internal static readonly Dictionary<ulong, byte> CheckNativeHash = new Dictionary<ulong, byte>()
{
{ 0xD49F9B0955C367DE, 1 },
{ 0xEF29A16337FACADB, 1 },
{ 0xB4AC7D0CF06BFE8F, 1 },
{ 0x9B62392B474F44A0, 1 },
{ 0x7DD959874C1FD534, 1 },
{ 0xAF35D0D2583051B0, 2 },
{ 0x63C6CCA8E68AE8C8, 2 },
{ 0x509D5878EB39E842, 3 },
{ 0x9A294B2138ABB884, 3 },
{ 0x46818D79B1F7499A, 4 },
{ 0x5CDE92C702A8FCE7, 4 },
{ 0xBE339365C863BD36, 4 },
{ 0x5A039BB0BCA604B6, 4 },
{ 0x0134F0835AB6BFCB, 5 }
{ 0xD49F9B0955C367DE, 1 }, // Entities
{ 0xEF29A16337FACADB, 1 }, //
{ 0xB4AC7D0CF06BFE8F, 1 }, //
{ 0x9B62392B474F44A0, 1 }, //
{ 0x7DD959874C1FD534, 1 }, //
{ 0xAF35D0D2583051B0, 2 }, // Vehicles
{ 0x63C6CCA8E68AE8C8, 2 }, //
{ 0x509D5878EB39E842, 3 }, // Props
{ 0x9A294B2138ABB884, 3 }, //
{ 0x46818D79B1F7499A, 4 }, // Blips
{ 0x5CDE92C702A8FCE7, 4 }, //
{ 0xBE339365C863BD36, 4 }, //
{ 0x5A039BB0BCA604B6, 4 }, //
{ 0x0134F0835AB6BFCB, 5 } // Checkpoints
};
internal static Dictionary<int, byte> ServerItems = new Dictionary<int, byte>();
internal static void CleanUpWorld()

View File

@ -35,7 +35,7 @@ namespace CoopClient.Menus.Sub
/// <summary>
/// Don't use it!
/// </summary>
public class Servers
internal class Servers
{
internal NativeMenu MainMenu = new NativeMenu("GTACOOP:R", "Servers", "Go to the server list")
{
@ -62,6 +62,12 @@ namespace CoopClient.Menus.Sub
private void CleanUpList()
{
if (ResultItem != null)
{
MainMenu.Remove(ResultItem);
ResultItem = null;
}
if (MainMenu.Items.Count > 0)
{
for (int i = 0; i < MainMenu.Items.Count; i++)
@ -103,11 +109,7 @@ namespace CoopClient.Menus.Sub
return;
}
if (ResultItem != null)
{
CleanUpList();
ResultItem = null;
}
CleanUpList();
foreach (ServerListClass server in serverList)
{

View File

@ -367,7 +367,7 @@ namespace CoopServer
/// <summary>
/// Get all connections as a list of NetHandle(long)
/// </summary>
/// <returns></returns>
/// <returns>All connections(NetHandle) as a List</returns>
public static List<long> GetAllConnections()
{
List<long> result = new();
@ -377,16 +377,29 @@ namespace CoopServer
return result;
}
/// <summary>
/// Get the count of all connections
/// </summary>
/// <returns>The count of all connections as an integer</returns>
public static int GetAllClientsCount()
{
return Server.Clients.Count;
}
/// <summary>
/// Get a list of all Clients
/// </summary>
/// <returns>All Clients as a List</returns>
public static List<Client> GetAllClients()
{
return Server.Clients;
}
/// <summary>
/// Get the client by its username
/// </summary>
/// <param name="username">The username to search for</param>
/// <returns>The Client from this user or null</returns>
public static Client GetClientByUsername(string username)
{
return Server.Clients.FirstOrDefault(x => x.Player.Username.ToLower() == username.ToLower());
@ -420,7 +433,7 @@ namespace CoopServer
}
/// <summary>
///
/// Send CleanUpWorld to all players to delete all objects created by the server
/// </summary>
public static void SendCleanUpWorldToAll(List<long> netHandleList = null)
{