The online racing simulator
MCI error
(7 posts, started )
MCI error
hi
i get everytime a error message from MCI with a index problem when someone leaved the pits. it happends in Debug mode to.
and no i dont get a NPL error, i'm sure it is a MCI error.
check attachment( ITS DUTCH )

see the code below for the Leave pit event


// A player joins the race. If PLID already exists, then player leaves pit.
private void NPL_PlayerJoinsRace(Packets.IS_NPL NPL)
{
try
{
if (Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^0[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^1[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^2[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^3[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^4[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^5[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^6[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^7[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^8[COP]"))
{
if (Connections[GetConnIdx(NPL.UCID)].TotalDistance >= (1000000))
{
Connections[GetConnIdx(NPL.UCID)].CurrentCar = NPL.CName;
if (Connections[GetConnIdx(NPL.UCID)].Cars.Contains(NPL.CName) != true)
{
InSim.Send_MST_Message("/spec " + Connections[GetConnIdx(NPL.UCID)].Username);
InSim.Send_MST_Message("/msg ^3»^7 " + Connections[GetConnIdx(NPL.UCID)].PlayerName + "^7 tried to steal " + NPL.CName);
InSim.Send_MST_Message("/msg ^3»^7 But failed and will fined €100 for stealing a car");
Connections[GetConnIdx(NPL.UCID)].Cash -= 100;
}
else
{
Connections[GetConnIdx(NPL.UCID)].PitOverride = 0;
}

Connections[GetConnIdx(NPL.UCID)].CurrentCar = NPL.CName;
InSim.Send_MTC_MessageToConnection("^3»^7 Drive Save^1!! ^7And drive on the right side of the road^1!!!", NPL.UCID, 0);
bool LeavesPits = AddToPlayersList(NPL); // Update Players[] list
}
else
{
InSim.Send_MST_Message("/spec " + Connections[GetConnIdx(NPL.UCID)].Username);
InSim.Send_MTC_MessageToConnection("^1You Cant be a COP! Please Remove The Tag!", NPL.UCID, 0);
InSim.Send_MTC_MessageToConnection("^1You need to drive 1000km for being a COP", NPL.UCID, 0);
}
}
}
catch (Exception EX)
{
MessageBox.Show("NPL - " + EX.Message);
}

}

my questions are:

1. can this be solved
so yes , help me
2. and how to code to dont get this error
Attached images
MCI error.png
It was explained somewhere. Sorry, I know that this post isn't any much helpful, but at least I can show you the direction.

This is only if you are using dougie's insim app. - Try looking in the open source cruise insim thread. There has to be a link there. Or if not the thread was somewhere in the Programmer Forum.. Its name was something like "MCI fix".

It's pretty easy really. Connection.Count is used incorrectly in the MCI thread itself and has to be replaced with MCI.NumC, but only in the MCI thread, so don't replace Connection.Count in the Connections function(or whatever it is if it's not a function).
You've posted the wrong part of the code, as the error is in the MCI event-handler. As said, this looks like a very well known bug in the Open Source Cruise server and there are hundreds of fixes on the forum if you search for them.
k thx for help guys
yes i use the open source cruise insim of dougie.

yes i have search on the forum before i made this post.
maybe i search wrong.

i know its the wrong code but i got only a MCI error message when someone leave the pit and that happends in this event.
While we're on that topic, there's one more thing you might want to do on the app from dougie - if you want to prevent more weird errors and stuff like that, make sure that you assign a default value to every variable in the clsPlayer class, and to prevent startup and on-user-connect errors you might also want to assign some default values to some variables in the clsConnection too.

Just thought I'd share it cause when I was making a cruise app out of dougie's one this thing was bugging me a lot.
Quote from broken :It was explained somewhere. Sorry, I know that this post isn't any much helpful, but at least I can show you the direction.

This is only if you are using dougie's insim app. - Try looking in the open source cruise insim thread. There has to be a link there. Or if not the thread was somewhere in the Programmer Forum.. Its name was something like "MCI fix".

It's pretty easy really. Connection.Count is used incorrectly in the MCI thread itself and has to be replaced with MCI.NumC, but only in the MCI thread, so don't replace Connection.Count in the Connections function(or whatever it is if it's not a function).

hi
i have done what u said but MCI.NumC was already created.
and u have done what they siad on MCI Fix threads. But still i got the same error

this is what i add to the code before i got this error
without these lines it runs perfect.

sry for my noobishy
i learn to program


if (Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^0[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^1[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^2[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^3[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^4[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^5[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^6[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^7[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^8[COP]"))
{
if (Connections[GetConnIdx(NPL.UCID)].TotalDistance >= (1000000))
{

Quote from Bass-Driver :hi
i have done what u said but MCI.NumC was already created.
and u have done what they siad on MCI Fix threads. But still i got the same error

this is what i add to the code before i got this error
without these lines it runs perfect.

sry for my noobishy
i learn to program


if (Connections[GetConnIdx([B]NPL.UCID[/B])].PlayerName.Contains("^0[COP]") || Connections[GetConnIdx([B]NPL.UCID[/B])].PlayerName.Contains("^1[COP]") || Connections[GetConnIdx([B]NPL.UCID[/B])].PlayerName.Contains("^2[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^3[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^4[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^5[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^6[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^7[COP]") || Connections[GetConnIdx(NPL.UCID)].PlayerName.Contains("^8[COP]"))
{
if (Connections[GetConnIdx([B]NPL.UCID[/B])].TotalDistance >= (1000000))
{


We are in the MCI thread, not the NPL one. Therefore to get the UCID of a player you have to do something like.. uh... damn MCI has only PLID doesn't it... So then try Connections[GetConnIdx(MCI.Info[i].UCID)] and if that doesn't work umm... try this: Connections[GetConnIdc(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)]

Hope that helped, cause I'm not sure if it's 100% correct. And, obviously, this example will only work if the name of the variable you are using to loop thorough the connections is i. But my guess is that you haven't changed it, so it has to work.

MCI error
(7 posts, started )
FGED GREDG RDFGDR GSFDG