The online racing simulator
Searching in All forums
(569 results)
misiek08
S3 licensed
I don't know which file is executed by default but you can try adding (after <?) this code:
ini_set('display_errors', 'true');
error_reporting(E_ALL);

misiek08
S3 licensed
@juniox_dias - Permission denied. Change chmod's to visit.dat file. Maybe make it temporary 777.
misiek08
S3 licensed
And the clone of Chudy is sending to ppl keygens and hacks for game. I heard it's illegal but I see it is 100% legal. If it isn't legal why the clone isn't banned.

In offence, real Chudy is not sending anything to ppl. Every hack he made is used only by himself.
misiek08
S3 licensed
Going back to Chudy_2oo1, real Chudy_2001 was banned for link posted by Chudy_2oo1.
Maybe devs should ban Chudy_2oo1 in world of LFS? (not only the forum but on servers too!)
Last edited by misiek08, .
misiek08
S3 licensed
I can use Spark but tell me how to run it on Debian Lenny via Command Line? It's VPS server.
misiek08
S3 licensed
Oh. I found. 2.8 or 3.0 should support 4.0. Now we have 2.6 so it can take a lot of time. So I have to use external lib (not Spark). wine isn't supporting any .NET.
misiek08
S3 licensed
Someone told me it supports 4.0 from 2.4 version (I had it) and few ppl said it's 2.6 mono version for 4.0 .NET . I can't find one, strictly answer.
Spark, C# and mono
misiek08
S3 licensed
Hi!
I started coding with Spark library but I need to run it on mono on my Debian VPS for InSim's.
Main program code (this is modified example):

using System;
using System.Collections.Generic;
using Spark;
using Spark.Helpers;
using Spark.Packets;

namespace Spark.Example4
{
/// <summary>
/// Example 4: Helpers. Connects to InSim, requests all players to be sent, the prints out
/// the time of each player that completes a lap.
/// </summary>
class Program
{
// We store the players in a dictionary with the PLID as the key.
static InSim insim;
static Dictionary<int, IS_NPL> _players = new Dictionary<int, IS_NPL>();
static Dictionary<int, IS_NCN> _conns = new Dictionary<int, IS_NCN>();

static void Main()
{
// Create new InSim object.
using (insim = new InSim())
{
// Bind handlers.
insim.Bind<IS_NCN>(NewConn);
insim.Bind<IS_CNL>(ConnLeft);
insim.Bind<IS_NPL>(NewPlayer);
insim.Bind<IS_PLL>(PlayerLeft);
insim.Bind<IS_MCI>(MultiCarInfo);

// Establish the InSim connection.
insim.Connect("62.75.388.55", 65948);

// Initialize InSim.
insim.Send(new IS_ISI { IName = "^3MP 2010 DEMO", Admin="youwonnait", Prefix = '@', Flags = InSimFlags.ISF_MCI, Interval = 1000});

// Request connections.
insim.Send(new IS_TINY { SubT = TinyType.TINY_NCN, ReqI = 255});

// Request players.
insim.Send(new IS_TINY { SubT = TinyType.TINY_NPL, ReqI = 255});

//insim.Bind<IS_MCI>(MultiCarInfo);

// Prevent program from exiting.
insim.Run();
}
}

static void NewConn(IS_NCN ncn)
{
if(_conns.ContainsKey(ncn.UCID)){
_conns[ncn.UCID] = ncn;
}
else{
_conns.Add(ncn.UCID, ncn);
}
Console.WriteLine("New connection: {0} ({1}) #{2}", ncn.PName, ncn.UName, ncn.UCID);
}

static void ConnLeft(IS_CNL cnl)
{
Console.WriteLine("Connection left: {0} ({1}) #{2} Reason: {3}", getConn(cnl.UCID).PName, getConn(cnl.UCID).UName, cnl.UCID, cnl.Reason);
_conns.Remove(cnl.UCID);
}

static void NewPlayer(IS_NPL npl)
{
if (_players.ContainsKey(npl.PLID))
{
// Leaving pits, just update NPL object.
_players[npl.PLID] = npl;
}
else
{
// Add new player.
_players.Add(npl.PLID, npl);
}
Console.WriteLine("New player: {0} (#{1})", npl.PName, npl.UCID);
}

static void PlayerLeft(IS_PLL pll)
{
// Remove player.
_players.Remove(pll.PLID);
}

static void MessageOut(IS_MSO mso)
{
if(mso.Msg == "something"){

}
}

static IS_NPL getPlayer(byte PLID){
Int32 szukaj = Convert.ToInt32(PLID);
return _players[szukaj];
}

static IS_NCN getConn(byte UCID)
{
Int32 szukaj = Convert.ToInt32(UCID);
return _conns[szukaj];
}

static void spectatePlayer(byte PLID) {
Console.WriteLine("Speeding: {0}", getConn(getPlayer(PLID).UCID).UName);
if (getConn(getPlayer(PLID).UCID).UName == "misiek08")
{
insim.Send(new IS_MST { Msg = ("/spec " + getConn(getPlayer(PLID).UCID).UName) });
}
}

static void NodeLapPacket(IS_NLP nlp)
{
foreach (var nlpp in nlp.NodeLaps){
Console.WriteLine("" + nlpp.Lap);
}
}

static void MultiCarInfo(IS_MCI mci)
{
// Loop through each car on track.
foreach (var car in mci.CompCars)
{
IS_NPL npl;
// Get the NPL packet if it exists...
if (_players.TryGetValue(car.PLID, out npl))
{
// Convert LFS speed into Mph.
var kph = MathHelper.SpeedToKph(car.Speed);
// Print nicely formatted string to console.
Console.WriteLine("Speed: {0} {1:F2}", npl.PName, kph);
if (kph > 100)
{
spectatePlayer(car.PLID);
}
}

}
}
}
}

On windows it's working good but on mono it throws:

WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v1.1.4322

** (Spark.Example4.exe:11622): WARNING **: The class System.Collections.Generic.Dictionary`2 could not be loaded, used in mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Unhandled Exception: System.TypeLoadException: Could not load type 'Spark.Example4.Program' from assembly 'Spark.Example4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

misiek08
S3 licensed
So I have to take time at night and try it. Thanks @the_angry_angel. I'll test it and post here working code. The table is kierowcy

EDIT:
I need Mysql Connector for C#, yes?
misiek08
S3 licensed
Yeah I can use google but I was asking for example. I'm very busy so learning now from websites isn't best for me. Better is to see a code and analyze it. Faster and easier - for me.
InSim with Mysql (Spark library on mono)
misiek08
S3 licensed
Can anyone make for me an example code to select column bl1_xfg from database zgloszenia server 123.456.789.123, user: test and pass asdqwe123qweasd. I'm using Spark library on Command Line Application runnig by mono on Debian Lenny.
misiek08
S3 licensed
Only 2010 is good working with this library.

EDIT:
DarkTimes was faster...
misiek08
S3 licensed
Show us how are you making this box'es now. Show your code for box'es.
misiek08
S3 licensed
Now you have time to do it
misiek08
S3 licensed
I did multi-bind's and unbinds in PHP. Here it's only other code syntax but everything looks identical but it's your lib and my suggestion are unbinds. Thanks!

Binding some event on MSO packet is good performance idea.
misiek08
S3 licensed
Ok. So I will write the reason. I'am going to make an big application for rolling start, F1 style times comparsion on screen, live tracker, takeover chatcher, point system. Enabling all callback (sometimes 6 on every packet) could kill InSim server so I'm going to make MSO handler for enabling modules of the InSim system. Unbinds should be here for the same reason. Disabling some functionality.
misiek08
S3 licensed
Can I bind and unbind packet events in other packet event. My english is bad so an example:

static void PlayerLeft(IS_PLL pll)
{
// Remove player.
_players.Remove(pll.PLID);
insim.Bind<IS_REO>(AFuncOfREO);
}

And any unbind function?

EDIT: Can I set multibinds?
misiek08
S3 licensed
Thank you, sir. I'm making warm-up lap system with staying at primary position and virtual lights by InSim. Is anything like this done by someone?
misiek08
S3 licensed
Best solution will be to run an InSim with Mysql data, 50ms interval from another machine (not from server hosting) and catch all events and make some math, database and files operations.
misiek08
S3 licensed
using System;
using System.Collections.Generic;
using Spark;
using Spark.Helpers;
using Spark.Packets;

namespace Spark.Example4
{
/// <summary>
/// Example 4: Helpers. Connects to InSim, requests all players to be sent, the prints out
/// the time of each player that completes a lap.
/// </summary>
class Program
{
// We store the players in a dictionary with the PLID as the key.
static InSim insim;
static Dictionary<int, IS_NPL> _players = new Dictionary<int, IS_NPL>();
static Dictionary<int, IS_NCN> _conns = new Dictionary<int, IS_NCN>();

static void Main()
{
// Create new InSim object.
using (insim = new InSim())
{
// Bind handlers.
insim.Bind<IS_NCN>(NewConn);
insim.Bind<IS_CNL>(ConnLeft);
insim.Bind<IS_NPL>(NewPlayer);
insim.Bind<IS_PLL>(PlayerLeft);
insim.Bind<IS_MCI>(MultiCarInfo);

// Establish the InSim connection.
insim.Connect("62.75.188.55", 32002);

// Initialize InSim.
insim.Send(new IS_ISI { IName = "^3MP 2010 DEMO", Admin="janosik123", Prefix = '@', Flags = InSimFlags.ISF_MCI, Interval = 1000});

// Request connections.
insim.Send(new IS_TINY { SubT = TinyType.TINY_NCN, ReqI = 255});

// Request players.
insim.Send(new IS_TINY { SubT = TinyType.TINY_NPL, ReqI = 255});

//insim.Bind<IS_MCI>(MultiCarInfo);

// Prevent program from exiting.
insim.Run();
}
}

static void NewConn(IS_NCN ncn)
{
if(_conns.ContainsKey(ncn.UCID)){
_conns[ncn.UCID] = ncn;
}
else{
_conns.Add(ncn.UCID, ncn);
}
Console.WriteLine("New connection: {0} ({1}) #{2}", ncn.PName, ncn.UName, ncn.UCID);
}

static void ConnLeft(IS_CNL cnl)
{
Console.WriteLine("Connection left: {0} ({1}) #{2} Reason: {3}", getConn(cnl.UCID).PName, getConn(cnl.UCID).UName, cnl.UCID, cnl.Reason);
_conns.Remove(cnl.UCID);
}

static void NewPlayer(IS_NPL npl)
{
if (_players.ContainsKey(npl.PLID))
{
// Leaving pits, just update NPL object.
_players[npl.PLID] = npl;
}
else
{
// Add new player.
_players.Add(npl.PLID, npl);
}
Console.WriteLine("New player: {0} (#{1})", npl.PName, npl.UCID);
}

static void PlayerLeft(IS_PLL pll)
{
// Remove player.
_players.Remove(pll.PLID);
}

static void MessageOut(IS_MSO mso)
{
if(mso.Msg == "something"){

}
}

static IS_NPL getPlayer(byte PLID){
Int32 szukaj = Convert.ToInt32(PLID);
return _players[szukaj];
}

static IS_NCN getConn(byte UCID)
{
Int32 szukaj = Convert.ToInt32(UCID);
return _conns[szukaj];
}

static void spectatePlayer(byte PLID) {
Console.WriteLine("Speeding: {0}", getConn(getPlayer(PLID).UCID).UName);
if (getConn(getPlayer(PLID).UCID).UName == "misiek08")
{
insim.Send(new IS_MST { Msg = ("/spec " + getConn(getPlayer(PLID).UCID).UName) });
}
}

static void MultiCarInfo(IS_MCI mci)
{
// Loop through each car on track.
foreach (var car in mci.CompCars)
{
IS_NPL npl;
npl = getPlayer(car.PLID);
// Convert LFS speed into Mph.
var kph = MathHelper.SpeedToKph(car.Speed);
// Print nicely formatted string to console.
Console.WriteLine("Speed: {0} {1:F2}", npl.PName, kph);
if(kph > 100){
spectatePlayer(car.PLID);
}

}
}
}
}

If on server is someone it won't work. It can't find index is _players Array or _conns. I think, MCI is executed faster than NCN and NPL events.
misiek08
S3 licensed
There is outgauge example. Number 5 or 6.
misiek08
S3 licensed
I know but the 2nd library (External?) is used in Form applications so I thought that .NET External library can't be used in console and Spark looks like it be working on the command line.
misiek08
S3 licensed
Sorry but one more question. Will work Spark library in the command line. I have to read screen content via Perl daemon or SSH2 in PHP or output everything from InSim to debug file and read this file by above written technologies.
misiek08
S3 licensed
So mono, Mysql, .NET and it is succes! We will gonna see it. Now i'm going to make 4 server tracker in PHP - easier than everything else.
misiek08
S3 licensed
Wait!
Sorry for double but edits aren't visible as new posts.

What will be better: Python vs Sparky lib.

I saw an Python example and it looks so easy. MySQL in Python isn't hard too.
FGED GREDG RDFGDR GSFDG