public static string GetColoredRankName(this ServerRank serverRank) { Color color; if (serverRank >= ServerRank.Support && serverRank <= ServerRank.Support5) { color = new Color(51, 143, 255); } else if (serverRank >= ServerRank.AdministratorRozgrywki && serverRank <= ServerRank.AdministratorRozgrywki5) { color = new Color(0, 109, 15); } else if (serverRank >= ServerRank.AdministratorTechniczny && serverRank <= ServerRank.AdministratorTechniczny2) { color = new Color(117, 13, 18); } else if (serverRank >= ServerRank.Zarzad && serverRank <= ServerRank.Zarzad2) { color = new Color(255, 0, 0); } else { color = new Color(255, 255, 255); } return($"<p style='color:{color.ToHex()}'>{serverRank.ToString().Where(char.IsLetter)}</p>"); }
public void SetRank(Client sender, int id, ServerRank rank) { if (!sender.HasRank(ServerRank.AdministratorTechniczny3)) { sender.SendWarning("Nie posiadasz uprawnień do ustawiania rang."); return; } AccountEntity controller = EntityHelper.GetAccountByServerId(id); if (controller == null) { sender.SendError("Nie znaleziono gracza o podanym Id."); return; } controller.DbModel.ServerRank = rank; controller.Save(); sender.SendInfo($"Nadałeś {controller.CharacterEntity.FormatName} ({controller.DbModel.Name}) rangę {controller.DbModel.ServerRank}"); }
// until rage mp won't fix utf 8 characters we don't use this method // public static void Notify(this Client client, string message, bool flashing = false) // { // NAPI.Notification.SendNotificationToPlayer(client, message, flashing); // } public static bool HasRank(this Client client, ServerRank rank) { AccountEntity accountEntity = client.GetAccountEntity(); return(accountEntity.DbModel.ServerRank >= rank); }