bug fixes
This commit is contained in:
@ -166,7 +166,7 @@ namespace CoopClient
|
||||
else if (!Game.Player.Character.IsInVehicle())
|
||||
{
|
||||
Vehicle veh = World.GetNearbyVehicles(Game.Player.Character, 5f).FirstOrDefault();
|
||||
if (veh != default)
|
||||
if (veh != null)
|
||||
{
|
||||
for (int i = 0; i < veh.PassengerCapacity; i++)
|
||||
{
|
||||
|
@ -434,6 +434,8 @@ namespace CoopClient
|
||||
{
|
||||
List<InputArgument> arguments = new List<InputArgument>();
|
||||
|
||||
if (packet.Args != null && packet.Args.Count > 0)
|
||||
{
|
||||
packet.Args.ForEach(arg =>
|
||||
{
|
||||
Type typeOf = arg.GetType();
|
||||
@ -466,6 +468,7 @@ namespace CoopClient
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Function.Call((Hash)packet.Hash, arguments.ToArray());
|
||||
}
|
||||
@ -475,9 +478,12 @@ namespace CoopClient
|
||||
List<InputArgument> arguments = new List<InputArgument>();
|
||||
Type typeOf = null;
|
||||
|
||||
if (packet.Args != null && packet.Args.Count > 0)
|
||||
{
|
||||
packet.Args.ForEach(arg =>
|
||||
{
|
||||
typeOf = arg.GetType();
|
||||
|
||||
if (typeOf == typeof(IntArgument))
|
||||
{
|
||||
arguments.Add(((IntArgument)arg).Data);
|
||||
@ -506,6 +512,7 @@ namespace CoopClient
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
NativeArgument result = null;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyVersion>1.4.3.0001</AssemblyVersion>
|
||||
<AssemblyVersion>1.4.6.0001</AssemblyVersion>
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
<RepositoryUrl>https://github.com/GTACOOP-R/GTACoop-R</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
@ -121,7 +121,7 @@ namespace CoopServer
|
||||
if (response == null)
|
||||
{
|
||||
Logging.Error("MasterServer: Something went wrong!");
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
responseContent = await response.Content.ReadAsStringAsync();
|
||||
@ -129,7 +129,7 @@ namespace CoopServer
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.Error(ex.Message);
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
if (response.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
@ -361,7 +361,7 @@ namespace CoopServer
|
||||
NativeResponsePacket responsePacket = (NativeResponsePacket)packet;
|
||||
|
||||
Client client = Clients.FirstOrDefault(x => x.ID == message.SenderConnection.RemoteUniqueIdentifier);
|
||||
if (client != default(Client))
|
||||
if (client != null)
|
||||
{
|
||||
if (client.Callbacks.ContainsKey(responsePacket.ID))
|
||||
{
|
||||
@ -419,7 +419,7 @@ namespace CoopServer
|
||||
if (modPacket.Target != 0)
|
||||
{
|
||||
NetConnection target = MainNetServer.Connections.FirstOrDefault(x => x.RemoteUniqueIdentifier == modPacket.Target);
|
||||
if (target.Equals(default(Client)))
|
||||
if (target == null)
|
||||
{
|
||||
Logging.Error($"[ModPacket] target \"{modPacket.Target}\" not found!");
|
||||
}
|
||||
@ -454,7 +454,7 @@ namespace CoopServer
|
||||
case NetIncomingMessageType.ConnectionLatencyUpdated:
|
||||
{
|
||||
Client client = Clients.FirstOrDefault(x => x.ID == message.SenderConnection.RemoteUniqueIdentifier);
|
||||
if (!client.Equals(default(Client)))
|
||||
if (client != null)
|
||||
{
|
||||
client.Latency = message.ReadFloat();
|
||||
}
|
||||
@ -550,12 +550,12 @@ namespace CoopServer
|
||||
return;
|
||||
}
|
||||
|
||||
if (Clients.Any(x => x.Player.SocialClubName == packet.SocialClubName))
|
||||
if (Clients.Any(x => x.Player.SocialClubName.ToLower() == packet.SocialClubName.ToLower()))
|
||||
{
|
||||
local.Deny("The name of the Social Club is already taken!");
|
||||
return;
|
||||
}
|
||||
else if (Clients.Any(x => x.Player.Username == packet.Username))
|
||||
else if (Clients.Any(x => x.Player.Username.ToLower() == packet.Username.ToLower()))
|
||||
{
|
||||
local.Deny("Username is already taken!");
|
||||
return;
|
||||
@ -606,7 +606,7 @@ namespace CoopServer
|
||||
private static void SendPlayerConnectPacket(NetConnection local, PlayerConnectPacket packet)
|
||||
{
|
||||
Client localClient = Clients.FirstOrDefault(x => x.ID == packet.ID);
|
||||
if (localClient.Equals(default(Client)))
|
||||
if (localClient == null)
|
||||
{
|
||||
local.Disconnect("No data found!");
|
||||
return;
|
||||
@ -621,7 +621,7 @@ namespace CoopServer
|
||||
long targetPlayerID = targetPlayer.RemoteUniqueIdentifier;
|
||||
|
||||
Client targetClient = Clients.FirstOrDefault(x => x.ID == targetPlayerID);
|
||||
if (!targetClient.Equals(default(Client)))
|
||||
if (targetClient == null)
|
||||
{
|
||||
NetOutgoingMessage outgoingMessage = MainNetServer.CreateMessage();
|
||||
new PlayerConnectPacket()
|
||||
@ -675,7 +675,7 @@ namespace CoopServer
|
||||
}
|
||||
|
||||
Client localClient = Clients.FirstOrDefault(x => x.ID == clientID);
|
||||
if (localClient.Equals(default(Client)))
|
||||
if (localClient == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -695,7 +695,7 @@ namespace CoopServer
|
||||
private static void FullSyncPlayer(FullSyncPlayerPacket packet)
|
||||
{
|
||||
Client tmpClient = Clients.FirstOrDefault(x => x.ID == packet.Extra.ID);
|
||||
if (tmpClient.Equals(default(Client)))
|
||||
if (tmpClient == null)
|
||||
{
|
||||
NetConnection localConn = MainNetServer.Connections.Find(x => packet.Extra.ID == x.RemoteUniqueIdentifier);
|
||||
if (localConn != null)
|
||||
@ -740,7 +740,7 @@ namespace CoopServer
|
||||
private static void FullSyncPlayerVeh(FullSyncPlayerVehPacket packet)
|
||||
{
|
||||
Client tmpClient = Clients.FirstOrDefault(x => x.ID == packet.Extra.ID);
|
||||
if (tmpClient.Equals(default(Client)))
|
||||
if (tmpClient == null)
|
||||
{
|
||||
NetConnection localConn = MainNetServer.Connections.Find(x => packet.Extra.ID == x.RemoteUniqueIdentifier);
|
||||
if (localConn != null)
|
||||
@ -785,7 +785,7 @@ namespace CoopServer
|
||||
private static void LightSyncPlayer(LightSyncPlayerPacket packet)
|
||||
{
|
||||
Client tmpClient = Clients.FirstOrDefault(x => x.ID == packet.Extra.ID);
|
||||
if (tmpClient.Equals(default(Client)))
|
||||
if (tmpClient == null)
|
||||
{
|
||||
NetConnection localConn = MainNetServer.Connections.Find(x => packet.Extra.ID == x.RemoteUniqueIdentifier);
|
||||
if (localConn != null)
|
||||
@ -830,7 +830,7 @@ namespace CoopServer
|
||||
private static void LightSyncPlayerVeh(LightSyncPlayerVehPacket packet)
|
||||
{
|
||||
Client tmpClient = Clients.FirstOrDefault(x => x.ID == packet.Extra.ID);
|
||||
if (tmpClient.Equals(default(Client)))
|
||||
if (tmpClient == null)
|
||||
{
|
||||
NetConnection localConn = MainNetServer.Connections.Find(x => packet.Extra.ID == x.RemoteUniqueIdentifier);
|
||||
if (localConn != null)
|
||||
|
@ -281,8 +281,7 @@ namespace CoopServer
|
||||
|
||||
public static Client GetClientByUsername(string username)
|
||||
{
|
||||
Client client = Server.Clients.FirstOrDefault(x => x.Player.Username == username);
|
||||
return client.Equals(default(Client)) ? null : client;
|
||||
return Server.Clients.FirstOrDefault(x => x.Player.Username.ToLower() == username.ToLower());
|
||||
}
|
||||
|
||||
public static void SendChatMessageToAll(string message, string username = "Server")
|
||||
|
@ -50,7 +50,7 @@ namespace CoopServer
|
||||
|
||||
public static NetConnection GetConnectionByUsername(string username)
|
||||
{
|
||||
Client client = Server.Clients.FirstOrDefault(x => x.Player.Username == username);
|
||||
Client client = Server.Clients.FirstOrDefault(x => x.Player.Username.ToLower() == username.ToLower());
|
||||
if (client.Equals(default(Client)))
|
||||
{
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user