@shaun i am new in C#, is question of try read test trye read...
case "!pay":
if (StrMsg.Length > 0)
{
if (StrMsg[1].Contains("-"))
InSim.Send_MTC_MessageToConnection("^7Invalid command", MSO.UCID, 0);
else
{
int Pay = int.Parse(StrMsg[1]);
Connections[GetConnIdx(MSO.UCID)].Cash -= Pay;
InSim.Send_MST_Message("/msg " + Connections[GetConnIdx(MSO.UCID)].PlayerName + "^7 paid $" + Pay + " fine");
}
}
break;
static public int GetUserCash(string Username)
{
StreamReader Sr = new StreamReader(UserInfo + "\\" + Username + ".txt");
string line = null;
while ((line = Sr.ReadLine()) != null)
{
if (line.Substring(0, 4) == "Cash")
{
string[] Msg = line.Split('=');
Sr.Close();
return int.Parse(Msg[1].Trim());
}
}
Sr.Close();
case "!pay":
if (StrMsg.Length > 0)
{
if (StrMsg[1].Contains("-"))
InSim.Send_MTC_MessageToConnection("^7Invalid command", MSO.UCID, 0);
else
{
int Pay = int.Parse(StrMsg[1]);
Connections[GetConnIdx(MSO.UCID)].Cash -= Pay;
InSim.Send_MST_Message("/msg " + Connections[GetConnIdx(MSO.UCID)].PlayerName + "^7 paid $" + Pay + " fine");
}
}
break;