Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Runtime.InteropServices;
- using InSimDotNet;
- using InSimDotNet.Packets;
- using InSimDotNet.Helpers;
- using System.Collections.Generic;
- using System.Threading;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Example_Application
- {
- class Program
- {
- static void Main(string[] args)
- {
- var program = new Application();
- program.Start();
- }
- }
- class Application
- {
- // DECLARE ANY VARIABLES HERE
- InSim insim = new InSim(); // This is saying that we are declaring a new application and calling it just 'insim'
- public void Start()
- {
- // Bind packet events - These will have their own Methods (voids) further below in the application
- // insim.Bind<IS_BTC>(ButtonClick);
- // insim.Bind<IS_MCI>(MultiCarInfo);
- // Start the insim application and define the settings
- insim.Initialize(new InSimSettings
- {
- Host = "127.0.0.1", // Host where LFS is runing
- Port = 29999, // Port to connect to LFS through
- Admin = String.Empty, // Optional game admin password - obviously this is empty, you dont really need to use it
- Interval = 250, // Depends how quick you want stuff to update, ie how quick your speed button updates etc
- Flags = InSimFlags.ISF_LOCAL | InSimFlags.ISF_MCI, // This needs to be set. ISF_LOCAL stops interfering with server side insims, ISF_MCI gives you car update packets
- IName = "CSR Application",
- });
- // Confirm connection to LFS with a simple message to LFS itself and the console window
- insim.Send("/echo ^3This application has connected to LFS"); // Sending text to LFS
- Console.WriteLine("This application has connected to LFS"); // Sending text to the console window - Both are totally optional
- // Stop the application from loosing connection by adding a loop
- while(insim.IsConnected)
- {
- Thread.Sleep(200);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement