fix
This commit is contained in:
@@ -107,7 +107,14 @@ namespace ReallifeGamemode.Database.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public IPlayer NewPlayer => new RagePlayer(Player);
|
public IPlayer NewPlayer
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (Player != null) return new RagePlayer(Player);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override string BankAccountName => Name;
|
public override string BankAccountName => Name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace ReallifeGamemode.Server.Core.API
|
|||||||
|
|
||||||
void SendMessage(string message, ChatPrefix prefix = ChatPrefix.None)
|
void SendMessage(string message, ChatPrefix prefix = ChatPrefix.None)
|
||||||
{
|
{
|
||||||
if (!message.EndsWith("!") || !message.EndsWith(".") || !message.EndsWith("?"))
|
if (!message.EndsWith("!") && !message.EndsWith(".") && !message.EndsWith("?"))
|
||||||
{
|
{
|
||||||
message += prefix switch
|
message += prefix switch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
|||||||
|
|
||||||
public void DisableDefaultCommandErrorMessages()
|
public void DisableDefaultCommandErrorMessages()
|
||||||
{
|
{
|
||||||
NAPI.Server.SetCommandErrorMessage(null);
|
NAPI.Server.SetCommandErrorMessage(string.Empty);
|
||||||
//NAPI.Server.SetGlobalDefaultCommandMessages(false);
|
//NAPI.Server.SetGlobalDefaultCommandMessages(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,22 +13,28 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
|||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get => client.Name;
|
get => client?.Name;
|
||||||
set => client.Name = value;
|
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 bool IsInVehicle => Vehicle != null;
|
||||||
|
|
||||||
public int Health { get => client.Health; set => client.Health = value; }
|
public int Health { get => client?.Health ?? 0; set { if (client != null) client.Health = value; } }
|
||||||
public int Armor { get => client.Armor; set => client.Armor = value; }
|
public int Armor { get => client?.Armor ?? 0; set { if (client != null) client.Armor = value; } }
|
||||||
|
|
||||||
public RagePlayer(GTANetworkAPI.Player client) : base(client)
|
public RagePlayer(GTANetworkAPI.Player client) : base(client)
|
||||||
{
|
{
|
||||||
@@ -37,20 +43,20 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
|||||||
|
|
||||||
public void SendRawMessage(string message)
|
public void SendRawMessage(string message)
|
||||||
{
|
{
|
||||||
client.SendChatMessage(message);
|
client?.SendChatMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerEventRaw(string eventName, params object[] args)
|
public void TriggerEventRaw(string eventName, params object[] args)
|
||||||
{
|
{
|
||||||
client.TriggerEvent(eventName, args);
|
client?.TriggerEvent(eventName, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetIntoVehicle(IVehicle vehicle, VehicleSeat seat)
|
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)
|
public void SendNotification(string message, bool flashing = true)
|
||||||
{
|
{
|
||||||
@@ -73,7 +79,7 @@ namespace ReallifeGamemode.Server.Core.RageMP
|
|||||||
|
|
||||||
public void CancelAnimation()
|
public void CancelAnimation()
|
||||||
{
|
{
|
||||||
client.StopAnimation();
|
client?.StopAnimation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace ReallifeGamemode.Server
|
|||||||
|
|
||||||
NAPI.Server.SetGlobalServerChat(false);
|
NAPI.Server.SetGlobalServerChat(false);
|
||||||
|
|
||||||
NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
|
//NAPI.Server.SetCommandErrorMessage("~r~[FEHLER]~s~ Dieser Command existiert nicht.");
|
||||||
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
|
NAPI.Server.SetDefaultSpawnLocation(DEFAULT_SPAWN_POSITION, DEFAULT_SPAWN_HEADING);
|
||||||
NAPI.Server.SetAutoSpawnOnConnect(false);
|
NAPI.Server.SetAutoSpawnOnConnect(false);
|
||||||
NAPI.Server.SetAutoRespawnAfterDeath(false);
|
NAPI.Server.SetAutoRespawnAfterDeath(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user