public async Task DeathNotifications() { PlayerList pl = Players; var tmpiterator = 0; foreach (Player p in pl) { tmpiterator++; await Delay(0); if (p.IsDead) { if (deadPlayers.Contains(p.Handle)) { return; } var killer = p.Character.GetKiller(); if (killer != null) { if (killer.Handle != p.Character.Handle) { if (killer.Exists()) { if (killer.Model.IsPed) { bool found = false; foreach (Player playerKiller in pl) { if (playerKiller.Character.Handle == killer.Handle) { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~has been murdered by ~y~<C>{GetSafePlayerName(playerKiller.Name)}</C>~s~."); found = true; break; } } if (!found) { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~has been murdered."); } } else if (killer.Model.IsVehicle) { bool found = false; foreach (Player playerKiller in pl) { if (playerKiller.Character.IsInVehicle()) { if (playerKiller.Character.CurrentVehicle.Handle == killer.Handle) { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~has been murdered by ~y~<C>{GetSafePlayerName(playerKiller.Name)}</C>~s~."); found = true; break; } } } if (!found) { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~has been murdered."); } } else { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~has been murdered."); } } else { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~has been murdered."); } } else { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~committed suicide."); } } else { Notify.Custom($"~o~<C>{GetSafePlayerName(p.Name)}</C> ~s~died."); } deadPlayers.Add(p.Handle); } else { if (deadPlayers.Contains(p.Handle)) { deadPlayers.Remove(p.Handle); } } } await Delay(50); }
public void PlayerDropped(string name, string reason) { Notify.Custom($"~r~<C>{GetSafePlayerName(name)}</C>~s~ left. ~c~({reason})~s~"); }