Added and changed documentation for some functions. Hopefully fixed #54
This commit is contained in:
@ -94,8 +94,9 @@ namespace CoopClient
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ?
|
/// Connect to any server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="serverAddress">The server address to connect. Example: 127.0.0.1:4499</param>
|
||||||
public static void Connect(string serverAddress)
|
public static void Connect(string serverAddress)
|
||||||
{
|
{
|
||||||
Main.MainNetworking.DisConnectFromServer(serverAddress);
|
Main.MainNetworking.DisConnectFromServer(serverAddress);
|
||||||
@ -120,7 +121,7 @@ namespace CoopClient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the local net handle from this Lidgren-Network client when connected to a server
|
/// Get the local net handle from this Lidgren-Network client when connected to a server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>long</returns>
|
/// <returns>NetHandle</returns>
|
||||||
public static long GetLocalNetHandle()
|
public static long GetLocalNetHandle()
|
||||||
{
|
{
|
||||||
return Main.LocalNetHandle;
|
return Main.LocalNetHandle;
|
||||||
@ -128,8 +129,8 @@ namespace CoopClient
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all connected player's as a Dictionary.
|
/// Get all connected player's as a Dictionary.
|
||||||
/// Key = Lidgren-Network net handle
|
/// Key = Lidgren-Network net handle.
|
||||||
/// Value = Character handle or null
|
/// Value = Character handle or null.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Dictionary<long, int?> GetAllPlayers()
|
public static Dictionary<long, int?> GetAllPlayers()
|
||||||
{
|
{
|
||||||
@ -254,7 +255,7 @@ namespace CoopClient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable or disable sharing of NPCs with other players
|
/// Enable or disable sharing of NPCs with other players
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="share"></param>
|
/// <param name="share">true to share NPCs</param>
|
||||||
public static void SetShareNPCs(bool share)
|
public static void SetShareNPCs(bool share)
|
||||||
{
|
{
|
||||||
Main.ShareNPCsWithPlayers = share;
|
Main.ShareNPCsWithPlayers = share;
|
||||||
@ -263,7 +264,7 @@ namespace CoopClient
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enable or disable the local traffic for this player
|
/// Enable or disable the local traffic for this player
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="enable"></param>
|
/// <param name="enable">true to disable traffic</param>
|
||||||
public static void SetLocalTraffic(bool enable)
|
public static void SetLocalTraffic(bool enable)
|
||||||
{
|
{
|
||||||
Main.DisableTraffic = !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,
|
/// Sets the alignment for the player list, if set to true it will align left,
|
||||||
/// otherwise it will align right
|
/// otherwise it will align right
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="leftAlign"></param>
|
/// <param name="leftAlign">true to move the player list to the left</param>
|
||||||
public static void SetPlayerListLeftAlign(bool leftAlign)
|
public static void SetPlayerListLeftAlign(bool leftAlign)
|
||||||
{
|
{
|
||||||
PlayerList.LeftAlign = leftAlign;
|
PlayerList.LeftAlign = leftAlign;
|
||||||
|
@ -276,20 +276,20 @@ namespace CoopClient
|
|||||||
|
|
||||||
internal static readonly Dictionary<ulong, byte> CheckNativeHash = new Dictionary<ulong, byte>()
|
internal static readonly Dictionary<ulong, byte> CheckNativeHash = new Dictionary<ulong, byte>()
|
||||||
{
|
{
|
||||||
{ 0xD49F9B0955C367DE, 1 },
|
{ 0xD49F9B0955C367DE, 1 }, // Entities
|
||||||
{ 0xEF29A16337FACADB, 1 },
|
{ 0xEF29A16337FACADB, 1 }, //
|
||||||
{ 0xB4AC7D0CF06BFE8F, 1 },
|
{ 0xB4AC7D0CF06BFE8F, 1 }, //
|
||||||
{ 0x9B62392B474F44A0, 1 },
|
{ 0x9B62392B474F44A0, 1 }, //
|
||||||
{ 0x7DD959874C1FD534, 1 },
|
{ 0x7DD959874C1FD534, 1 }, //
|
||||||
{ 0xAF35D0D2583051B0, 2 },
|
{ 0xAF35D0D2583051B0, 2 }, // Vehicles
|
||||||
{ 0x63C6CCA8E68AE8C8, 2 },
|
{ 0x63C6CCA8E68AE8C8, 2 }, //
|
||||||
{ 0x509D5878EB39E842, 3 },
|
{ 0x509D5878EB39E842, 3 }, // Props
|
||||||
{ 0x9A294B2138ABB884, 3 },
|
{ 0x9A294B2138ABB884, 3 }, //
|
||||||
{ 0x46818D79B1F7499A, 4 },
|
{ 0x46818D79B1F7499A, 4 }, // Blips
|
||||||
{ 0x5CDE92C702A8FCE7, 4 },
|
{ 0x5CDE92C702A8FCE7, 4 }, //
|
||||||
{ 0xBE339365C863BD36, 4 },
|
{ 0xBE339365C863BD36, 4 }, //
|
||||||
{ 0x5A039BB0BCA604B6, 4 },
|
{ 0x5A039BB0BCA604B6, 4 }, //
|
||||||
{ 0x0134F0835AB6BFCB, 5 }
|
{ 0x0134F0835AB6BFCB, 5 } // Checkpoints
|
||||||
};
|
};
|
||||||
internal static Dictionary<int, byte> ServerItems = new Dictionary<int, byte>();
|
internal static Dictionary<int, byte> ServerItems = new Dictionary<int, byte>();
|
||||||
internal static void CleanUpWorld()
|
internal static void CleanUpWorld()
|
||||||
|
@ -35,7 +35,7 @@ namespace CoopClient.Menus.Sub
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Don't use it!
|
/// Don't use it!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Servers
|
internal class Servers
|
||||||
{
|
{
|
||||||
internal NativeMenu MainMenu = new NativeMenu("GTACOOP:R", "Servers", "Go to the server list")
|
internal NativeMenu MainMenu = new NativeMenu("GTACOOP:R", "Servers", "Go to the server list")
|
||||||
{
|
{
|
||||||
@ -62,6 +62,12 @@ namespace CoopClient.Menus.Sub
|
|||||||
|
|
||||||
private void CleanUpList()
|
private void CleanUpList()
|
||||||
{
|
{
|
||||||
|
if (ResultItem != null)
|
||||||
|
{
|
||||||
|
MainMenu.Remove(ResultItem);
|
||||||
|
ResultItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (MainMenu.Items.Count > 0)
|
if (MainMenu.Items.Count > 0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MainMenu.Items.Count; i++)
|
for (int i = 0; i < MainMenu.Items.Count; i++)
|
||||||
@ -103,11 +109,7 @@ namespace CoopClient.Menus.Sub
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ResultItem != null)
|
CleanUpList();
|
||||||
{
|
|
||||||
CleanUpList();
|
|
||||||
ResultItem = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (ServerListClass server in serverList)
|
foreach (ServerListClass server in serverList)
|
||||||
{
|
{
|
||||||
|
@ -367,7 +367,7 @@ namespace CoopServer
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all connections as a list of NetHandle(long)
|
/// Get all connections as a list of NetHandle(long)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns>All connections(NetHandle) as a List</returns>
|
||||||
public static List<long> GetAllConnections()
|
public static List<long> GetAllConnections()
|
||||||
{
|
{
|
||||||
List<long> result = new();
|
List<long> result = new();
|
||||||
@ -377,16 +377,29 @@ namespace CoopServer
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the count of all connections
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The count of all connections as an integer</returns>
|
||||||
public static int GetAllClientsCount()
|
public static int GetAllClientsCount()
|
||||||
{
|
{
|
||||||
return Server.Clients.Count;
|
return Server.Clients.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a list of all Clients
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>All Clients as a List</returns>
|
||||||
public static List<Client> GetAllClients()
|
public static List<Client> GetAllClients()
|
||||||
{
|
{
|
||||||
return Server.Clients;
|
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)
|
public static Client GetClientByUsername(string username)
|
||||||
{
|
{
|
||||||
return Server.Clients.FirstOrDefault(x => x.Player.Username.ToLower() == username.ToLower());
|
return Server.Clients.FirstOrDefault(x => x.Player.Username.ToLower() == username.ToLower());
|
||||||
@ -420,7 +433,7 @@ namespace CoopServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Send CleanUpWorld to all players to delete all objects created by the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void SendCleanUpWorldToAll(List<long> netHandleList = null)
|
public static void SendCleanUpWorldToAll(List<long> netHandleList = null)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user