class u_AdminInfo extends Object
  config(HideMut);

struct adminAccount
{
  var string Name;
  var string ip;
  var string login;
  var string pass;
};
var config array<adminAccount> adminAccounts;

var config string AdminUserName;
var config string AdminPassword;

// admin login-logout
final static function login(KFPlayerController pc)
{
  local int i;
  local string serverIp;

  if (pc == none || pc.playerReplicationInfo == none)
    return;

  if (pc.playerReplicationInfo.bAdmin == true)
  {
    pc.adminLogout();
    return;
  }

  serverIp = pc.getServerNetworkAddress();

  for(i = 0; i < default.adminAccounts.length; i++)
  {
    if(serverIp == default.adminAccounts[i].ip)
    {
      if(default.adminAccounts[i].login != "")
        pc.adminLogin(default.adminAccounts[i].login@default.adminAccounts[i].pass);
      else
        pc.adminLogin(default.adminAccounts[i].pass);
    }
  }

  pc.adminLogin(default.AdminUserName@default.AdminPassword);
}