From 75688bf67f87d0aad7dc0db5cfa0fee9ca10f68b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=B8=E3=83=A3=E3=83=83=E3=82=AF?= Date: Mon, 8 Feb 2021 12:24:01 +0000 Subject: [PATCH] fix(client): names for PM receiving being broke --- vMenu/CommonFunctions.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vMenu/CommonFunctions.cs b/vMenu/CommonFunctions.cs index b70a4905..9fd2aa0e 100644 --- a/vMenu/CommonFunctions.cs +++ b/vMenu/CommonFunctions.cs @@ -3133,6 +3133,12 @@ public static double Map(double value, double min_in, double max_in, double min_ public static void PrivateMessage(string source, string message) => PrivateMessage(source, message, false); public static async void PrivateMessage(string source, string message, bool sent) { + MainMenu.PlayersList.RequestPlayerList(); + await MainMenu.PlayersList.WaitRequested(); + + string name = MainMenu.PlayersList.ToList() + .Find(plr => plr.ServerId.ToString() == source)?.Name ?? "**Invalid**"; + if (MainMenu.MiscSettingsMenu == null || MainMenu.MiscSettingsMenu.MiscDisablePrivateMessages) { if (!(sent && source == Game.Player.ServerId.ToString())) @@ -3163,22 +3169,22 @@ public static async void PrivateMessage(string source, string message, bool sent string headshotTxd = GetPedheadshotTxdString(headshotHandle); if (sent) { - Notify.CustomImage(headshotTxd, headshotTxd, message, $"{GetSafePlayerName(sourcePlayer.Name)}", "Message Sent", true, 1); + Notify.CustomImage(headshotTxd, headshotTxd, message, $"{GetSafePlayerName(name)}", "Message Sent", true, 1); } else { - Notify.CustomImage(headshotTxd, headshotTxd, message, $"{GetSafePlayerName(sourcePlayer.Name)}", "Message Received", true, 1); + Notify.CustomImage(headshotTxd, headshotTxd, message, $"{GetSafePlayerName(name)}", "Message Received", true, 1); } } else { if (sent) { - Notify.Custom($"PM From: {GetSafePlayerName(sourcePlayer.Name)}. Message: {message}"); + Notify.Custom($"PM From: {GetSafePlayerName(name)}. Message: {message}"); } else { - Notify.Custom($"PM To: {GetSafePlayerName(sourcePlayer.Name)}. Message: {message}"); + Notify.Custom($"PM To: {GetSafePlayerName(name)}. Message: {message}"); } } UnregisterPedheadshot(headshotHandle);