Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): names for PM receiving being broke #238

Merged
merged 1 commit into from
Feb 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions vMenu/CommonFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
Expand Down Expand Up @@ -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, $"<C>{GetSafePlayerName(sourcePlayer.Name)}</C>", "Message Sent", true, 1);
Notify.CustomImage(headshotTxd, headshotTxd, message, $"<C>{GetSafePlayerName(name)}</C>", "Message Sent", true, 1);
}
else
{
Notify.CustomImage(headshotTxd, headshotTxd, message, $"<C>{GetSafePlayerName(sourcePlayer.Name)}</C>", "Message Received", true, 1);
Notify.CustomImage(headshotTxd, headshotTxd, message, $"<C>{GetSafePlayerName(name)}</C>", "Message Received", true, 1);
}
}
else
{
if (sent)
{
Notify.Custom($"PM From: <C>{GetSafePlayerName(sourcePlayer.Name)}</C>. Message: {message}");
Notify.Custom($"PM From: <C>{GetSafePlayerName(name)}</C>. Message: {message}");
}
else
{
Notify.Custom($"PM To: <C>{GetSafePlayerName(sourcePlayer.Name)}</C>. Message: {message}");
Notify.Custom($"PM To: <C>{GetSafePlayerName(name)}</C>. Message: {message}");
}
}
UnregisterPedheadshot(headshotHandle);
Expand Down