Here You Go
static public byte GetUserTow(string Username)
{
StreamReader Sr = new StreamReader(UserInfo + "\\groups\\tow.txt");
string line = null;
while ((line = Sr.ReadLine()) != null)
{
if (line.Substring(0, 7) == "TowTruck")
{
string[] Msg = line.Split('=');
if (Msg[1].Trim() == Username)
{
Sr.Close();
return 1;
}
}
}
Sr.Close();
return 0;
}
static public byte GetUserTow(string Username)
{
StreamReader Sr = new StreamReader(UserInfo + "\\groups\\tow.txt");
string line = null;
while ((line = Sr.ReadLine()) != null)
{
if (line.Substring(0, 7) == "TowTruck")
{
string[] Msg = line.Split('=');
if (Msg[1].Trim() == Username)
{
Sr.Close();
return 1;
}
}
}
Sr.Close();
return 0;
}
/// <summary>Holds information of a connected client to the lfs server</summary>
public class clsConnection
{
//stripped un-needed code
protected byte _canbetow;
//stripped un-needed code
// Tow Bits
protected byte _isTow;
/// <summary>Connection Unique ID</summary>
public byte UniqueID
{
get { return _uniqueid; }
set { _uniqueid = value; }
}
/// <summary>
/// Connections username
/// </summary>
public string Username
{
get { return _username; }
set { _username = value; }
}
/// <summary>
/// Connections player name
/// </summary>
public string PlayerName
{
get { return _playername; }
set { _playername = value; }
}
/// <summary>
/// Connection is admin
/// </summary>
public byte IsAdmin
{
get { return _isadmin; }
set { _isadmin = value; }
}
/// <summary>
/// Bit 2 : remote
/// </summary>
//stripped un-needed code
}
public byte CanBeTow
{
get { return _canbetow; }
set { _canbetow = value; }
}
public byte isTow
{
get { return _isTow; }
set { _isTow = value; }
}
//stripped un-needed code
}
// Assign values of new connnnection.
clsConnection NewConn = new clsConnection();
NewConn.CanBeTow = FileInfo.GetUserTow(NCN.UName);
//stripped un-needed code
// Tow Bits
NewConn.isTow = 0;
Connections.Add(NewConn);
}
case "!towon":
if (StrMsg.Length == 1)
{
if (Connections[GetConnIdx(MSO.UCID)].CanBeTow == 1)
{
if (Connections[GetConnIdx(MSO.UCID)].isTow == 0)
{
Connections[GetConnIdx(MSO.UCID)].isTow = 1; // 1 = Tow
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].Username + " is now ^1ON-DUTY ^7Towtruck");
}
else
{
Connections[GetConnIdx(MSO.UCID)].isTow = 0; // 1 = Tow
InSim.Send_MST_Message("/msg ^6|^7 " + Connections[GetConnIdx(MSO.UCID)].Username + " is now ^2OFF-DUTY ^7Towtruck");
}
}
else
{
InSim.Send_MTC_MessageToConnection("^1Not Authorised!", MSO.UCID, 0);
}
}
else
{
InSim.Send_MTC_MessageToConnection("^6|^7 Invalid command. Please see ^2!help^7 for a command list", MSO.UCID, 0);
}
break;