Example #1
0
 public static string GetFormattedName(this Entity player, LAdmin.GroupsDatabase database)
 {
     LAdmin.GroupsDatabase.Group grp = player.GetGroup(database);
     if (!string.IsNullOrWhiteSpace(grp.short_name))
     {
         return(LAdmin.Lang_GetString("FormattedNameRank").Format(new Dictionary <string, string>()
         {
             { "<shortrank>", grp.short_name },
             { "<rankname>", grp.group_name },
             { "<name>", player.Name },
         }));
     }
     return(LAdmin.Lang_GetString("FormattedNameRankless").Format(new Dictionary <string, string>()
     {
         { "<name>", player.Name },
     }));
 }
Example #2
0
        public static LAdmin.GroupsDatabase.Group GetGroup(this Entity entity, LAdmin.GroupsDatabase database)
        {
            KeyValuePair <LAdmin.PlayerInfo, string>?playerFromGroups = database.FindEntryFromPlayersAND(entity.GetInfo());

            if (playerFromGroups == null)
            {
                return(database.GetGroup("default"));
            }
            LAdmin.GroupsDatabase.Group grp = database.GetGroup(playerFromGroups.Value.Value);
            if (grp != null)
            {
                return(grp);
            }
            else
            {
                LAdmin.WriteLog.Error("# Player " + entity.Name + ": GUID=" + entity.GUID + ", HWID = " + entity.GetHWID().ToString() + ", IP:" + entity.IP.ToString());
                LAdmin.WriteLog.Error("# Is in nonexistent group: " + playerFromGroups);
                return(database.GetGroup("default"));
            }
        }