is there any Packet of Took wrong route?
Hello guys is there any posibilities to detect a 'Playername took wrong route'?
i've been finding out but it doesnt have in insim.txt any help?

or just I'll use MSO Packet?

Tnx
Quote from InSim.txt :// On false start or wrong route / restricted area, an IS_PEN packet is sent :
...
// Wrong route : OldPen = 0 / NewPen = PENALTY_45 / Reason = PENR_WRONG_WAY

In the case of an out of track wrong route, where the player gets sent to spectate, you'd probably have to use PLL + MSO.
oh so when the MSO writes Playername took wrong route .. then it must be on the samething at PLL (spectate) perhaps?
PLL only tells you when a player left the track/race - not why.

If you want to know the difference between a wrong route/forced spectate and shift+S, you will need to use MSO messages afaik.
If all you need to know is that a player has entered spectate and don't care why, then just use PLL.
I'll check on this, but I'm pretty sure you can capture the event from the message in the console.
#6 - PoVo
if (Msg.EndsWith(" : took the wrong route"))
{
if (Connections[GetConnIdx(MSO.UCID)].UniqueID == 0)
{
string Message = Msg;
Message.Replace(" : took the wrong route", "");
for (int i = 0; i < Connections.Count; i++)
{
if (Connections[i].PlayerName == Message)
{

// You got the player that took wrong route
// Do some stuff.

}
}
}
}

#7 - amp88
Quote from PoVo :
if (Msg.EndsWith(" : took the wrong route"))


Won't work with non-English languages, will it?
#8 - PoVo
Quote from amp88 :Won't work with non-English languages, will it?

If it's run on LFS Dedi, it will work
Quote from PoVo :
if (Msg.EndsWith(" : took the wrong route"))
{
if (Connections[GetConnIdx(MSO.UCID)].UniqueID == 0)
{
string Message = Msg;
Message.Replace(" : took the wrong route", "");
for (int i = 0; i < Connections.Count; i++)
{
if (Connections[i].PlayerName == Message)
{

// You got the player that took wrong route
// Do some stuff.

}
}
}
}


I spotted a couple of small issues with your code. Firstly there is an easier way to check for system messages, and secondly strings in .NET are immutable, so string.Replace() does not affect the original.

// Check if was a system message.
if (MSO.UserType == Enums.MSO_UserType.MSO_SYSTEM &&
MSO.Msg.EndsWith(" : took the wrong route"))
{
// Strings in .NET are immutable.
string message = MSO.Msg.Replace(" : took the wrong route", "");

for (int i = 0; i < Connections.Count; i++)
{
if (Connections[i].PlayerName == message)
{

// You got the player that took wrong route
// Do some stuff.

// Exit from loop early
return;
}
}
}

I would probably have written it like this:

if (MSO.UserType == Enums.MSO_UserType.MSO_SYSTEM)
{
var index = MSO.Msg.IndexOf(" : took the wrong route");
if (index > -1)
{
var playername = MSO.Msg.Substring(0, index);
var connection = Connections.Single(c => c.PlayerName == playername);

// Do something with connection.
}
}

Hope that helps.
oh thnx very much of it

btw its very bothering me when I use the MST /msg Playername : took the wrong route (bug test) insim says that I was took wrong route lol
Quote from skywatcher122 :oh thnx very much of it

btw its very bothering me when I use the MST /msg Playername : took the wrong route (bug test) insim says that I was took wrong route lol

That's an volubility, you must check to make sure it's a system message.
Read the $lfs/data/language files, and read the 3g_x_wrongr & 3g_wrong_rt for each of the languages you wish to support.

FGED GREDG RDFGDR GSFDG