The online racing simulator
[solved] Insim is crashing in a way I don't understand
Hello. There is a code to send a private message. But when I use this, lapper crashes. When I use the command, it works, but after a while, Insim starts again. When I look at the ERR log, I see this:

Input string was not in a correct format.
mscorlib
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s)
at LFSLapper.LFSClient.privmsg(unionVal val, ArrayList args)
at GLScript.GLApp.parseBackcall(SetOfVars GVAR, SetOfVars LVAR, unionVal val, ArrayList args)
at GLScript.Parseur.getval(SetOfVars GVAR, SetOfVars LVAR, executeParsedFunction BC)
at GLScript.GLApp.retrieveEvalVar(String funcName, TokenParse tkparse, TokenBuffer currTokenBuffer, SetOfVars GVAR, SetOfVars LVAR, Boolean breakFunc, Char& breakCar)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteFunction(String funcName, String[] argsVals)
at GLScript.GLApp.executeFunction(String funcName, String[] argsVals)
at Configurator.lexConfigurator.executeFunction(String funcName, infoPlayer pcurrInfoPlayer, String[] par)
at LFSLapper.LFSClient.managePacket(MSO mso)
at LFSLapper.LFSClient.Loop(Connect insimConnection)
at LFSLapper.LFSClient.doloop()
at LapperInstances.LapperInstance.doConnection()
Void StringToNumber(System.String, System.Globalization.NumberStyles, NumberBuffer ByRef, System.Globalization.NumberFormatInfo, Boolean)
Closing Instance...
-----------------------------------------------------------------------------





CASE "!pm":
IF( $argv != "" ) THEN
$idxSpace = indexOf( $argv, " ");
IF( $idxSpace != -1 ) THEN
$kimegidecek = subStr( $argv,0,$idxSpace );
$argv = trim( subStr( $argv,$idxSpace ) );
privMsg( $kimegidecek , "^1[Özel Mesaj] ^7". $userName . " ^0>> ^3" . $argv . );
privMsg("^1[Mesaj Gönderildi] ^7". $userName . " ^0>> ^3" . $argv .);


ELSE
privMsg ( "^7Doğru komut kullanımı !pm <username> <mesaj>" );
ENDIF
ELSE
privMsg ( "^7Kime gönderebilirim? Admin adını bilecek kadar zeki değilim." );
ENDIF
BREAK;

Can you help to solve the problem? (lapper version 7.0.9.0)
Do not quote the message. After the problem is solved, I need to delete the coding. I didn't get permission to share this.
do you see all the privmsg() messages in the chatlog?

What do you mean, you do not have permission to share this?
Is this your code or is someone else coding it?

So many questions are going on in my mind right now.
Quote from Bass-Driver :do you see all the privmsg() messages in the chatlog?

What do you mean, you do not have permission to share this?
Is this your code or is someone else coding it?

So many questions are going on in my mind right now.

Since my friend was not active, I could not get a response from him. I also conveyed the situation to him. We talked to him 15 minutes ago. He said that he could not see a problem and that the coding should work. I told him that I wanted help on the forum.
CASE "!pm":
IF( $argv != "" ) THEN
$idxSpace = indexOf( $argv, " ");
IF( $idxSpace != -1 ) THEN
$toUser = subStr( $argv,0,$idxSpace );
$argv = trim( subStr( $argv,$idxSpace ) );
privMsg( $toUser , "^7" . $argv );
ELSE
privMsg ( "^7Bos birakmain" );
ENDIF
ELSE
privMsg ( "^7Bos birakmain" );
ENDIF
BREAK;

We solved the problem. Thanks.
** Best answer **
@RealistAdam: Please tell us what causes LFSLapper to crash, so we can fix it in the next versions of LFSLapper.

My quick investigation to the crash:

LFSLapper seems to crash when the playername doesn't exist, and is being used in the privmsg() function.
This need to be fixed in the next version of LFSLapper.

I've added a extra check to the command if the playernames are entered correctly.
Be aware that the usernames are capital sensitive.

For example: Bass-Driver is correct and bass-driver isn't.

CASE "!pm":
IF( $argv != "" ) THEN

$idxSpace = indexOf( $argv, " ");
IF( $idxSpace != -1 ) THEN

$User = subStr( $argv,0,$idxSpace );

#Check if Player is online on the server.
$currPly = getPlayerInfo($User);
IF( $currPly != "" ) THEN
$Message = trim( subStr( $argv,$idxSpace ) );

privMsg( $User , "^1[PM] ^7". $userName . " ^0>> ^3" . $Message);
privMsg("^1[Private Message] ^7". $User . " ^0>> ^3" . $Message);
ELSE
privMsg ( "^7Player does not exist");
ENDIF
ELSE
privMsg ( "^7Incomplete command: !pm <username> <Message>" );
ENDIF
ELSE
privMsg ( "^7Incomplete command: !pm <username> <Message>" );
ENDIF
BREAK;

Quote from Bass-Driver :@RealistAdam: Please tell us what causes LFSLapper to crash, so we can fix it in the next versions of LFSLapper.

My quick investigation to the crash:

LFSLapper seems to crash when the playername doesn't exist, and is being used in the privmsg() function.
This need to be fixed in the next version of LFSLapper.

I've added a extra check to the command if the playernames are entered correctly.
Be aware that the usernames are capital sensitive.

For example: Bass-Driver is correct and bass-driver isn't.

CASE "!pm":
IF( $argv != "" ) THEN

$idxSpace = indexOf( $argv, " ");
IF( $idxSpace != -1 ) THEN

$User = subStr( $argv,0,$idxSpace );

#Check if Player is online on the server.
$currPly = getPlayerInfo($User);
IF( $currPly != "" ) THEN
$Message = trim( subStr( $argv,$idxSpace ) );

privMsg( $User , "^1[PM] ^7". $userName . " ^0>> ^3" . $Message);
privMsg("^1[Private Message] ^7". $User . " ^0>> ^3" . $Message);
ELSE
privMsg ( "^7Player does not exist");
ENDIF
ELSE
privMsg ( "^7Incomplete command: !pm <username> <Message>" );
ENDIF
ELSE
privMsg ( "^7Incomplete command: !pm <username> <Message>" );
ENDIF
BREAK;


Unfortunately, we could not find what caused the Lapper crash. We just changed the coding. In the error logs, there was the same article I shared. Thank you for your help.
This thread is closed

FGED GREDG RDFGDR GSFDG