The online racing simulator
Searching in All forums
(314 results)
DarkKostas
S3 licensed
That's the correct way. I usually use name as CurrentConnection but doesn't matter. It's up to you.
Quote from HonzaQ4 :

Connections Conn = connections[NCN.UCID];


Also if you want to get it from PLID, for example on MCI packet NPL packet, you got to convert PLID into UCID.


//Function
Connections GetConnection(byte PLID)
{
Players TotalPlayers;
if (_players.TryGetValue(PLID, out TotalPlayers)) return _connections[TotalPlayers.UCID];
return null;
}

//And use
Connections CurrentConnection = GetConnection(NPL.PLID);

DarkKostas
S3 licensed
Quote from HonzaQ4 :uhmmm....you more clever than me ..... and you use better and shorter codes ....

but i still dont understand what's the difference if i use long code and you use short codes....would that make bugs or something??

but i still dont understand does my codes right or not??

and thank you very much man!

Both are correct. But why use 500 lines of code when it can become just 50! And also easier for later upgrade. For example if you want to add something new, like hmmm, if user is a banana you can use IsUserInGroup(NCN.Username, "banana") without adding any extra code Also it makes your code faster to be read and understood by somebody else.
DarkKostas
S3 licensed
Quote from HonzaQ4 :and Finally i finished my save system at .NET InSim but i need small check because if there's something wrong to avoide it and also anyone can use it for free
As i said before I'm biulding from on InSim.NETSampleByDK just to let you know and here is the codes ...

here is save users and getuser(stats) and others
...

i hope that are my codes right and thanks


#region ' Player Status ' <--- all these Player Status functions into 1

private bool IsUserInGroup(string Username, string GroupName)
{//reading 'GroupName'.ini when connecting to server
bool IsInGroup = false;
StreamReader CurrentFile = new StreamReader(DataFolder + "/groups/" + GroupName + ".ini");

string line = null;
while ((line = CurrentFile.ReadLine()) != null)
{
if (line == Username)
{
IsInGroup = true;
break;
}
}
CurrentFile.Close();
return IsInGroup;
}
#endregion

How to use?
IsCadet = IsUserInGroup(NCN.UName, "cadets")//This will look in cadets.ini

Same with the player stats.

private string GetUserStat(string Username, string StatName)
{
StreamReader CurrentFile = new StreamReader(DataFolder + "/" + StatName + ".ini");

string line = null;
while ((line = CurrentFile.ReadLine()) != null)
{
string[] LineData = line.Split('=');
if (LineData[0] == Username)
{
try { return LineData[1]; }
catch { }
}
}
CurrentFile.Close();
return "0";
}

How to use? (A little attention here. As it returns String, for supporting string, you need to Convert it into Int32 or whatever you use)
Cash = (long)GetUserStat(NCN.UName, "Cash")

DarkKostas
S3 licensed
Quote from misiek08 :Source code was lost so it's impossible to fix it.

Quote from andonow :Guys I have the Source Code of ISRM.exe and LfsInSimLib.dll - can anyone make it work on 0.6B? I have uploaded the source code + mod in the attachments. Please reply and help us

The .cs files needed to be edited is ISRM_SourceCode\ISRM\mod_drag.cs (in my opinion), and maybe some variables in LfsInSimLib_SourceCode. But I will left the programmers to find out what is needed to be edited and I hope so they make it work on 0.6B. Thanks

Regards! Andonow.

I've downloaded the source but it looks a bit complicated for me. Well, if i had the time i'd definitely could upgrade it, but in my little free time i want to do other things.
DarkKostas
S3 licensed
Quote from Daniel199751 :Hey !
i do not own a 3D TV or a PC with some fancy graphic card (not even HD)
So I'm wondering if i could it working by just buying some glasses , if so then which ones ?

For something like that it will require mix of blue/red color or similar glasses. What this does is it 'duplicates' the image so the TV can use it and tranform it into 3D. I'd like though to see something like that. Got a pair of these glasses somewhere in my room.
DarkKostas
S3 licensed
Quote from HonzaQ4 :Hello...
I'm making Cruise InSim and building on "InSim.NETSampleByDK" and i thank him so much because it's very simple and easy to understand...but i had problem....because too many things missed from his InSim as cruise .... so i decided to switch to "Spark Cruise" but the problem is that InSim builded on old Library so my question is if i changed to InSim.NET Library (last version) would that work on "Spark Cruise" InSim ?

Thanks...Honza

It won't work just by changing the library, you'll have to use the new methods that InSim.NET uses to initialise connection, bind events and even control each Callback(packet). If you have time then i'd suggest you to start copying part by part to a clean project, so you can convert it.

Also i'd like to thank you for using it and yes, this was exactly the reason i released it. To show people how to use and understand each part of InSim.NET. And of course that's the reason it doesn't include any race/drift/cruise features.
DarkKostas
S3 licensed
Pull it down(where you want it to be 100%), click on the "C" next to its Axis(at the options) and then release it. Lock all the axis again and you are ready!

Now about ideas, well you can either glue it, use tap or whatever you can think and its easy for your room. What i use now is a Guitar Hero guitar and i reversed the whammy so instead of pushing it down, i pull it up! It looks idiotic but its really fun and the motion of the hands is the same, so it ROCKS!

Like 3 in this photo, http://www.ultimate-guitar.com ... /Floyd_rose_principle.gif

but rotated 180, so its outside of the guitar.
DarkKostas
S3 licensed
A small search would help you. It was just recent.
https://www.lfsforum.net/showt ... php?p=1818812#post1818812
DarkKostas
S3 licensed
Do you know anything about MySQL? If yes I can give you some code(a little converted it to understand it more) so you can see how it works.

But if you don't know anything then just forget my post. I'd suggest you search google about mysql-connector-net. You will find lots of info on what to download and include to your project and how to install it.
DarkKostas
S3 licensed
Quote from Degats :Since InSim v5 if you set the UCID to 255 in a IS_MTC (Message To Connection) packet, it will send the message to all players. No need to use foreach etc, it can be done with one packet.

I've never used this library before, but I assume this would work:
void MessageToAll(string Message)
{
MessageToUCID(255, Message);
}


Thanks for that optimise, just noticed it on Insim document.
DarkKostas
S3 licensed
If i remember right my MessageToAll function is using /msg which has a low limit in characters.

You can use the updated here:

void MessageToAll(string Message)
{
foreach (var CurrentConnection in _connections.Values) MessageToUCID(CurrentConnection.UCID, Message);
}

Also you can use StringHelper.StripColors(_connections[CON.A.PLID].PName) to remove the colors of a Player Name. This will reduce the characters! Happy coding.
DarkKostas
S3 licensed
Try to debug it using the breakpoint and check what 'key' is actually the wrong one.
DarkKostas
S3 licensed
Quote from MadCatX :Did you specify the ISF_CON flag in the InSimSettings?

I guess that was. I had totally forgot about it.

Quote from yoran765 :EDIT :

Got it to work but when i hit someone it shows 1 hit 3...
Not sure how but it is since i cant get PlayerName out of con.A/B

You need to store a Player's and Connection's values making a List and then access them. You can always take a look at my example i have made long time ago.

https://www.lfsforum.net/showt ... php?p=1651859#post1651859
DarkKostas
S3 licensed
Looks weird to me, try send the message first and the rest code later in case of an error. Also you can use the breakpoint and check if in contact it gets called.
DarkKostas
S3 licensed
Quote from Ripley :(I started my own server)

Something with that i guess. Is it working fine if you join another server?
DarkKostas
S3 licensed
Quote from Flame CZE :There is a server (FM) FoX JuNkieS which also used to be full most of the day. Now, empty or hardly populated.

I remember that at 2010 then day after day it started to go down. Used to be my fav race server.
DarkKostas
S3 licensed
What you can do is to identify the username by telling the user to join a host(maybe your own) and check if he is online at that moment.

Or even better, i've seen it one day. Make your own insim which will return a hashed pass which you will be able to insert at your website as verification.
DarkKostas
S3 licensed
Quote from LFSMasterMan :Fat oil drift server for sure, had some great times in there.

Yes yes and yes! My first server and my favorite. That made my passion for drifting increase and later get my S2 license.
DarkKostas
S3 licensed
You need to use CarContact struct. For example

MessageToAll("Player A was in " + CON.A.GearSp + " while B was in " + CON.B.GearSP + " when they crashed eachother.);

I guess you will have to Convert.ToString the 2 byte numbers, but you got the point
DarkKostas
S3 licensed
Obviously UCID does not exist! Take a look at how packet works. You can always check Insim.txt at your lfs/docs folder.


struct CarContact // 16 bytes : one car in a contact - two of these in the IS_CON (below)
{
byte PLID;
byte Info; // like Info byte in CompCar (CCI_BLUE / CCI_YELLOW / CCI_LAG)
byte Sp2; // spare
char Steer; // front wheel steer in degrees (right positive)

byte ThrBrk; // high 4 bits : throttle / low 4 bits : brake (0 to 15)
byte CluHan; // high 4 bits : clutch / low 4 bits : handbrake (0 to 15)
byte GearSp; // high 4 bits : gear (15=R) / low 4 bits : spare
byte Speed; // m/s

byte Direction; // car's motion if Speed > 0 : 0 = world y direction, 128 = 180 deg
byte Heading; // direction of forward axis : 0 = world y direction, 128 = 180 deg
char AccelF; // m/s^2 longitudinal acceleration (forward positive)
char AccelR; // m/s^2 lateral acceleration (right positive)

short X; // position (1 metre = 16)
short Y; // position (1 metre = 16)
};

struct IS_CON // CONtact - between two cars (A and B are sorted by PLID)
{
byte Size; // 40
byte Type; // ISP_CON
byte ReqI; // 0
byte Zero;

word SpClose; // high 4 bits : reserved / low 12 bits : closing speed (10 = 1 m/s)
word Time; // looping time stamp (hundredths - time since reset - like TINY_GTH)

CarContact A;
CarContact B;
};

DarkKostas
S3 licensed
Make sure project's framework matches with your .dll framework. If i remember right there are 2 versions, 3.5 and 4.
DarkKostas
S3 licensed
Did you set each gear as well at the shifter tab? Make sure you go neutral before you configure the next gear, or else it will override it.
DarkKostas
S3 licensed
Quote from yoran765 :(are you missing a using directive or an assembly reference?)

Not really weird. I am sure you missed a reference of the Insim.NET. Just go to your project and add it.
DarkKostas
S3 licensed
Obviously the packet you are recieving is BTC and not BTT.
FGED GREDG RDFGDR GSFDG