The online racing simulator
.NET - InSim.NET - InSim library
(731 posts, started )
Quote from mokoko1234 :DarkTimes


<?php 
NPL
.Cname "VWS"// Error

AutoProperty remove pls

Before 
//Error
        /// <summary>
        /// Gets the car name of the player.
        /// </summary>
        
public string CName get; private set; }

After //No Error
        /// <summary>
        /// Gets the car name of the player.
        /// </summary>
        
public string CName getset; }


if (
NPL.CName == "XFG" && NPL.H_TRes == 50 && NPL.H_Mass == 200)
                {
                    
NPL.CName "VWS";
                    
//Leave pit message
                    
MsgAll(PlayerName "Car: Volkswagen Scirocco");
                }
// No buy xfg
// !buy VWS
// Select XFG
// Intake Restriction = 50
// Added Mass = 200
// Leave pit VWS Tweaked Cars Nto open VWS Real sv :)
// No buy VWS
// !buy XFG
// Select XFG and Intake Restriction 50 Added Mass 200 Thief Car :)

// + Payout System
if (C.Cars == "VWS")
{
cash.Next(510);
}

// Dealer
case "VWS": return 35000;

// Buy

if (StrMsg[1].ToUpper() == "VWS")
{
MsgPly("Volkswagen Scirocco (VWS) ^7This car is in the garage!"MSO.UCID);
}

if (
StrMsg[1].ToUpper() == "VWS")
{
MsgPly("Insufficient amount of money ^1Volkswagen Scirocco (VWS)"MSO.UCID);
if (
Connections[GetConnIdx(MSO.UCID)].Cash <= Dealer.GetCarPrice(StrMsg[1]))
{
MsgPly("^9 Prices: ^1$" Dealer.GetCarPrice(StrMsg[1]) + " ^7Necessary: ^2$" + (9000 Connections[GetConnIdx(MSO.UCID)].Cash), MSO.UCID);
}
}

case 
"VWS":
Cars Cars " " "VWS";
Connections[GetConnIdx(MSO.UCID)].Cars Cars;
Connections[GetConnIdx(MSO.UCID)].Cash -= Dealer.GetCarPrice("VWS");
MsgAll("^9 " Connections[GetConnIdx(MSO.UCID)].PlayerName " ^7bought ^VWS");
MsgPly("^9 Buy Car: ^1Volkswagen Scirocco (VWS) Garage Add"MSO.UCID);
MsgPly("^9 Car Prices: ^1$" Dealer.GetCarPrice("VWS") + " ^7Remaining Money: ^2$" Connections[GetConnIdx(MSO.UCID)].Cash ""MSO.UCID);
break;

// Sell

if (StrMsg[1].ToUpper() == "VWS")
{
MsgPly("^9 sold ^1Volkswagen Scirocco (VWS)"MSO.UCID);
MsgPly("^9 Cash: ^1$" Dealer.GetCarValue(StrMsg[1].ToUpper()) + " ^7Remaining Money: ^2$" Connections[GetConnIdx(MSO.UCID)].CashMSO.UCID);
}

// Prices List
MsgAll("^3[VWS]^7 Volkswagen Scirocco ^1$" string.Format("{0:n0}"Dealer.GetCarPrice("VWS")) + " ^9- ^2" string.Format("{0:n0}"Dealer.GetCarValue("VWS")) + "$");
?>


thank you Smile
solved
Thanks to DarkTimes and FlameCZE for the last (silent) update to Version 2.3.1!
Only new Blackwood configurations are added to the TrackHelper but this keeps InSim.Net up to date.
Hello! Can someone help me? I have a problem with BTT on .Net. BTT is Button Text when I click a button must open a text box but it is not working.. Can u help me, please?
Show the code of the button that is clickable. Read the documentation to make sure the button is clickable and you can type in it.


{
byte Size; // 12 + TEXT_SIZE (a multiple of 4)
byte Type; // ISP_BTN
byte ReqI; // non-zero (returned in IS_BTC and IS_BTT packets)
byte UCID; // connection to display the button (0 = local / 255 = all)

byte ClickID; // button ID (0 to 239)
byte Inst; // some extra flags - see below
byte BStyle; // button style flags - see below
byte TypeIn; // max chars to type in - see below

byte L; // left : 0 - 200
byte T; // top : 0 - 200
byte W; // width : 0 - 200
byte H; // height : 0 - 200

// char Text[TEXT_SIZE]; // 0 to 240 characters of text
};

You know when go to bank You can see button insert, button witdraw and etc. I want when click button insert to open text box and write the sum what i need t o insert Smile

I make it with command !insert , !withdraw and etc. but it is not usable... it is not comfortably
Hey all,

It seems I missed a patch last year, which added the SMALL_LCS packet, plus the ISS_DIALOG and ISS_TEXT_ENTRY options for StateFlags. I have added SMALL_LCS to the SmallType enum, but I also added a class called LocalCarSwitches, that helps you with setting these options. It is just constants for the various values, which you can set for UVal.


<?php 
// Turn siren on
insim.Send(new IS_SMALL
{
    
SubT SmallType.SMALL_LCS,
    
UVal LocalCarSwitches.LCS_SIREN_SLOW
});

// Turn horn and lights on
insim.Send(new IS_SMALL
{
    
SubT SmallType.SMALL_LCS,
    
UVal LocalCarSwitches.LCS_HORN_1 LocalCarSwitches.LCS_FLASH_ON
});

// Turn horn off
insim.Send(new IS_SMALL
{
    
SubT SmallType.SMALL_LCS,
    
UVal LocalCarSwitches.LCS_HORN_OFF
});
?>

Which will sound the horn and flash the lights etc.

I've updated GitHub, will put out a new version soon.

Edit: new version out on GitHub and NuGet.
Someone was asking a while back for a version of InSim.NET compatible with .NET Core. I recently made the changes needed to get it working on .NET Core.

You can find it here: https://github.com/alexmcbride/insimdotnetcore

This is not super tested or supported, but I will obviously fix bugs or issues people have. If you don't know or care what .NET Core is then don't use this!

There are a few breaking changes in this version, mainly that you can no longer call InSim.Initialize(), you have to use InSim.InitializeAsync(). This change is because TcpClient.Connect() was removed from .NET, for some reason.

Additionally I decided to switch the string encoding over the new one that I had written, which was/is not massively tested. Basically this string conversion stuff still converts bytes to unicode and back again, but it does not otherwise mess with the strings, so it leaves language, colour, and escape codes in there. You can use the StringHelper Strip() and Escape()/Unescape() methods if you want to display strings in your own UI. I didn't want to have multiple different versions of the string encoding stuff to maintain. Also I needed to make some changes to how the strings worked to make sure it ran without problems on Mac and Linux, as I wanted to ditch the interop stuff once and for all.

As I say, use at own risk.
Ah cool! I asked about that and was wondering if you had time for it.

I'll try it ASAP!
How to place objects with Command?
Using the IS_AXM packet. Check the documentation. This is not the place to ask for people to make stuff for you.
There seems to be a bug with the LCS_ constants - in InSim.NET, LCS_HORN_5 has the value 2162696, but should be 327688.

To avoid some of the confusing magic numbers, you could define the horns by shifting:

LCS_HORN_1 = (1 << 16) + LCS_SET_HORN;
LCS_HORN_2 = (2 << 16) + LCS_SET_HORN;
LCS_HORN_3 = (3 << 16) + LCS_SET_HORN;
LCS_HORN_4 = (4 << 16) + LCS_SET_HORN;
LCS_HORN_5 = (5 << 16) + LCS_SET_HORN;
LCS_HORN_OFF = LCS_SET_HORN;

-
(Chag16) DELETED by Chag16
Quote from DarkTimes :Someone was asking a while back for a version of InSim.NET compatible with .NET Core. I recently made the changes needed to get it working on .NET Core.

You can find it here: https://github.com/alexmcbride/insimdotnetcore

This is not super tested or supported, but I will obviously fix bugs or issues people have. If you don't know or care what .NET Core is then don't use this!

There are a few breaking changes in this version, mainly that you can no longer call InSim.Initialize(), you have to use InSim.InitializeAsync(). This change is because TcpClient.Connect() was removed from .NET, for some reason.

Additionally I decided to switch the string encoding over the new one that I had written, which was/is not massively tested. Basically this string conversion stuff still converts bytes to unicode and back again, but it does not otherwise mess with the strings, so it leaves language, colour, and escape codes in there. You can use the StringHelper Strip() and Escape()/Unescape() methods if you want to display strings in your own UI. I didn't want to have multiple different versions of the string encoding stuff to maintain. Also I needed to make some changes to how the strings worked to make sure it ran without problems on Mac and Linux, as I wanted to ditch the interop stuff once and for all.

As I say, use at own risk.

Done a few quick tests and it seems to work fine. Good job. Are you planning to make it a NuGet package?

Anyway, I'm planning to make it into a UWP (Or Xamerin) app for managing severs (kick, ban, execute commands etc).

edit: I get this error in debug mode when I create a new InSim object:

System.IO.FileLoadException: 'Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

Seems to run in Release mode for some reason though.

edit2: Tried to convert it to a .netstandard 1.4 project and now it doesn't give an error while connecting, but I get this in LFS: InSim - TCP : did not receive InSimInit packet

Any idea?
I don't know, I get the same error now, but no idea why. It was working for me when I created it, now it doesn't work at all.

I have to say, I absolutely hate .NET Core, I find it so confusing and hard to use.
It's a little confusing me for me as well..

I've got it to work now. I've made the InSim project netstandard1.4 (change the InSimDotNetCore.csproj file), and included "System.Text.Encoding.CodePages" in my UWP project. I then build the InSim .dll and reference to it in my UWP project. Seems to be working fine now.

When I get from work I'll try to run the app on my WM10 phone, would be amazing to run InSim from a phone!

Also did a quick test in a Xamerin project, and seems to work as well. Don't have the Android SDK etc to test that, but looks like that can work as well.
OK - cool.

I noticed there was an update for VS, so I updated it to the latest version, and that seems to have done the trick. Not sure what was going on before.

I'm on VS 2017 15.1 (26403.7) and it's working now.
Hello! I made MySQL data base, but I am getting this error... Can you help me?

CNL - There is already an open DataReader associated with this Connection which must be closed first.
Where you're getting that?
Hi Darktimes, insim.net library sample source code cruise insim share?
Quote from racerss :Where you're getting that?

in patcketerror.txt this file say to me all errors of insim
Isn't the solution right in the error you posted?

Show us the code you're trying to run.
Hello! I fix error, but when i leave my server i can't join again probably im staying online and when I try to join server kick me, because the server see me online... LMAO Big grin
Hello guys!

I have been experimenting with this InSim .NET library, it's really cool, but I've come across a problem which i have not seen anywhere explained.
I can't send two IS_BTN packets with one Send command like this:

InSim inSim = new InSim();
inSim.Initialize(new InSimSettings()
{
Host = "127.0.0.1",
Port = 29999,
});

inSim.Send(new IS_BTN()
{
BStyle = ButtonStyles.ISB_DARK,
ClickID = 0,
UCID = 255,
ReqI = 1,
L = 50,
T = 50,
W = 30,
H = 10,
Text = "heey"
}, new IS_BTN()
{
BStyle = ButtonStyles.ISB_DARK,
ClickID = 1,
UCID = 255,
ReqI = 2,
L = 50,
T = 60,
W = 30,
H = 10,
Text = "hooo"
});

It works perfectly if I send it once at a time, otherwise it throws an ArgumentException.
Why is that?
OK thanks, I've fixed that error on Github.
Hello! When i start insim why insim is saying ''Stop responding'' or inisim is loading too slow interface can you help me?

.NET - InSim.NET - InSim library
(731 posts, started )
FGED GREDG RDFGDR GSFDG