Fix bug disconnecting from server
This commit is contained in:
@ -326,7 +326,8 @@ namespace RageCoop.Client
|
|||||||
WorldThread.Traffic(true);
|
WorldThread.Traffic(true);
|
||||||
Function.Call(Hash.SET_ENABLE_VEHICLE_SLIPSTREAMING, false);
|
Function.Call(Hash.SET_ENABLE_VEHICLE_SLIPSTREAMING, false);
|
||||||
CoopMenu.DisconnectedMenuSetting();
|
CoopMenu.DisconnectedMenuSetting();
|
||||||
GTA.UI.Notification.Show("~r~Disconnected: " + reason);
|
if (reason != "Abort")
|
||||||
|
GTA.UI.Notification.Show("~r~Disconnected: " + reason);
|
||||||
LocalPlayerID = default;
|
LocalPlayerID = default;
|
||||||
});
|
});
|
||||||
Memory.RestorePatches();
|
Memory.RestorePatches();
|
||||||
|
@ -30,16 +30,16 @@ namespace RageCoop.Client
|
|||||||
public static void ToggleConnection(string address, string username = null, string password = null, PublicKey publicKey = null)
|
public static void ToggleConnection(string address, string username = null, string password = null, PublicKey publicKey = null)
|
||||||
{
|
{
|
||||||
Menus.CoopMenu.Menu.Visible = false;
|
Menus.CoopMenu.Menu.Visible = false;
|
||||||
Peer?.Shutdown("Bye");
|
if (IsConnecting)
|
||||||
if (IsOnServer)
|
|
||||||
{
|
|
||||||
// ?
|
|
||||||
}
|
|
||||||
else if (IsConnecting)
|
|
||||||
{
|
{
|
||||||
_publicKeyReceived.Set();
|
_publicKeyReceived.Set();
|
||||||
IsConnecting = false;
|
IsConnecting = false;
|
||||||
Notification.Show("Connection has been canceled");
|
Main.QueueAction(() => Notification.Show("Connection has been canceled"));
|
||||||
|
Peer?.Shutdown("Bye");
|
||||||
|
}
|
||||||
|
else if (IsOnServer)
|
||||||
|
{
|
||||||
|
Peer?.Shutdown("Bye");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ namespace RageCoop.Client
|
|||||||
#endregion
|
#endregion
|
||||||
public static void Cleanup(bool keepPlayer = true, bool keepMine = true)
|
public static void Cleanup(bool keepPlayer = true, bool keepMine = true)
|
||||||
{
|
{
|
||||||
foreach (var ped in PedsByID.Values)
|
foreach (var ped in PedsByID.Values.ToArray())
|
||||||
{
|
{
|
||||||
if ((keepPlayer && (ped.ID == Main.LocalPlayerID)) || (keepMine && (ped.OwnerID == Main.LocalPlayerID))) { continue; }
|
if ((keepPlayer && (ped.ID == Main.LocalPlayerID)) || (keepMine && (ped.OwnerID == Main.LocalPlayerID))) { continue; }
|
||||||
RemovePed(ped.ID);
|
RemovePed(ped.ID);
|
||||||
|
Reference in New Issue
Block a user