The online racing simulator
InSim Problems
(13 posts, started )
#1 - sun
InSim Problems
hello,

when i start my InSim it gives me an error that it crashes, see the image below:



I load it and when i Debug it, it highlights this :

[SIZE=2]InSim.Send_BTN_CreateButton([/SIZE][SIZE=2][COLOR=#a31515]"^1Admin "[/COLOR][/SIZE][SIZE=2] + Connections[GetConnIdx(NCN.UCID)].IsAdmin, [/SIZE][SIZE=2][COLOR=#2b91af]Flags[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]ButtonStyles[/COLOR][/SIZE][SIZE=2].ISB_CLICK, 5, 10, 0, 40, 45, NCN.UCID, 2, [/SIZE][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE][SIZE=2]);[/SIZE]

Please, if you can help, please post at the bottom, My team are so upset

remove it?
You need to post the error message, or else nobody is able to help you.
#4 - sun
i've gave the error, theres no code error, i gave u an image
Well first, there's the "What data does this error report contain?" link, which would probably give some useful bits of information, instead of the generic error message which gives no information at all. Then there's also the debugging you started, the yellow line highlighting is from my experience with VS always accompanied with an exception message, which tells you (us) the actual problem/error that appeared.

Even better, start the whole InSim application out of Visual Studio in debugging mode, that way the debugger will break on the current statement as the exception happens, allowing you to investigate why the error happens much more efficiently.
#6 - sun
ok, but but when i start it without debugging, or starting the .exe, it crashes strate away
#7 - sun
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

thats it
#8 - sun
privatevoid NCN(Packets.IS_NCN NCN)
{
FileInfo.NewUser(NCN.UName);
InSim.Send_BTN_CreateButton(
"^1Admin " + Connections[GetConnIdx(NCN.UCID)].IsAdmin, Flags.ButtonStyles.ISB_DARK, 5, 10, 0, 40, 45, NCN.UCID, 2, false);
}

Thats the code It Highlights in yellow that code, not the packet stuff just the admin create button thing.
#9 - sun
heres the dam error lol >.<
Good for you, finding a problem and fixing it. I have gained some respect for you sun.
But how about posting the problem and the fix in the top post? So theres may learn from your mistake?
@Dygear: He still hasn't fixed it.

Okay, the problem is the following, GetConnIdx(NCN.UCID) normally returns a index to get the correct connection out of the Connections array/list. However, it seems like it can't find the correct index and probably returns -1 or something, giving you the error, because it tried to access an array element that is not contained in the connections list.

Connections[ GetConnIdx(NCN.UCID) ];

The next step would be to find out
1) If the connections array is properly filled
2) What value GetConnIdx(NCN.UCID) returns (just copy the expression in to the "watch" window and you'll see)
#12 - sun
ohhh.... But why is it doing it ? it worked alday, but when i ran it again it didnt work.
#13 - sun
YAY, i fixed the error. It was because i didnt add

AddToConnectionsList(NCN); // Update Connections[] list (don't remove this line!)



InSim Problems
(13 posts, started )
FGED GREDG RDFGDR GSFDG