I have trouble with admins... Admins are defined in admin.txt and that looks like this
My code for reading admin.txt:
This is for buttons:
#Ovde se definisu admini
Admin=nesrulz
Admin=M.M.L.
Admin=gagag
My code for reading admin.txt:
string[] lines = System.IO.File.ReadAllLines("admin.txt");
foreach (string line in lines)
{
//Do something with line
if (line.StartsWith("#", false, System.Globalization.CultureInfo.InvariantCulture))
{
}
else
{
if (line.ToLower().Contains("admin="))
{
try
{
string medjuvr = line.Remove(0, 6);
Console.WriteLine(medjuvr);
if (medjuvr == ncn.UName)
{
_connections.Add(ncn.UCID, new Connections
{
UCID = ncn.UCID,
UName = ncn.UName,
PName = ncn.PName,
IsAdmin = ncn.Admin,
ServerAdmin = 1,
});
}
else
{
_connections.Add(ncn.UCID, new Connections
{
UCID = ncn.UCID,
UName = ncn.UName,
PName = ncn.PName,
IsAdmin = ncn.Admin,
ServerAdmin = 0,
});
}
}
catch
{
}
}
}
}
This is for buttons:
if (_connections[ncn.UCID].ServerAdmin == 1)
{
insim.Send(new IS_BTN
{
H = 10,
W = 20,
L = 25,
T = 25,
Text = "^2SHOW GREEN FLAG",
UCID = ncn.UCID,
ClickID = 1,
ReqI = 255,
BStyle = ButtonStyles.ISB_CLICK
});
....................
....................
....................