fix
This commit is contained in:
@@ -20,7 +20,7 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
|
||||
public void DisableDefaultCommandErrorMessages()
|
||||
{
|
||||
NAPI.Server.SetCommandErrorMessage(null);
|
||||
NAPI.Server.SetCommandErrorMessage(string.Empty);
|
||||
//NAPI.Server.SetGlobalDefaultCommandMessages(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,22 +13,28 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => client.Name;
|
||||
set => client.Name = value;
|
||||
get => client?.Name;
|
||||
set
|
||||
{
|
||||
if (client != null)
|
||||
{
|
||||
client.Name = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SocialClubName => client.SocialClubName;
|
||||
public string SocialClubName => client?.SocialClubName;
|
||||
|
||||
public IPAddress RemoteAddress => IPAddress.Parse(client.Address);
|
||||
public IPAddress RemoteAddress => IPAddress.Parse(client?.Address);
|
||||
|
||||
public IVehicle Vehicle => client.IsInVehicle ? new RageVehicle(client.Vehicle) : null;
|
||||
public IVehicle Vehicle => client != null ? (client.IsInVehicle ? new RageVehicle(client?.Vehicle) : null) : null;
|
||||
|
||||
public VehicleSeat VehicleSeat => (VehicleSeat)client.VehicleSeat;
|
||||
public VehicleSeat VehicleSeat => (VehicleSeat)client?.VehicleSeat;
|
||||
|
||||
public bool IsInVehicle => Vehicle != null;
|
||||
|
||||
public int Health { get => client.Health; set => client.Health = value; }
|
||||
public int Armor { get => client.Armor; set => client.Armor = value; }
|
||||
public int Health { get => client?.Health ?? 0; set { if (client != null) client.Health = value; } }
|
||||
public int Armor { get => client?.Armor ?? 0; set { if (client != null) client.Armor = value; } }
|
||||
|
||||
public RagePlayer(GTANetworkAPI.Player client) : base(client)
|
||||
{
|
||||
@@ -37,20 +43,20 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
|
||||
public void SendRawMessage(string message)
|
||||
{
|
||||
client.SendChatMessage(message);
|
||||
client?.SendChatMessage(message);
|
||||
}
|
||||
|
||||
public void TriggerEventRaw(string eventName, params object[] args)
|
||||
{
|
||||
client.TriggerEvent(eventName, args);
|
||||
client?.TriggerEvent(eventName, args);
|
||||
}
|
||||
|
||||
public void SetIntoVehicle(IVehicle vehicle, VehicleSeat seat)
|
||||
{
|
||||
client.SetIntoVehicle(new GTANetworkAPI.NetHandle((ushort)vehicle.Handle, GTANetworkAPI.EntityType.Vehicle), (int)seat - 1);
|
||||
client?.SetIntoVehicle(new GTANetworkAPI.NetHandle((ushort)vehicle.Handle, GTANetworkAPI.EntityType.Vehicle), (int)seat - 1);
|
||||
}
|
||||
|
||||
public void Kick() => client.Kick();
|
||||
public void Kick() => client?.Kick();
|
||||
|
||||
public void SendNotification(string message, bool flashing = true)
|
||||
{
|
||||
@@ -73,7 +79,7 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
||||
|
||||
public void CancelAnimation()
|
||||
{
|
||||
client.StopAnimation();
|
||||
client?.StopAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user