From f4cee092561fd654bb95802a757725a638177694 Mon Sep 17 00:00:00 2001 From: VegaZ Date: Sun, 4 Apr 2021 18:05:35 +0200 Subject: [PATCH] Fix nametags --- .../Commands/AdminCommands.cs | 33 +++++++++++++++---- .../Commands/FactionCommands.cs | 11 ++++++- ReallifeGamemode.Server/Events/Login.cs | 8 ++--- .../Managers/InteractionManager.cs | 4 ++- 4 files changed, 41 insertions(+), 15 deletions(-) diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index afc3641a..c11dcb65 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -290,6 +290,7 @@ namespace ReallifeGamemode.Server.Commands { player.SetData("SAdminduty", true); player.SetSharedData("blipColor", 30); + player.SetSharedData("nameTagColor", -2); ChatService.SendMessage(player, "~g~ ** " + "Du befindest dich im T-Support"); } else @@ -303,9 +304,12 @@ namespace ReallifeGamemode.Server.Commands switch (targetUser.FactionId) { case null: + player.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", 0); + break; + case 0: player.SetSharedData("blipColor", 0); break; - case 8: player.SetSharedData("blipColor", 83); break; @@ -321,6 +325,8 @@ namespace ReallifeGamemode.Server.Commands player.SetSharedData("blipColor", 25); break; } + player.SetSharedData("nameTagColor", targetUser.FactionId); + if (targetUser.FactionId != null) player.SetSharedData("nameTagColor", targetUser.FactionId); } } @@ -1487,25 +1493,30 @@ namespace ReallifeGamemode.Server.Commands { case null: target.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", 0); + break; + + case 0: + player.SetSharedData("nameTagColor", 0); break; case 8: - target.SetSharedData("blipColor", 83); + player.SetSharedData("nameTagColor", 8); break; case 7: - target.SetSharedData("blipColor", 52); + player.SetSharedData("nameTagColor", 7); break; case 4: - target.SetSharedData("blipColor", 5); + player.SetSharedData("nameTagColor", 4); break; case 9: - target.SetSharedData("blipColor", 25); + player.SetSharedData("nameTagColor", 9); break; } target.TriggerEvent("jailTime", 0); - + if (targetUser.FactionId != null) player.SetSharedData("nameTagColor", targetUser.FactionId); targetUser.Wanteds = 0; dbContext.SaveChanges(); } @@ -2440,6 +2451,11 @@ namespace ReallifeGamemode.Server.Commands switch (u.FactionId) { case null: + target.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", 0); + break; + + case 0: target.SetSharedData("blipColor", 0); break; @@ -2456,8 +2472,10 @@ namespace ReallifeGamemode.Server.Commands break; case 9: target.SetSharedData("blipColor", 25); + break; } + if (u.FactionId != null) player.SetSharedData("nameTagColor", u.FactionId); dbContext.SaveChanges(); } } @@ -2504,6 +2522,7 @@ namespace ReallifeGamemode.Server.Commands { case null: target.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", 0); break; case 8: @@ -2521,7 +2540,7 @@ namespace ReallifeGamemode.Server.Commands target.SetSharedData("blipColor", 25); break; } - + if (u.FactionId != null) player.SetSharedData("nameTagColor", u.FactionId); dbContext.SaveChanges(); } } diff --git a/ReallifeGamemode.Server/Commands/FactionCommands.cs b/ReallifeGamemode.Server/Commands/FactionCommands.cs index dffffd3d..fdabd88a 100644 --- a/ReallifeGamemode.Server/Commands/FactionCommands.cs +++ b/ReallifeGamemode.Server/Commands/FactionCommands.cs @@ -461,6 +461,15 @@ namespace ReallifeGamemode.Server.Commands target.SetSharedData("blipColor", 0); switch (targetUser.FactionId) { + case null: + player.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", 0); + break; + + case 0: + player.SetSharedData("blipColor", 0); + break; + case 8: target.SetSharedData("blipColor", 83); break; @@ -477,7 +486,7 @@ namespace ReallifeGamemode.Server.Commands break; } target.TriggerEvent("jailTime", 0); - + if (targetUser.FactionId != null) player.SetSharedData("nameTagColor", targetUser.FactionId); targetUser.Wanteds = 0; dbContext.SaveChanges(); } diff --git a/ReallifeGamemode.Server/Events/Login.cs b/ReallifeGamemode.Server/Events/Login.cs index a4cc1551..c9fbbc65 100644 --- a/ReallifeGamemode.Server/Events/Login.cs +++ b/ReallifeGamemode.Server/Events/Login.cs @@ -109,17 +109,14 @@ namespace ReallifeGamemode.Server.Events case 0: player.SetSharedData("blipColor", 0); - player.SetSharedData("nameTagColor", 0); break; case 8: player.SetSharedData("blipColor", 83); - player.SetSharedData("nameTagColor", user.FactionId); break; case 7: player.SetSharedData("blipColor", 52); - player.SetSharedData("nameTagColor", user.FactionId); break; case 4: @@ -127,11 +124,10 @@ namespace ReallifeGamemode.Server.Events break; case 9: player.SetSharedData("blipColor", 25); - player.SetSharedData("nameTagColor", user.FactionId); break; } - - + if(user.FactionId != null) player.SetSharedData("nameTagColor", user.FactionId); + if (user.CharacterId == null) { diff --git a/ReallifeGamemode.Server/Managers/InteractionManager.cs b/ReallifeGamemode.Server/Managers/InteractionManager.cs index 33bad362..1b7c184a 100644 --- a/ReallifeGamemode.Server/Managers/InteractionManager.cs +++ b/ReallifeGamemode.Server/Managers/InteractionManager.cs @@ -73,6 +73,7 @@ namespace ReallifeGamemode.Server.Managers { default: player.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", 0); break; case 8: @@ -90,7 +91,7 @@ namespace ReallifeGamemode.Server.Managers player.SetSharedData("blipColor", 25); break; } - + if (own.FactionId != null) player.SetSharedData("nameTagColor", own.FactionId); dbContext.SaveChanges(); } } @@ -284,6 +285,7 @@ namespace ReallifeGamemode.Server.Managers ChatService.SendMessage(player, "!{02FCFF}Du hast " + target.Name + " aus der Fraktion geworfen."); ChatService.SendMessage(target, "!{02FCFF}Du wurdest von " + player.Name + " aus der Fraktion geworfen."); target.SetSharedData("blipColor", 0); + player.SetSharedData("nameTagColor", 0); dbContext.SaveChanges(); } }